LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Genicam, read images from buffer after stopping acquistion

How does one go about reading images from a genicam buffer after stopping acquisition?  My my camera is generating images faster than I can read them.  I stop the acquisition, but I don't close the session.  However, when I go to read the buffer, I'm told no acquisition is in progress.  That's correct, but there are still images in the buffer.  The code section below works fine during acquisition.

 

Jim12345678_0-1743087511955.png

 

0 Kudos
Message 1 of 6
(134 Views)

The function you are using waits for an image during acquisition, that's why stopping acquisition returns an error.

 

You probably want to configure an image sequence or a ring acquisition.

 

RamonG_1-1743152198186.png  RamonG_0-1743152163437.png

 

0 Kudos
Message 2 of 6
(107 Views)

I am clearly missing something.  My understanding is that the camera (FLIR Blackfly) has a buffer that stores images on the camera and I read them from the buffer to my PC..  If the camera is generating images faster than I can read them down, the buffer fills or loops back on itself.  At some point, I need to stop acquisition so as not to keep filling the camera buffer and download the images from the camera.  In looking at what it takes to create a ring buffer, it appears you create an array of images on the PC?  If that's the case, then somehow the images got from the camera to the PC fast enough to populate the buffer on the PC.  If so, then why do I need a camera buffer?  Assuming I'm missing something, I still need to stop acquisition.  For every configuration I've tried, if I stop acquisition and then try to extract images from the camera I'm told that I cannot do so because there is no acquisition in progress.  I've tried three variants of the code.  Using extract image, the code gags and tells me that it only works with a ring buffer - which is what it was configured with.  All the other methods I've tried work in that I can get images from the camera until I stop execution.  Code sections below.  I'm at a loss.

 

Create the ring buffer.  If the ring buffer is local to my PC, then somehow the images have managed to get from the camera to the PC and I don't need the camera buffer or is this used when I configure the session to tell the camera how to setup the buffer on the camera?

create_buffer.jpg

 

Configure the session.  I've tried any number of variations.

configure.jpg

 

Extracting from the "local" ring buffer if that's what it is with grab works, right up until I stop acquisition.

ring.jpg

 

The extract image crashes and tells me that it only works with ring buffers, but I use configure ring buffer when I start acquisition.....

extract.jpg

 

 

This variant works too, until I stop acquisition.

get.jpg

 

Am I just misunderstanding how the camera works and I cannot do this?

      

0 Kudos
Message 3 of 6
(95 Views)

Back when I was doing Image Acquisition (about a decade ago), we used Ring Buffers to "smooth out" Image Acquisition (and also to allow us to save images that occurred, say, a second before the "trigger" so we could view what was happening before the event we were trying to capture).  I don't believe the cameras we were using had on-board buffers -- we used the buffers that IMAQdx provided as part of the IMAQdx Configure Acquisition function (with the Continuous setting active).  Each time the Camera captured an Image, it put it into the "next" buffer in the ring, and if we want to view the images as they were acquired, we also showed them in a Display Window.

 

When we got a "Trigger" event that said "Time to save Images, starting with one second in the past", we looked at the current buffer, subtracted to get the "first buffer to save", then called the Video routine which opened an AVI file and then started saving "frames" as fast as it could, starting with the "First buffer", continuing until it caught up with the Current Buffer, and (optionally) saving "extra frames" if we decided we wanted "post-event" frames, as well.

 

Sounds like your camera has moved image storage inside itself.  Time to see how GenICam handles in-camera ring buffers.  As long as the buffer numbers only increment (U32?) and you have enough inside the camera, you should be fine.  The key question is how much time does it take for the Camera to fill its internal buffers at the frame rate you are using.  In our case, using 30 fps and 640x480 images (color, I think), we buffered a few seconds (as I recall).  [Did I mention we were running 12 cameras at the same time?  Glad I'm not doing Vision these days ...].

 

Bob Schor

 

P.S. -- I forgot I responded to a similar question recently here .  

0 Kudos
Message 4 of 6
(88 Views)

IMAQdx uses a industry standard protocol (GigE/USB3-vision) to interface with your camera that is probably agnostic of any available hardware ring buffer your camera might have. Configure Ring Acquisition.vi does a software implementation but using system memory.

 

We cannot figure out what you are doing based of the photos made of your screen, you will need share your VI for that (for preferably in LV2015).

 

I made a small test that you can try for yourself. The name "Buffer Number Out" is misleading in the context of a ring buffer because it will outgrown the number of buffers set, "frame number" would have been more logical.

 

RamonG_0-1743351444427.png

 

Example with ring buffer size set to 6:

 

RamonG_1-1743351654389.png

 

0 Kudos
Message 5 of 6
(77 Views)

Thanks for the diagram.  I've tried that.  The problem is that once you stop acquisition, you can no longer read the camera buffer.  I don't close the camera session, I just stop acquisition.  I use high speed cameras that collected images faster than what my PC can download.  I can read the camera buffer, see that I have hundreds of images in the buffer but have only downloaded a fraction on them.  There may be no way to do this in LabVIEW using the VIs that are provided.  I can do it using Python but my Python code uses the SDK specific to the camera.  As you mention, the LabVIEW routines are Genicam agnostic.  They simply may not be written to accommodate this functionality. If I know that it cannot be done, I can stop trying.

0 Kudos
Message 6 of 6
(49 Views)