LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image rotation: Move center of rotation to point of origin

Hi there,


I want to achieve my first image rotation with an algorithm I found on the www. The algorithm is based on 3 shears, one in x, one in y and once again x direction. The VIs basically do what they should do, with one exception: The image is not rotated about it's center, but the 2D array origin. Since last week, I'm restless thinking about this, but I don't find a solution. Maybe because I'm quite a starter with programming. 😉

So, I adapted the Matlab code, I found on this page but also looked into the cited paper of Alan Paeth:
https://www.ocf.berkeley.edu/~fricke/projects/israel/paeth/rotation_by_shearing.html

In my opinion, it should work, when I'm able to move the center of the image to the point of origin. I thought about one possibility, and tried out only the start, because there must be a simpler way to do this.
Nonetheless: I can (and have a VI for this) rotate an amount of coordinates, I store in a 2D Array around a specific point/coordinate through subtracting this from each other. I can do this too for each coordinate of each Array element for an image, but this is somehow unpleasant, because I have to rearrange every channel to a 1D Array and implement a 2D shear into a 1D Array ...

So: Can you maybe suggest me another approach in moving the rotation center to the origin?
(not sure if my VIs help you, but if you start the rotateByShear.vi, load the rectangule_24bit.png and enter some different positive angles, you will for sure see, what I mean)

 

Thanks a lot!

 

edit: I can't upload zip files? Is this correct?

0 Kudos
Message 1 of 3
(2,810 Views)

Yes you can attach a zip file and it is preferred over multiple loose files.

 

Do a forum search. I posted an old example to rotate an image using bilinear interpolation.

(Sorry, posting by phone. Cannot look at your vis)

0 Kudos
Message 2 of 3
(2,783 Views)

Thanks! I found it here:

https://forums.ni.com/t5/BreakPoint/LV-Picture-Control/m-p/230351#M748

 

I looked into your VI and it was quite helpful, but on the same time, it was not (yet). 😉 You generated a 2D Array of complex numbers to represent the blank coordinates in addition to the image Array. After that, you manipulated the phase by some degree and created a new Image, where each new Pixel was the old Pixel, grabbed by the rotated coordinates. This is a simpler and better version of my second approach, I didn't want to work on yet, because of the extra work. Didn't know, it could be done this simple. Smiley Frustrated

 

I have to think about a bit more about your solution. Maybe I can do the trick with writing the new pixels on some other location.

0 Kudos
Message 3 of 3
(2,759 Views)