mabl / PyPylon

An experimental python wrapper around the Basler Pylon 5 library
BSD 3-Clause "New" or "Revised" License
53 stars 34 forks source link

grap_images ValueError: total size of new array must be unchanged #5

Closed maxlklaxl closed 8 years ago

maxlklaxl commented 8 years ago
>>> for i,im in enumerate(cam.grap_images(1000)):
        print i
0
1
.
.
.
n
Traceback (most recent call last):
  File "/home/strawlab/pycharm-4.5.4/helpers/pydev/pydev_run_in_console.py", line 69, in <module>
    globals = run_file(file, None, None)
  File "/home/strawlab/pycharm-4.5.4/helpers/pydev/pydev_run_in_console.py", line 29, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/strawlab/code/PyPylon/test/test.py", line 27, in <module>
    for i, im in enumerate(cam.grap_images(1000)):
  File "PyPylon/cython/factory.pyx", line 228, in grap_images (cython/factory.cpp:4587)
ValueError: total size of new array must be unchanged

with n >= 0, but most of the time between 500 and 700

mabl commented 8 years ago

Interesting. There might be some padding bits inside. I'll push some asserts for these. Let's see if that is the issue. What is the Pixel format here? Mono8?

maxlklaxl commented 8 years ago

it's Mono8

mabl commented 8 years ago

I cannot reproduce this with my acA2040-90um. There are now some debug outputs in case of suspected errors. Could you give it a try?

maxlklaxl commented 8 years ago

did not show with the new version

mabl commented 8 years ago

See issue #6. We might look into returning None frames or something like that instead of raising an exception in the iterator. For now, raising an exception is good enough I guess.