LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to rotate objects or pictures on my FP?

I would like to rotate an image of a boat to illustrate the pitch. altenbach made a VI very close to what i want, but I have a hard time making it eat a jpeg image instead of a generated one.

 

 

Supplyboat-side.JPG

 

 

I have tried to make a knob control to do this, but I guess there is a problem with my emf converter.

 

I would like to avoid generating 64 images to show +-16deg pitch with a 0.5 resolution.....

 

Thanks!

 

Kind regards 

Pål Jacob

0 Kudos
Message 11 of 24
(4,153 Views)

Can you show us your code?

 

You would just read the jpeg using "read jpeg file", then use unflatten pixmap to make the 2D array. 

 

 

0 Kudos
Message 12 of 24
(4,148 Views)

Looks like you need to correctly apply the 8bit colormap.

 

Here's a quick example:

 

 

 

Most likely you want to pad the image so it does not get clipped when rotated. Modify as needed.
Unzip the attached example and image into the same folder, then run the VI (LabVIEW 8.5). 
Message Edited by altenbach on 04-18-2010 11:47 AM
Message Edited by Support on 04-19-2010 09:51 AM
Message 13 of 24
(4,143 Views)

I just noticed that the original old code has a gigantic memory leak. The image should not be in a shift regsiter!

 

Here's a corrected version!

 

 

Message 14 of 24
(4,128 Views)

Superb solution altenbach!! This is exactly what I was looking for!

 

Thanks! Smiley Very Happy

0 Kudos
Message 15 of 24
(4,103 Views)

Excellent!! This vi will save me a lot of time.

 

Thank you so much~

 

Adam

0 Kudos
Message 16 of 24
(4,037 Views)

Hi Altenbach,

 

With reference to your attached rotateship vi. The background is black, how do i change it to white? or transparent? because i tried it with a picture of mine which is white, rotating it shows the other uncovered areas as black.

 

Also,  is it possible to make the image permanent in the code without needing to read the file?

0 Kudos
Message 17 of 24
(4,001 Views)

 


@BPBP wrote:

With reference to your attached rotateship vi. The background is black, how do i change it to white?


 

Initialize a 2D array of white, keep it in shift registers for the two inner FOR loops, and use "replace array subset" in the inner loop to fill the rest with the rotated image.

 

 


@BPBP wrote:

Also,  is it possible to make the image permanent in the code without needing to read the file?


  • Yes, create an indicator on the "Image data" wire (right-click wire, create indicator),
  • run the VI once
  • make the indicator a diagram constant (right-click the indicator...change to constant)
  • Delete the file IO stuff.
 

 

0 Kudos
Message 18 of 24
(3,990 Views)

Actually, here's a better method. Since we have a colormap, we need to pick one of the colors from the palette. Easiest is to e.g. grab the color of the pixel at (0,0) as background color if we index out of range.

 

Modify as needed.

0 Kudos
Message 19 of 24
(3,973 Views)

Quick modification to resize image container to the actual image size and also allow zoom. (LabVIEW 8.0)

 

Message 20 of 24
(3,959 Views)