Open bth5 opened 2 years ago
Hi, thank you for the report.
If the time out is expected by design in your application, I would recommend calling either the fetch method or the try_fech method so that the program does not hang at the fetch call:
ImageAcquirer.fetch(timeout=some_timeout_value)
, orImageAcquirer.try_fetch(timeout=some_timeout_value)
.On the 1st option, you will get the genicam.gentl.TimeoutException
once it's timed out. On the 2nd option, you will get the None
object. Note that calling ImageAcquirer.fetch()
without a time-out value means the function call waits until a buffer is filled up with an image.
Hi,
Thank you for the reply.
I just played around with adding timeout=some_timeout_value
with ia.fetch(timeout=20) as buffer:
component = buffer.payload.components[0]
_1d = component.data
print('1D: {0}'.format(_1d))
_2d = component.data.reshape(
component.height, component.width
)
print('2D: {0}'.format(_2d))
print(
'AVE: {0}, MIN: {1}, MAX: {2}'.format(
np.average(_2d), _2d.min(), _2d.max()
)
)
And i get the error:
---------------------------------------------------------------------------
TimeoutException Traceback (most recent call last)
Input In [17], in <cell line: 1>()
----> 1 with ia.fetch(timeout=20) as buffer:
2 component = buffer.payload.components[0]
3 _1d = component.data
File ~\Documents\Anaconda\envs\Genicam_test\lib\site-packages\harvesters\core.py:2384, in ImageAcquirer.fetch(self, timeout, is_raw, cycle_s)
2382 time.sleep(cycle_s if cycle_s else 0.0001)
2383 else:
-> 2384 raw_buffer = self._fetch(
2385 manager=self._event_new_buffer_managers[0],
2386 timeout_on_client_fetch_call=timeout, throw_except=True)
2387 buffer = self._finalize_fetching_process(raw_buffer, is_raw)
2389 return buffer
File ~\Documents\Anaconda\envs\Genicam_test\lib\site-packages\harvesters\core.py:2261, in ImageAcquirer._fetch(self, manager, timeout_on_client_fetch_call, throw_except)
2257 _logger.debug(
2258 'timeout: elapsed {0} sec.'.format(
2259 timeout_on_client_fetch_call))
2260 if throw_except:
-> 2261 raise TimeoutException
2262 else:
2263 return None
TimeoutException:
So now i can produce the timeout error, but i would like to solve acquiring an image. I know possibly there could be many reasons for a time out, but are there a way that i can debug this?
Thanks!
Hi, thanks for the update.
So now i can produce the timeout error, but i would like to solve acquiring an image.
In the image acquisition process, Harvester is just an observer. It asks a GenTL Producer if it has a buffer that is ready to be exposed but the function call can fail when no image has been delivered to the GenTL Producer.
No matter what the issue was, you will need to debug the signal path that an image comes through. For example, you should be sure that the camera is triggered as expected and any hardware equipment is not blocking to delivery of the data; say, a poor cable can drop the data. You may be able to intentionally reduce the amont of the data size by decreasing the image resolution or decreasing the trgger frequency or the image acquisition frequency on the device side.
Describe the Bug I try to acquire a frame using the example from: https://github.com/genicam/harvesters#harvester-on-ipython, using my own .cti file. This seems to work well until i try to acquire a frame, where i don't get a response. The excecution hangs indefenetely.
To Reproduce Steps to reproduce the behavior:
Sample Code I can show a piece of code that demonstrates the reported phenomenon:
If yes, please provide a sample code:
NOTE: The error is printed when i interrupt the kernel.
Expected Behavior Acquisition of image as in example: https://github.com/genicam/harvesters#harvester-on-ipython
Configuration
Reproducibility
This phenomenon can be stably reproduced:
If applicable, please provide your observation about the reproducibility.
Actions You Have Taken