genicam / harvesters

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

Can't fetch buffer #210

Closed xlukas10 closed 3 years ago

xlukas10 commented 3 years ago

Hello, I am fairly new to Python and harvesters so there is a good chance I am doing some simple mistake. I am using Allied Vision camera Manta_G-125B, it is GigE Vision camera. When I run following code, it gets stuck at cam.fetch_buffer(). When I tried changing Width and Height parameters to 8 or 16 it worked, but only sometimes (like once it did then 4 times not then twice did etc. etc.). Am I doing something wrong or is my camera just unsupported? Also the camera was tested in Vimba Viewer and works.

from harvesters.core import Harvester 

h = Harvester()
h.add_file('C:/Programy/Allied Vision/Vimba_4.0/VimbaGigETL/Bin/Win64/VimbaGigETL.cti')
h.update()
print(h.device_info_list)
cam = h.create_image_acquirer(0)

cam.remote_device.node_map.Width.value = 760 
cam.remote_device.node_map.Height.value = 500
#works sometimes when set to small number (like 8 or 16) 

cam.remote_device.node_map.PixelFormat.value = 'Mono8'

cam.start_acquisition()

with cam.fetch_buffer() as buffer:
            #2D component of acquired data
            component = buffer.payload.components[0]           
            print(component.data)

cam.stop_acquisition()
cam.destroy()

h.reset()

input('Exit')
mrevah commented 3 years ago

Hi, I got the same problem, I'm using an Allied Vision camera (Manta G-319C). The exception (crash) you are talking about comes from component = buffer.payload.components[0]. The exception is: error

xlukas10 commented 3 years ago

I found out where the problem is, however as of now I didn't find the solution in Harvester. If I use Allied Vision supplied API and modify the GVSPPacketSize node to 1500 (defaults to 8800) the frame acquisition is successful. The problem now is that Harvester is throwing exception that this node does not exist. Is there any way to list all available nodes? I suspect, that my camera uses some non-standard nodes that are not supported in genicam/Harvester by default.

kazunarikudo commented 3 years ago

@mrevah Hi.

Is there any way to list all available nodes?

dir(ia.remote_device.node_map)  # ia: an ImageAcquire object

should give you a list of feature nodes that the remote device, i.e. the camera has. /Kazunari

xlukas10 commented 3 years ago

Thank you a lot. It works now. If someone has the same problem, the node that has to be edited is GevSCPSPacketSize.

ld-satori commented 2 years ago

Thanks for the hint. I tried to use Vimba to modify the GevSCPSPacketSize value to 1500, but seems like the program still stuck at fetch_beffer() step.

I tried to use wireshark to inspect the packets, the Control Channel Privilege register indicate the "Control Access" filed is False and followed by an "Access Denied" message from remote device. Tried to use the Vimba to capture the image with same GevSCPSPacketSize value and it works fine.

Any hints on cause of failed to fetch_buffer() even when GevSCPSPacketSize is set to 1500? Also I did not find a way to edit the CCP(Control Channel Privilege) register to debug if that is the root cause, any suggestions are appreciated.

StefanD986 commented 2 years ago

About the issue with the packet size: You should make sure to enable Jumbo frames on the network adapter (On windows that is via device manager -> right click the network interface the camera is connected to -> properties -> Advanced -> Jumbo Packet -> choose the max size (9014 for me).

Not sure whether it fixes your problem, but I know that it fixes a lot of issues for us.