Image Acquisition getdata race condition when camera is active capturing frames

조회 수: 5 (최근 30일)
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
Spencer Chen
Spencer Chen 2020년 1월 3일
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

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by