Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Calibrating a Live Image

I am using a hi-resolution (1392x1040) color camera with 6mm Machine Vision Lens to look at an area of 6ft x 6ft size.  I am acquiring images at 15fps. In order to compensate for image distortion due to lens I am performing image calibration using VIs from Calibration Pallet. I printed a 6ft by 6ft grid of 1 inch circles 4.5 inches apart in X and Y direction. The calibration results look pretty good for most part. But when I try to calibrate as I am acquiring images from camera my effective frame rate is reduced to less than 3 fps. When I profiled my program “IMAQ Correct Calibrated Image” was taking 335 msec to execute. When I changed the interpolation type from Bilinear to Zero Order the frame rate doubled but understandably the corrected image was not very smooth. I ran another experiment where I reduced the density of calibration grid. Now the new grid has one inch dots at 13.5 inches apart. I ran the VI again after necessary modification but there is no appreciable increase in the frame rate.

 

I have used the IMAQ calibration VIs successfully in static application like cutting etc. (Image is acquired once than calibrated and the dimensional information is transferred to the next process. No new image is acquired until a next trigger is sent which was approximately every 2 minutes) This is the first time I am using it to calibrate a live image so that operator can adjust the unit under inspection in real time after measuring the adjustment requirements by simply clicking on the screen and extracting that info. But with such a slower frame rate it may not be very practical for him/her to do so. I am looking into other hardware solutions. (e.g. low distortion lenses etc.)Meantime is any one out there has used calibration VIs in an application similar to mine and has any suggestion that will help me.

 

I am using WinXP – Professional on Dual Pentium 2.8 GHz PC with 1GB RAM.

 

Thanks in advance.

0 Kudos
Message 1 of 9
(5,826 Views)
Correcting the calibrated image is necessarily always going to be a computationally intensive process, since every pixel in the image must be redrawn. Reducing the density of your calibration points will not change this. There are ways, however, of getting accurate Real-World measurements from an uncorrected image, for example by using the Real-World measurements on "IMAQ Particle Analysis", or by using "IMAQ Convert Pixel to Real World".

I hope that helps. If not, a sample of your code may be helpful to come up with another solution.

Kevin C.
National Instruments
NI Vision
0 Kudos
Message 2 of 9
(5,810 Views)
can you give  your  programme on  forums ?
 
i will try to discuss with you ?
0 Kudos
Message 3 of 9
(5,794 Views)
The example program "Perspective Calibration Example.llb" located at "C:\Program Files\National Instruments\LabVIEW 7.0\examples\Vision\2. Functions\Calibration" (may vary based on your version of LabVIEW) is a good example of using calibration without correcting the image.

Hope that helps,
Kevin C.
National Instruments
NI Vision
0 Kudos
Message 4 of 9
(5,778 Views)
Here is the code I am using. Please look at it and sugest me if it can be improved further.
 
Kevin, I also tried what you suggested in the previous post. I calibrated the image but didn't correct and display it. Since I am drawing an overlay line for operator to use it as a reference for alignment I decided to correct the overlay line to impart the distortion it will haveif it were a straight edge on the FOV of the camera. I beleive I can succesfully calculate the distortion based on it's position on the screen. This method will be much faster since only hundred or less pixels are calculated for their real word positions. (However the overlay lines will have some curvature to it)
 
Unfortunately the customer is not buying this proposal yet. So I am still out looking for a solution to my real time image calibration issue. I am trying to attach two images of the calibration grid seen by right and left cameras each. When you down load the code you will have to correct the path for these files.
 
I am also wondering if developing this part of the code in LW/CVI will make it run faster. Since we are looking for at least 5 fps update from both cameras I would like for the calibration correction part of the code to finish within 150ms. Right now it is 320msec on the PC I mentioned on the orignal post.
 
Thanks
0 Kudos
Message 5 of 9
(5,735 Views)
I can't look at the code because you stripped away the block diagrams.
0 Kudos
Message 6 of 9
(5,725 Views)
Sorry. Here is the new file with Block Diagram included.
0 Kudos
Message 7 of 9
(5,721 Views)
The code you show me is pretty straight forward. The only improvement I would suggest is not to copy the image over to the other image, and rather just display the two images in individual controls.

Your best speed improvements, however, will come from acquiring less data in the first place. I'd suggest using images about half the resolution, and use 8-bit grayscale instead of color.

Kevin C.
National Instruments
NI Vision
0 Kudos
Message 8 of 9
(5,699 Views)
Kevin,
 
Thanks for looking into the code. Customer may accept  to let the images displayed  separately from each camera but I am pretty sure he won't like the idea of displaying the objects in gray scale on the screen.
 
Thanks again
 
0 Kudos
Message 9 of 9
(5,696 Views)