genicam / harvesters

Image Acquisition Library for GenICam-based Machine Vision System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gentl.NotAvailableException: 'BUFFER_INFO_WIDTH'

omar-ogm opened this issue · comments

Describe the bug
This issue is related to #175
When I test it it seems to work, but now is not working anymore. (Not on any version before and after the issue was resolved). Maybe I test it on another camera since Ive been working recently on different cameras but Im pretty sure it was this camera.
There doesn't seem to be information on the buffer available, the exception that is being thrown is NotAvailableException but on the commit that fixes this problem initially the exception caught is NotImplementedException.

  File "C:\Users\OmarGarridoMartín\Desktop\OMAR\PROJECTS\DB_HSTM_POC\workspace\db_high_speed_track_monitoring_poc_VENV\lib\site-packages\harvesters\core.py", line 834, in __init__
    self._data = self._to_np_array(proxy)
  File "C:\Users\OmarGarridoMartín\Desktop\OMAR\PROJECTS\DB_HSTM_POC\workspace\db_high_speed_track_monitoring_poc_VENV\lib\site-packages\harvesters\core.py", line 842, in _to_np_array
    w = self._buffer.width
  File "C:\Users\OmarGarridoMartín\Desktop\OMAR\PROJECTS\DB_HSTM_POC\workspace\db_high_speed_track_monitoring_poc_VENV\lib\site-packages\genicam\gentl.py", line 4368, in _get_width
    return _gentl.Buffer__get_width(self)
_gentl.NotAvailableException: GenTL exception: Resource or information is not available. (Message from the source: 'BUFFER_INFO_WIDTH' is not available for this buffer(payload type: PAYLOAD_TYPE_CHUNK_DATA)) (ID: -1014)

To Reproduce
Steps to reproduce the behavior:
Connect to a camera and try to fetch a buffer

from harvesters.core import Harvester


h = Harvester()

h.add_file(r'C:\Program Files\MATRIX VISION\mvIMPACT Acquire\bin\x64\mvGenTLProducer.cti')
h.update()

print(h.files)

ia = h.create_image_acquirer(0)

# Example: Change values from the GenICam Camera, This values are in the node_map
# ia.remote_device.node_map.Height.value = 16
# ia.remote_device.node_map.Width.value = 256

ia.start_acquisition()

with ia.fetch_buffer() as buffer:
    # Let's create an alias of the 2D image component:
    component = buffer.payload.components[0]

    # Note that the number of components can be vary. If your
    # target remote device transmits a multi-part information, then
    # you'd get two or more components in the payload. However, now
    # we're working with a remote device that transmits only a 2D image.
    # So we manipulate only index 0 of the list object, components.

    # Let's see the acquired data in 1D:
    _1d = component.data
    print('1D: {0}'.format(_1d))


# Release and exit
ia.stop_acquisition()

Expected behavior
I guess the buffer should be either filled on not used in this case.

Screenshots

Desktop (please complete the following information):

  • Windows 10
  • Python: 3.7
  • Harvester: 1.2.3, 1.2.4 and 1.2.6 tested
  • GenTL Producer: matrix vision recommended from harvesters
  • Camera: TIS DKF 33GP1300

Additional context
The entire buffer seem to not have the information available

@omar-ogm Hi. Thank you for the report. Could you try out the latest master branch when you can, please? /Kazunari

Hi with this I get a buffer with information with it, so we could say that this specific issue is closed. I'm getting the image as BayerRG8 format, one question out of topic, Can I do demosaicing with harvesters?

Thank you for the quick response

@omar-ogm Thank you for the reply. Concerning your additional question, I think OpenCV can help you just taking an image data array from Harvester.