Closed danigamba closed 2 years ago
Hi @danigamba
I didn't quite understand your question, but I'll try to help you (I'm sorry if it's not the correct answer). For image acquisition I use two ways:
For just one image:
acq.start_acquisition()
buffer = acq.fetch_buffer()
acq.stop_acquisition()
To run for a long period:
I add a callback to NEW_BUFFER_AVAILABLE
and use the acq.start_acquisition (run_in_background = True)
With that, I have the image acquisition happening in another thread without block my main thread.
@mahwhat Hi Matheus, thank you for the help. Those are the right approaches to resolve the issue.
This is completely a side note, we can rewrite the above code as follows:
acq.start()
with acq.fetch() as buffer:
# work with the buffer
acq.stop()
Or,
acq.start(run_as_thread=True)
(I've learned that I was too verbose. ;-))
@danigamba I'm closing this but please feel free to create another one or reopen if you faced an issue. Thanks, Kazunari.
Hello, I'm curious to know if there is a best practice for stopping a camera that is waiting the trigger. In the main thread we launch a second one that stops on
waiting for the camera aquiring a triggered frame of the next object. How could we stop this thread if the main tread needs to be stopped? Thank you