09-04-2012 08:24 PM
What tools are offered in NI Vision to correct image skew? Example image attached and it should be square.
Thanks in advance!
Solved! Go to Solution.
09-05-2012 01:58 PM
Hi Matthew,
There are a couple of different options that can correct image skew. If we are capturing an image from a camera, then the best way would to correct for skew (and other distortions) would be to first calibrate the image using a grid and then correct the image (Image Calibration and Image Correction steps in Vision Assistant or the calibration palette in the VDM; see this link).
If we just want to de-skew an image without using the calibration steps, then it requires a bit of coding. I have attached an example that one of my colleagues is working on for a Community Example (it just has not been posted yet). Hopefully it will prove useful.
09-05-2012 02:27 PM
Took a few tries but got it to work. Can you give me some background on the formula used to transform the image? I was really surprised that no one has posted a question on this. Seems it would be a common issue.
Works well and many thanks!
09-06-2012 10:56 AM
I do not think it is a “named” algorithm, but what it is doing is using similar triangles to skew the image row-by-row. It gets the skew (user input) and the image height to generate a new array. The original image is then shifted based on a right triangle using the skew and the image height. Note: there may be more efficient ways of accomplishing this.
09-06-2012 11:00 AM
It works just fine so it is a keeper. I put a timer on it and it is less than 1 millisecond to process. If the imge was substantiall larger then I may have to look for alternatie methods.
Thanks!
09-06-2012 02:39 PM
Here is the link to the Community Example, as it is live now, for future reference.