Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Get distance from an object using a single Webcam and myRIO

Hello. I want to get the distance from an object using a single Webcam and myRIO. I did not found a proper solution for this, I watched some videos and tried to do some VIs, but the closest thing that I have done is to get the distance in pixels from a ROI. I also tried Vision Assistant, but I didn't handle it. I want to detect the distance between the edges from an object (and transform it in cm), but i need the camera to detect automatic the object and not to put by myself the ROI in the image. Can somebody help me please?

0 Kudos
Message 1 of 6
(4,250 Views)
when you talk about the distance in the image processing you have to point that your means is xy axes or XYZ
for xy axes it is easy you have to just first calibrate your image then start to use find pattern or edge or geometry and then find distance of them
0 Kudos
Message 2 of 6
(4,242 Views)

xy are ok. Can you please help me with an example? I tried to calibrate the camera in Vision Assistant but I only succeeded on a picture that is load from computer, and I don't know how to do it in real time using Grab. 

 

 

I did this: https://www.youtube.com/watch?v=2ycFJJcKbMs&feature=youtu.be

0 Kudos
Message 3 of 6
(4,240 Views)
first you have to send a some image from your targets that you want to measure
to find what is their features
second
you just need to take some image with your vision system for calibrate
after calibration you can use it with grab mode there is no need calibrate your system with grab mode and for any time
for one easy calibrate try to measure one known distance object in your image and in same distance with your target to find pixel ratio
0 Kudos
Message 4 of 6
(4,203 Views)

I made an aquisition wich continously snaps an image, I made a grayscale and an edge detection. I want now to extract every single pixel from this image and to verify if it is a 1 or an 0 and to measure a distance (how many 0 pixels are between two pixels of 1). Can somebody help me please? Or is it a simple way to detect the object and verify if is moving close or far?

 

Capture.PNG

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

Hello DC20, 

 

You should be able to extract the pixel values of the image by converting it to an array using the function below.

 

IMAQ ImageToArray VI:
http://zone.ni.com/reference/en-XX/help/370281P-01/imaqvision/imaq_imagetoarray/

 

The pixel manipulation functions in the link below may also be useful. 

 

Pixel Manipulation:

http://zone.ni.com/reference/en-XX/help/370281M-01/imaqvision/pixel_manipulation_pal/

 

Regards, 

j_bou

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