LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display every other images in image indicator

Solved!
Go to solution

Hi All,

I am using IMAQ to grab and save high freq and high resolution images. I have an image indicator directly from "Image Grab Acquire". So, the image indicator is displaying every single images at a very high frequency too. We have to display frames, but not necessarily every single one (enough so the operator can see what's going on). So, I am wondering how I can display, say every other images (such as all odd/even number of images), or jump over two and display the third?

Any help will be appreciated!

Thanks!

Wenlong

0 Kudos
Message 1 of 6
(4,387 Views)

Seeing your code to "grab and save high freq and high resolution images directly from Image Grab Acquire" would certainly help us give answers appropriate to your question.  If  you are saving every image (to disk), you need to move it from the camera to the "write" function.  One way to lower the display rate would be to display every third, fifth, tenth (you get the point) image -- I do this all the time.  That's what to do, but to help you with how to do it, we need to know what you are currently doing.  Attach your code. 

 

Bob Schor

0 Kudos
Message 2 of 6
(4,357 Views)

Hi Bob,

Thanks for your response! I have attached the code I am using here.It is directly from the examples. Please kindly advise me how to display every third, fifth, tenth image.

Thanks again!

Wenlong

0 Kudos
Message 3 of 6
(4,342 Views)
Solution
Accepted by topic author novartis

Here are some general comments.

  • Image acquisition is "a horse of a different color" -- unlike many other I/O devices, the memory that holds the data (here called the "buffer") is managed by the driver, and isn't directly available to LabVIEW.
  • I'm guessing that you are using NI Video hardware, as you are using IMAQ functions (I've only used IMAQdx).  Is this true?  What camera are you using?
  • The IMAQ Extract Buffer (probably) "clocks" itself to the camera (I say "probably" because I don't know the hardware you are using).  This means that the While loop containing it will run at the frame rate of the camera (hence you can easily calculate the frame rate, as your code shows).

This looks like an NI Demo routine, so I'm guessing that you don't have a lot of experience with Vision processing.  If you've got a lot of other LabVIEW experience, you should be able to make the leap to vision, once you get the idea of how buffers work.  Unfortunately, there's not as much in the way of tutorials and white papers on Vision as on other LabVIEW topics.

 

So to your question -- how to display every Nth image.  Here's the key loop (which is lifted directly from your code):

Display Buffer.png

As menioned above, this routine is "clocked" by the Extract Buffer function.  What you do to display every N'th image is to put the Image control inside something like a Case statement that "fires" every Nth time.  

Here's an "Nth" version of the above loop (some details omitted) --

Nth Image.png

We still drive the loop filling every buffer with a frame.  But we then use the Integer Divide function to select the Nth image (those that have a remainder of 0 when i is divided by Nth) and wire the "image" line (it doesn't really hold an image) to the "Image" control, with the other case being "Default" (so all other valeus go there) and with nothing inside.  Thus every Nth time through this loop, the output of Extract Buffer is wire to an Image (and displayed), the other N-1 times the wire goes nowhere.

 

Bob Schor

0 Kudos
Message 4 of 6
(4,323 Views)

Hi Bob,

Thank you so much! This is exactly what I need.

Per your questions, I am using Basler Aca 2040-180km cameras.

You are right. I don't have much image processing experience using LabVIEW. So, I don't quite understand what that means when you said the "clock" thing.

If you can explain more on that, I will appreciate it.

Best,

Wenlong

0 Kudos
Message 5 of 6
(4,313 Views)

When you call Extract Buffer and give the "next" buffer number, the frame grabber "waits" until it has a full frame and then executes.  LabVIEW works by a principle called Data Flow -- something like a While loop will run "as fast as it can", with the proviso that nothing can proceed until all of its inputs are present, and no output is asserted (on a function) until the function finishes.  So because Extract Buffer is inside the While loop, the loop cannot "loop" until Extract Buffer "does its thing" once.  If your camera is running at 180fps, this means that the loop runs every 6 milliseconds (approximately).  Note that while Extract Buffer is "waiting" for the frame to be acquired (which may take 5 of the 6 milliseconds), your PC (and LabVIEW code) is free to be doing other things, as long as they are not inside the same While loop.  That is, other loops placed "in parallel" with this While loop and not linked "serially" with it (say by having the Error line out of the first loop be an input to the second loop) will be able to make use of this "free time" to execute code in parallel.  Indeed, if you have a multi-core PC, LabVIEW will try to utilize different cores so that parallel loops execute on separate cores, truly in parallel.

 

BS

0 Kudos
Message 6 of 6
(4,285 Views)