Image Acquisition getdata race condition when camera is active capturing frames

1 vue (au cours des 30 derniers jours)
Spencer Chen
Spencer Chen le 21 Oct 2016
Commenté : Spencer Chen le 3 Jan 2020
I am working with a PCO Edge 4.2 on Matlab R2016a with Image Acquisition Toolbox on Win7sp1 64-bit. This camera has the functionality to capture a fixed sequence of images in response to an external trigger. I set it up so the camera is in acquisition mode, waiting for an Inf number of triggers, until I manually stop it. I also used the FramesAcquiredFcn callback to read images when a sequence is available.
Now, running things asynchronously means I may be reading images (getdata()) from the previous sequence while the camera is actively capturing images for the next sequence. When this happens, getdata() does not behave appropriately. I want to read in the N images from the previous sequence. getdata() reads in N images as I specified, but the last few images can replaced by the first n images from the currently active sequence. And the FramesAvailable count after getdata() only has N-n images subtracted.
I think because the camera capture runs on a separate thread, there might be a race condition between getdata() and the thread that is reading in the data. Has anyone also encountered this?
I found that this problem turns out to be easy to replicate, simply by delaying image read onset to coincide with the next camera sequence, and getdata() will play up on me.
Blessings, Spencer
  2 commentaires
Seyed Mojtaba Safaei
Seyed Mojtaba Safaei le 23 Déc 2019
Hi, Did you find solution to your problem?
Spencer Chen
Spencer Chen le 3 Jan 2020
I worked around it by enforcing the completion of 1 image sequence before starting the next. I have not revisited this issue with newer versions of Matlab.
Blessings Spencer

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by