From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Live CCD Video Feed with ROI Overlay... How to?

Hey everybody,
 
So here comes the first post in (i'm sure) a long line of questions I will be having for my current project.
 
Has anyone ever tried to overlay ROI information on top of a video feed from a CCD camera using IMAQ Vision package?
 
I am going to be using a USB CCD Camera with labview drivers, I have the IMAQ Vision package.  I would like to display the video feed using IMAQ, which I think will not be too tough, though don't know where to start with getting the ROI information overtop of that.  Specifically, I want to use the ROI to draw multiple lines overtop of the video feed.
 
Also, if I want to have a live CCD feed, will USB 2.0 be fast enough to transfer the image data or should I plan on using firewire?
 
Thanks,
 
Jonathan
 
Also, any comments or words of wisedom concerning anything IMAQ-live video feed would be greatly appreciated.  This will be my first time using live video in IMAQ and I am undertaking a somewhat ambitious first project!  🙂
0 Kudos
Message 1 of 7
(4,040 Views)
Hi IEC,
Having just finished an app that has two ROI overlay layers ontop of a static image, I might be able to give you some ideas. All of the below assumes that you know basic Labview programming.

- I have not used IMAQ yet, and so am not sure what front panel control type will render the live video images. But, I'm not sure that matters.
- If you can place an XY Graph over your video display on the front panel then we have it made
- stretch the size of the XY Graph so that the plot area matches the size and placement of your video image panel
- make the plot area of the XY graph transparent.
- you can also make the border of the XY graph transparent
- if you want a scale for your video then use the scale of the XY Graph to show the scale of your video images
- then it's just a matter of defining the XY points of the ROIs that you want to plot on the XY Graph
- if you want multiple ROIs then each can be a different color by making them different channels to the XY Graph
- if you just want a few straight lines, and want to be able to move the lines around in realtime then you can get a little fancier:
       - turn on the cursor legend for the XY Graph
       - create two cursors for each line that you need (a start point cursor, and an end point cursor)
       - set the color and cursor style as desired
       - in your main loop:
                 - use the XY Graph "crsr list" property to get the XY positions of the various cursors
                 - those cursor XY positions become points of line segments fed to the XY Graph to plot (draws a line between the cursors)
       - In realtime, as you move the cursors, the line segments move accordingly

In my particular app I had to provide a mechanism for the user to create ovals, rectangles, polygons and freehand ROIs. Then I also needed mechanisms to rotate, pan or expand/compress the ROIs. This is a bit more challenging, but very do-able.

Hope that helps,
RMP
Message 2 of 7
(4,036 Views)
Excellent.  Thanks for the idea, now I just need to get the camera so I can start working on it.
0 Kudos
Message 3 of 7
(4,032 Views)

Has anyone attempted this using the IMAQ Vision package?

I ask this, because there are tons of features for ROI including freehand tools, oval, rect, etc. already made up.  The only problem is that everytime you use one, it erases any previous ROI info that was on the image display.   Is there a way to keep several seperate ROIs on screen at the same time... and by several I mean lots... and by lots I mean millions.

 

Also, has anyone come up with a quick VI for picture-in-picture of two live ccd feeds?  I ask because I know it can be done, and relatively easily too, I'm just a little bit lazy and would rather see if someone else has something I could refer to first.

 

THanks!

 

Jonathan

0 Kudos
Message 4 of 7
(3,976 Views)
IEC,
 
Thanks for your post.  To save the ROI of an image so it is not overwritten, you must save the ROI cluster information in the control in LabVIEW.  You can save the data in a variable in LabVIEW, or write it out to a binary file for reference later.
 
Below I attached a program which allows you to load and save ROIs and then rotate the ROIs in the image by a certain degree.  Hopefully this will ge you started!
 
Thanks,
 
Scott Savage
National Instruments
Applications Engineering
Message 5 of 7
(3,964 Views)
Sweet. 
 
Why does anyone use Matlab? I just don't get it.
 
 
jonathan
Message 6 of 7
(3,952 Views)

how do i do this two step, please reply me asap thank you very much as it is urgent.

-use the XY Graph "crsr list" property to get the XY positions of the various cursors

- those cursor XY positions become points of line segments fed to the XY Graph to plot (draws a line between the cursors)

0 Kudos
Message 7 of 7
(3,166 Views)