From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

find the rotation angle for an 8bit grayscale image

Solved!
Go to solution

Hi all,

I have an 8bit grayscale image of dimension 3969 X 600, the image is slightly tilted. i need to find the rotation angle and apply the rotation before i do the processing.

Is there any transformation functions readily available in LabVIEW to find the rotation angle?

Need your suggestions folks,

 

 

Regards,
KM
0 Kudos
Message 1 of 5
(4,676 Views)

Hello,

 

slightly tilted is a strange phrase - it doesn't tell anything about your rotation.

 

Do you have any characteristic points (two points at least) on your image that can be used as a reference to calculate the degree of image rotation? If you can find such fiducials, you can base your image rotation on this.

 

You have IMAQ Rotate readily available in the Image Manipulation pallete.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 2 of 5
(4,661 Views)

Hi Klemen,

Thanks for your time,

I am not sure which points i need to use as reference to calculate the degree of rotation, is there any functions available to calculate the rotation, I have attached the 2d array of image. I need a little more help.

 

Can i use the vi (rotate 8bit) which can be found in the following link below?

 http://www.ni.com/example/26943/en/

 

Regards,
KM
0 Kudos
Message 3 of 5
(4,655 Views)

Hi Klemen,

The reference points are (0,250) (3968,359). Is there any generic formula to calculate the degree using the co-ordinates.

 

Regards,
KM
0 Kudos
Message 4 of 5
(4,642 Views)
Solution
Accepted by topic author KevinKM

Hello,

 

just calculate the slope of the line, connecting both points:

 

xDiff = p2.x - p1.x

yDiff = p2.y - p1.y

 

angle [deg] = atan2(yDiff,xDiff) *(180/pi)

 

Example_VI_BD.png

 

Best regards,

K

 


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 5 of 5
(4,621 Views)