Duplicated frames when grabbing Mono8

Hi all,

When grabbing frames from a grabber with its pixel format set to Mono8 I always receive the same frame 3 times in a row from G2Wait. At the same time 2 out of 3 frames seem to be skipped, so my actual framerate appears to be the defined framerate / 3. Perhaps to make it more clear: instead of getting a frame sequence such as 1 2 3 4 5 6 7,
I’m getting 1 1 1 4 4 4 7 7…

Is this a known bug or did I miss a setting?
My grab loop looks like this:

  if (Driver.IGrab2.G2Wait(img) < 0)

   //[Copy + ] Encode image...

I’ve tested this with CVB v13.0.6.

Thanks in advance,

Hi @Tomes,

which grabber and camera are you using? How do you test for the buffer being the same frame? From your log it seems you are using a ring buffer with a size of 3. Did you switch the lock mode?

Hi @parsd,

I didn’t configure the usage of a ring buffer, but it seems like one is used internally. I wrongly assumed that if I had linear access to the image I only needed to call GetLinearAccess once and could keep using the returned IntPtr pBaseAddress. Now I call GetLinearAccess in the while-loop to update this pointer, which fixed my problem.

Most of our drivers including the GenICam.vin use a Ringbuffer in the background with a minimum size of 3.
To be sure to get a correct pointer from this buffer it is correct to call GetLinearAccess before accessing a new image.

BTW: a rule of thumb is to use at least a buffer size of the number of frames per second you are acquiring. This ensures that you are buffering a minimum of 1 second if your processing takes longer than usual for a short period of time. And you are not loosing any frames.