09-10-2013 04:47 AM
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
09-10-2013 11:48 AM
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.
09-10-2013 11:53 AM
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.
09-11-2013 04:09 AM
Here's a handy little code snippet that might make understanding these concepts easier:
This examle code will:
Hope this will be of some help.
Andrew Valko
NI Hungary
09-11-2013 01:19 PM
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.
09-12-2013 04:59 AM
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.
09-12-2013 05:38 AM
In that case, you will want to use IMAQ Overlay Multiple Lines 2.vi. Just supply the array of endpoints as line endpoints.
Cheers:
Andrew Valko
NIH