genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System
Apache License 2.0
500 stars 86 forks source link

The target port does not hold any URL. #448

Closed TheCraziiOne closed 3 months ago

TheCraziiOne commented 3 months ago

Describe the Issue A clear and concise description of what the issue is.

Hello everybody Im completely new to Python and trying to konect to the GigE Camera is one of my first Projects.

To my issue: I have written a small program but as soon as I start It, the program stops at h.create and tells me: "The target port does not hold any URL." I can see on the Camera that the Status has changed to connected but i do not get any further or pictures. Based on my reserch it has something to do with some File Paths. But thats all I know.

I get a connection to spin view (Teledyne)

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Sample Code I can show a piece of code that demonstrates the reported phenomenon:

Yes

If yes, please provide a sample code:

from harvesters.core import Harvester
import cv2
import numpy as np

# Initialize Harvester and add GenTL Producer
h = Harvester()
h.add_file(r'C:\Program Files\Teledyne\Spinnaker\cti64\vs2015\Spinnaker_GenTL_v140.cti')
h.update()
num_devices = len(h.device_info_list)
print("Number of available devices:", num_devices)

if num_devices > 0:
    # Add the GenICam XML file
    h.add_file(r'C:\Users\Public\Pictures\Test Genie Nano\Test.xml')

    cam = h.create(0)

    try:
        # Start camera
        cam.start_acquisition()

        # Capture single frame
        buffer = cam.fetch_buffer()

        # Convert image to a Numpy array
        image = buffer.payload.components[0].data.reshape(buffer.payload.components[0].height, buffer.payload.components[0].width)

        # Save image
        cv2.imwrite("test_image.png", image)

        # Release buffer
        cam.queue_buffer(buffer)

    except Exception as ex:
        print("Error capturing image: %s" % ex)

    finally:
        # Stop camera and disconnect
        cam.stop_acquisition()
        cam.destroy()
else:
    print("No devices found.")

# Release Harvester
h.reset()

If applicable, please paste the actual output (its whole traceback, etc) here:

Number of available devices: 1
Traceback (most recent call last):
  File "c:\Users\Public\Pictures\from harvesters.py", line 16, in <module>
    cam = h.create(0)
          ^^^^^^^^^^^
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 3082, in create
    return self._create_acquirer(device_proxy=device_proxy, config=config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 3112, in _create_acquirer
    ia = ImageAcquirer(device_proxy=device_proxy_, config=config,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 1631, in __init__
    self._remote_device = RemoteDevice(
                          ^^^^^^^^^^^^^
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 485, in __init__
    super().__init__(
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 281, in __init__
    self._node_map = self._create_node_map(
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 320, in _create_node_map
    clean_up_required, file_path = self._retrieve_file_path(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XY\AppData\Local\anaconda3\envs\Teledyne_TPA2\Lib\site-packages\harvesters\core.py", line 378, in _retrieve_file_path
    raise LogicalErrorException(
_genapi.LogicalErrorException: The target port does not hold any URL.

Expected Behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem; Note that it is not necessary to put everything as a screenshot! If the source is a text just paste the text because that is much helpful for us.

Configuration

Reproducibility

This phenomenon can be stably reproduced:

Yes

If applicable, please provide your observation about the reproducibility.

Actions You Have Taken

I've read the Harvester FAQ page. I've searched the whole github issues section

Additional context

I love to work with Harvester as it is very easy to understand (from a beginners sight). I would apreciate the help If someone had a similar problem. Thank you very much

TheCraziiOne commented 3 months ago

Solution: We used another GenTL Producer (GigE Vison) for our CTI File.