jordens / pyflycapture2

python bindings for the flycapture v2 api (libflycapture-2c)
37 stars 31 forks source link

print [np.array(c.retrieve_buffer(im)).sum() for i in range(80)] gets stuck forever #33

Closed ZrrrKIT closed 4 years ago

ZrrrKIT commented 4 years ago

Hi, I am trying to access a Blackfly BFLY-U3-23S6C via the python testtest_flycapture2.pyyou have provided. It seems that setting the video mode and frame rate cause some sort of error but I can't figure out what exactly is the reason. Here is my error output: $ python test_flycapture2.py

 {'major': 2, 'minor': 11, 'type': 3, 'build': 121} 
 1
 {'serial_number': 16320732, 'model_name': b'Blackfly BFLY-U3-23S6C', 'vendor_name': b'Point Grey Research', 'sensor_info': b'Sony IMX249 (1/1.2" Color CMOS)', 'sensor_resolution': b'1920x1200', 'driver_name': b'None', 'interface': 'USB3', 'firmware_version': b'1.8.3.0', 'firmware_build_time': b'Wed Mar 18 21:57:34 2015'} 
Traceback (most recent call last): 
  File "test_flycapture2.py", line 46, in <module>  
 test() 
   File "test_flycapture2.py", line 29, in test
     c.set_video_mode_and_frame_rate(fc2.VIDEOMODE_1280x960Y16, fc2.FRAMERATE_7_5)
  File "src/flycapture2.pyx", line 184, in flycapture2.Context.set_video_mode_and_frame_rate
  File "src/flycapture2.pyx", line 65, in flycapture2.raise_error 
  flycapture2.ApiError: (7, b'Parameter passed to function is invalid.')
ZrrrKIT commented 4 years ago

Following the related issue originally posted by @jordens in https://github.com/jordens/pyflycapture2/issues/8#issuecomment-128210712_(url) I deleted the line c.set_video_mode_and_frame_rate(fc2.VIDEOMODE_1280x960Y16, fc2.FRAMERATE_7_5) and my code progressed to the line print [np.array(c.retrieve_buffer(im)).sum() for i in range(80)] but it just gets stuck on this line forever. Does deleting the above line break the flow of the code?

The output is as follows:


{'major': 2, 'minor': 11, 'type': 3, 'build': 121} 
1
{'serial_number': 16320732, 'model_name': b'Blackfly BFLY-U3-23S6C', 'vendor_name': b'Point Grey Research', 'sensor_info': b'Sony IMX249 (1/1.2" Color CMOS)', 'sensor_resolution': b'1920x1200', 'driver_name': b'None', 'interface': 'USB3', 'firmware_version': b'1.8.3.0', 'firmware_build_time': b'Wed Mar 18 21:57:34 2015'}
23 8 
{'type': 16, 'present': True, 'auto_supported': True, 'manual_supported': True, 'on_off_supported': True, 'one_push_supported': False, 'abs_val_supported': True, 'read_out_supported': True, 'min': 479, 'max': 3687, 'abs_min': 1.0, 'abs_max': 41.534141540527344, 'units': b'Frames Per Second', 'unit_abbr': b'fps'} 
{'type': 16, 'present': True, 'auto_manual_mode': False, 'abs_control': False, 'on_off': False, 'one_push': False, 'abs_value': 9.978496551513672, 'value_a': 0, 'value_b': 0}                                                               
Executing c.start_capture()...     
Executing im = fc2.Image()... 
Executing c.retrieve_buffer(im).sum...
ZrrrKIT commented 4 years ago

It seems the issue was not in the Python script itself, as the same line of code hangs when you try to run it via the C++ SDK. The issue was resolved when I disabled hardware triggers for the camera. Then the buffers were accessible and the program runs smoothly.