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: 

Rotating picture control.

Hey all,
 
ok i've made some good progress with the rotating of the picture, but now i've got some obstacles to over, they are:
 
1.Getting the picture go along the route coloured in red.
2.When the map moves up and down, the picture control shrinks the map
3. Making the map's background transparent.
 
 
Cheers all.
 
_____________________________________________________________________________________________
Dude LabView rocks.
0 Kudos
Message 1 of 4
(2,506 Views)
We don't have the image file, so please change your VI so it contains the 24bit pixmap as a diagram constant.
 
You should also familiarize yourself better with LabVIEW.
  1. in the "move" loops, you read form a local variable of the picture, put in in a shift register for no reason, read it's value from a property node and write it back to a local variable. This makes no sense, because the value never changes! Remove the locals, the shift register, and the value property read. You only need ot touch the origin.
  2. When you rotate, you rotate 90 degrees with 1 degrees increment without any delay. You might as well rotate by 90 degrees once.
  3. Most of your while loops should be replaced by FOR loops because the total number of iteration is known from the beginning.
  4. Why do you read the same file path with a local variable. The original terminals is right there, so use a wire.
  5. It would be better to do all with the outer loop and get rid of all the inner loops. Use a state machine. Use shift registers for the current position and rotation angle and increment/decrement them according to the current state.
  6. Why do you read the jpeg from the same path and unflatten it multiple times. This needs to be done only once outside the main loop.
  7. Many of your sequence frames contain near identical code. They can be combined in one state. You only need a do nothing state, move state and a rotate state, nothing more.
  8. You seem to have a problem with the coloring tool (look at e.g. the rotate_pixmap front panel).
  9. ...
0 Kudos
Message 2 of 4
(2,491 Views)
ok, first and foremost what do you mean by the image file? are you talking about the picture itself. and i understand the points 6, 7 and 8, but i don't quite understand the points 1,2,3,4 and 5.
_____________________________________________________________________________________________
Dude LabView rocks.
0 Kudos
Message 3 of 4
(2,488 Views)
You read an image file that we don't have. Run your VI until the "24-bit pixmap" array contains data. Stop the VI and right-click on the terminal of the it and "change to constant". save the VI and reattach here. Now we have the data permanently and can work with it. we no longer need to read from the file.


@Hombre wrote:
... but i don't quite understand the points 1,2,3,4 and 5.


  1. The image indocator contains it's own data (the "value"). It does not make any sense to read it over and over again using a value property, never change it, then write it back to a local variable of itself. That is just blowing hot air. You don't need to read it unless you need to do someting with it and you don't need to rewrite it unless the value has changed! 🙂  Changing the origin does NOT change the picture data. (see image below).
  2. You rotate 90 times by one degree, but there is no small wait in the loop, thus it will happen almost instantaneously. If you would simply rotate by 90 degrees once, you would save the expensive computation of 90 rotations.
  3. A while loop is for cases where the total number of iterations depend on a condition calculated inside the loop. In your case, the total number of iterations is known before the loop starts. Replace the FOR loop with a WHILE loop and wire the desired number of iterations to the upper left terminal of a FOR loop. Now you don't need to test anything inside the loop. 
  4. The terminal for "path 5" is right there on the left. So delete all the local variables of it and use a wire from the terminal.
  5. This is a more complex theme. Search the forum for e.g. "state machine" for some pointers.

Message Edited by altenbach on 04-29-2007 01:54 PM

0 Kudos
Message 4 of 4
(2,479 Views)