LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A few questions about vision

Hello community,

 

I'm just a beginner in LabView and want to ask you a few questions. I'm not sure if I'm writing on the right board. Sorry if I'm wrong or my questions came up recently. I'm not an native english speaker, but I hope you would understand me 🙂

 

I'm working on a little program tracking a laser spot with webcam using LabView 2010 with Vision Assistant. What I've done by now is not very complicated and shouldn't be - just to familiarise with LabView. Generally I have problem with image I get in the end. My program acquire video from camera and convert it to binary type and use "Find Circles" function from Vision Assistant.

 

First of all, I want my application to execute all functions in background and show results (point out the red dot) on original, colour image. I don't know why, but I can't do it myself. Every time I get binary image or none at all.

 

Moreover, regarding to laser spot, I would like to mark it on the image with some kind of circle or cross to easily find it on the screen, but I don't know how.

 

And the last question, finally, how could I set video mode of my camera in program code. I've found an example where I can change it, but I would prefer to set it permanently in the code .

 

I'm slowly running out of time so I hope you could help me a little with a tip or something.

I'm attaching my application.

 

Thank you in advance for every answer.

Martin

0 Kudos
Message 1 of 7
(4,157 Views)

At each step of the process, you will need to save an image buffer, if you are using Vision Assistant to generate your code.

 

Start with a color image in which you laser dot is visible.  Save to Buffer 1.

 

Extract Red Channel.  Save to buffer 2.

 

Set threshold so the only the laser dot is visible, if possible. Save to buffer 3.

 

Use particle analysis to find the center of gravity of the laser spot.

 

Load Image buffer 1.

 

This is as far as you can get using the Vision assistant.  Export the script to LabVIEW code, and then take the output image, and coordinates, and draw an overlay on the color image.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
0 Kudos
Message 2 of 7
(4,128 Views)

Hello,

 

The reason you are getting  binary image out is because you are setting the palette type to be binary in your code. 

 

If you want the results to be shown on the original image, you probably will want to create an overlay with the results of your calculations giving information to where the overlay should go. Check out the overlay VI palette in the vision module and you will be able to get a feel for it. Basically you are creating different objects with different colors that will be layed over on top of whatever image you feed it. Remember to use the Clear Overlay function each time you want to put a new overlay on or else you will just keep adding multiple overlays to the image. This not only doesn't create the desired effect but will lead to a memory leak.

 

When you are working with IMAQ images, remember that every IMAQ create you use creates a SINGLE buffer. When you feed that image into a function and the function modifies the image somehow, you will be modifying your original image, not creating a copy for the output. So when you want to add an overlay to your original image, you should create two buffers. One buffer to store the original image to later add the overlay to, and another to work your calculations on.

0 Kudos
Message 3 of 7
(4,125 Views)

Here's a handy little code snippet that might make understanding these concepts easier:

Find and Overlay circle.png

This examle code will:

 

  1. Open two image buffers.
  2. Load a file into the first, this will be the original.
  3. Copy the file contents to the second to have a copy to work on.
  4. Create a binary image by tresholding.
  5. Find circles in the preprocessed image.
  6. Extract the information of a certain circle.
  7. Convert the information to create a bounding rectangle for an ovelay.
  8. Draw an oval overlay, and display it with the original image.

Hope this will be of some help.

 

Andrew Valko

NI Hungary

 

Andrew Valko
National Instruments Hungary
0 Kudos
Message 4 of 7
(4,100 Views)

Thank you all very much for answers. Now it works properly 🙂

 

Now I have another little question to improve it. I would like my programme to draw the path of laser. How could I achieve it? I think it rather should do it at the end - stop tracking, draw the path.

 

Thank you in advance. That should be all in my project.

0 Kudos
Message 5 of 7
(4,080 Views)

Update:

 

I've made some code that save laser position into an array and tried to draw it using Overlay Points function, but as it could be predicted, it draw points, not a continous line, as I want.

0 Kudos
Message 6 of 7
(4,054 Views)

In that case, you will want to use IMAQ Overlay Multiple Lines 2.vi. Just supply the array of endpoints as line endpoints.

Overlay.png

 

Cheers:

 

Andrew Valko

NIH

Andrew Valko
National Instruments Hungary
0 Kudos
Message 7 of 7
(4,045 Views)