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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to rotate objects or pictures on my FP?

Thanks. 

0 Kudos
Message 21 of 24
(2,467 Views)

Thanks for the examples Altenbach, the good descriptions to everyone who has helped (and the problems to everyone who has provided them). This thread has been a great read.

 

Here is some code that updates Altenbach's awesome RotateBowl2.vi with a fix to a tiny bug that he missed due to the Square nature of the Bowl Image and shows the Bowl method and the Ship load technique VI.

(Just to make it easier for anyone else out there experimenting with this.)

Functions -

1) Zoom on Centre as per Bowl VI

2) Rotate as per Ship and Bowl VIs

3) Load from Constant as Per Bowl VI

4) Load from File as per Ship VI

5) Be awesome as per Altenbach

 

(Posted in LV 2012)

 

 

 

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 22 of 24
(2,175 Views)

I was always impressed with Altenbach's pure G implementation of the image rotate and zoom on the boat.  There is lots to learn when it comes to raw image manipulation, and imaginary number math.  But there are times when you may prefer to use an already developed library to do things like image manipulation, and I always wondered if I could perform the same functions shown here using .Net.  So if you don't mind the platform dependency of Windows this can work.

 

Attached is my attempt to rotate an image, by an arbitrary angle.  Now one thing my version doesn't do yet, is have a zoom control, but I suspect that is possible.  But there are a list of neat features mine does that the native one doesn't.

 

With the attached VI you can rotate many different image types, images with alpha layer are supported, pivot points can be set anywhere, and the image is fit to the control size, which changes on window resize.  No need to do more code to make the image fit, it just works without any extra work.

 

There could be improvements for sure.  One issue is that the original image and the new image is the same size, but on a rotate parts of the image may fall outside the bounds.  I think this can be fixed but I didn't look into it.  Still this was a fun challenge that I hope to find a use for some day.

Message 23 of 24
(2,005 Views)

@Hooovahh wrote:

Attached is my attempt to rotate an image, by an arbitrary angle.


Nice.

 

(Note that the outer FOR loop of my code can be parallelized giving me about 5x speedup on my 16 core machine.)

0 Kudos
Message 24 of 24
(1,993 Views)