LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneously rotate and translate an array

Is there any easy way to simultaneously rotate and translate an array (or matrix)? This would be similar to a 4x4 homogeneous transform, but instead of finding the new location of a point, I would like to rotate and shift an entire array based on position and orientation data.

0 Kudos
Message 1 of 6
(3,737 Views)

hi rachbis,

  Could you explain in detail regarding your requirement...

 

 

 

Thanks and regard,

srikrishnaNF

Regards,
Srikrishna


0 Kudos
Message 2 of 6
(3,716 Views)

Do you have a mathematical algorithm which will do the rotation and translation in one step? I think rotation is a matrix multiplication while translation is an addition.  Both are easy to do in LV.  If your arrays are small, this could be quite fast.

 

Lynn

0 Kudos
Message 3 of 6
(3,697 Views)

Hello,

 

  I have a 2D array (or matrix) of values that are recorded when a sensor is at a specific location. The sensor then moves (translation and rotation) and a new 2D array is recorded. I wish to simultaneously translate/rotate the second array (based on how the sensor has moved) so that the second array correctly aligns with aligns with the first  -  so that the same element index in each array represents the same location. I understand that there will be some mismatch along the edges of the two arrays, depending on the size of the translation/rotation. 

   I have tried converting the arrays to an IMAQ image and then using IMAQ Rotate and IMAQ Shift VIs (then converting the images back to arrays). The Rotate VI is helpful in that it performs the necessary interpolation (the pixels change size/shape when rotated). However, this method is not very efficient (I am sure there is a lot of overhead associated with converting an array to and from and IMAQ image) and not very accurate as the rotation and translate happen in series instead of simultaneously. 

   If there is a way to rotate/translate simultaneously with IMAQ, I could use that, but if you know of any other functions that will allow me to rotate/translate the array, that would be wonderful.

 

Thanks,

Rachael

0 Kudos
Message 4 of 6
(3,684 Views)

If you're just doing array math, check out the Mathematics >> Geometry palette. Alternatively, if you can figure out the Matrix math you'll need to perform you can convert from an array to a matrix (look in the array palette for the conversion vis) and use the Linear Algebra palette also found within Mathematics. I don't think you're going to find a VI that does both at the same time, which leaves the question "is there a reason this can't be done in sequence?"

Verne D. // Software R&D // National Instruments
0 Kudos
Message 5 of 6
(3,663 Views)

You must then compare the two data sets, after the manipulation.  Right?  Why not build the translate and rotate into the comparison.  Does the sensor location repeat for each test run?  If it does, then you could manipulate the loop varaible(s) to pull the correct pixel out of the data.  I'm imagining a 9 x 9 grid (0,1,2),(3,4,5),(6,7,8).  Camera 1 is on 3 with up on 0.  Camera 2 is on 1 with up on 2.  Mapping would be 0-2, 1-5, 2-8, 3-1, 4-4, 5-7, 6-0, 7-3, 8-6. so loop index for array 1 would start at i=0, c=0 and the manipulated index would be i=c,c=2-i. to get (-2,-4,-6), (2,0,-2), (6,4,2).

 

See example.

 

Good Luck!

0 Kudos
Message 6 of 6
(3,647 Views)