Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Calibrated info from MeasureMaximumDistance function in VB

I am attempting to apply a simple calibration to my image and then measure a distance on the image using the CWMachineVision.MeasureMaximumDistance method in VB. The distance that this method returns seems to be in pixel values instead of the real world distance (mm in this instance). Is this method capable of returning the distance in real world values. If so, how is this functionality set up. If not, how do I go about converting this distance from pixel values to real world values
0 Kudos
Message 1 of 7
(4,052 Views)
A Wooten -

Unfortunately, there does not seem to be a builtin way to get CWMachineVision.MeasureMaximumDistance to compute the calibrated distance. One way to do this would be to use CWIMAQVision.CorrectCalibratedImage to correct the part of the image that you're interested in, and then use CWMachineVision.MeasureMaximumDistance on the corrected image.

The problem with trying to convert the outputs of CWMachineVision.MeasureMaximumDistance from pixel units to real world values is that the image calibration could wildly distort the image, thus making the search lines that CWIMAQVision.Rake used not straight or evenly-spaced on the calibrated image. So probably the easiest way to do it would be to correct the image beforehand as described above.

Hope this helps!

Greg Stoll
IMAQ R & D
National Instruments
Greg Stoll
LabVIEW R&D
Message 2 of 7
(4,043 Views)
Greg,

Thanks for your suggestion. I am actually already using the CWIMAQVision.CorrectCalibratedImage method. Fist I set my calibration info using the IMAQVision.SetSimpleCalibration method (with all of the proper options set I believe). Next I use the CWIMAQVision.CorrectCalibratedImage on the entire image. Finally I use the CWMachineVision.MeasureMaximumDistance method to retrieve the distance of the feature I am measuring. The distance I receive from the CWMachineVision.MeasureMaximumDistance method is always in pixel values. I've tried changing the xstep, ystep, and unit properties of the GridDescriptor but I always receive the same result. Any ideas why I would see this behavior? Am I performing the calibration correctly?

I have attached a sample of my calibration steps

Thanks
0 Kudos
Message 3 of 7
(4,034 Views)
Hello.

Before you run your distance method, you should run the CWIMAQVision.ConvertPixeltoRealWorldCoordinates method to convert the image. Once this method is applied, then the MeasureMaximumDistance function should return the correct values.

Regards,
Colin C.
Applications Engineering
Colin Christofferson
Community Web Marketing
Blog
0 Kudos
Message 4 of 7
(4,016 Views)

Wooten

 

Did you ever get this to work?  I am having same problem.

 

 

0 Kudos
Message 5 of 7
(3,350 Views)

Wooten

 

Did you ever get this to work?   I am having same problem

0 Kudos
Message 6 of 7
(3,348 Views)
I just can say one thing: Shame on you NI! Vision Assistan generates full code for LabVIEW with all this steps (including IMAQ Convert Pixel to real world) but not for .NET.!!! Until i find out this I spent my all day. Vision .NET is stepchild of NI. This rudeness of NI is irresponsibility and fraud.
0 Kudos
Message 7 of 7
(3,332 Views)