LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Constructing an image in real time

I am acquiring data at a 1000 samples/sec rate and would like to display a rectangular image, as the data coming in. is there an easy way to do this? Alternatively I can wait collect the data in an array and then display the image. Can anyone point out an example/s on how to do this? Thanks you.
0 Kudos
Message 1 of 4
(2,708 Views)
Use the AI CONFIG to set up your acquisition.
Use AI CLOCK config to set up your timing.
Use AI TRIGGER CONFIG to set up your trigger.
Use AI CONTROL to start the DAQ (use TOTAL SCANS TO ACQUIRE = 0 for unlimited scanning.

repeat (While loop)
Use AI READ with a NUMBER of SCANS TO READ = 0. This tells you the backlog (how many scans in the buffer)

Use AI READ with NUMBER OF SCANS TO READ = to the backlog number from above. (this empties the buffer)

Process the scans received into your image - append to previous data and re-display.

If you are doing a fixed number of scans, add this backlog number to the total done so far, and see if you're done. If you're doing continuous, skip this step.

Wait 100 mSec if you can, 10 m
Sec if you can't.

Loop (until # scans done >= # scans wanted OR Quit button, whatever).

Use AI CONTROL to stop the DAQ.

The idea is that the DAQ operation happens in the background. You just ask how many are available, and then read that many and use them.

You wait 100 mSec to allow the display update to happen.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 4
(2,708 Views)
Thanks for your answer. My question is more on how to display the data as an image. Lets say the every NUMBER of SCANS TO READ I get from AI READ while I am looping, represents one line in an image. How can I display the image as it is being acquired? How can I save it in a standard jpg, png or bmp formats? Can you point out an example of code that does something similar?
0 Kudos
Message 3 of 4
(2,708 Views)
You don't say what the data represents. Is it 3-channel RGB? Is it intensity?
You can use the intensity graph to show an X vs. Y vs. Intensity image. If you have a monochrome camera, that makes a fine image - just set your min and max colors to be black and white.

If you mean RGB, one way is to scale all three components into U8s (0..255)

Combine them into an array of I32s, then use FLATTEN PIXMAP to convert them into an image to feed to a PICTURE indicator.

You can then get the complete image data from the picture and save as PNG / JPG / BMP.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 4
(2,708 Views)