Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Correct image skew

Solved!
Go to solution

What tools are offered in NI Vision to correct image skew?  Example image attached and it should be square.

 

Thanks in advance!

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 1 of 6
(3,885 Views)
Solution
Accepted by topic author mfitzsimons

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.

------------------------------
Bill E. | Applications Engineer | National Instruments
Message 2 of 6
(3,854 Views)

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!

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 3 of 6
(3,851 Views)

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.

------------------------------
Bill E. | Applications Engineer | National Instruments
0 Kudos
Message 4 of 6
(3,829 Views)

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!

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 5 of 6
(3,827 Views)

Here is the link to the Community Example, as it is live now, for future reference.

------------------------------
Bill E. | Applications Engineer | National Instruments
0 Kudos
Message 6 of 6
(3,822 Views)