LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change polar data to cartesian coordinates

The txt file is the data get form 2D laser rangefinder, which every 1°capture a obstacle distance information and 180 data in total. Obviously,this is under polar coordinate system.
first,I would like to change the log file's data under polar coordinate to cartesian coordinates by multiply sin(theta) and cos(theta).second,the result data form 2D array,and then conbine another array which is 1D zero array to form a 3D array.Please tell me how to realize it.
Thanks
0 Kudos
Message 1 of 6
(7,190 Views)
Hi,

The code is a bit messy but I hope it will help you anyway 😉

Let me know if you need comments or further help


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 2 of 6
(7,177 Views)
You don't need any trigonometry, just go via complex numbers. Attached is one simple possibility. (note that LabVIEW 8.0 has a single tool to go from "r,theta" to "x,y" in the complex palette). See attached, LabVIEW 7.0.
 
You might need to tweak it for the desired definition of the angles (ccw vs. cw)
 
Alternatively, there is also a 1D polar to rectangular tool in the "math.. array operations" palette that you could use, just create a ramp for theta and initialize a zero array for Z.

Message Edited by altenbach on 06-30-2006 12:07 AM

Message 3 of 6
(7,177 Views)
Thanks TiTon and altenbach ,this attachments is what I'm looking for.
In fact ,I need to add a 3D array to an image which captured by CCD.
the relation between image and laser just can be express as a Phi orientation matrix and Delta translation matrix,through compute,
the Phi=[-0.2032   -0.9791   0.0100;   
              -0.2946     0.0709   0.9530;
              -0.9338     0.1907   -0.3028]
Delta=[-0.5464   -2.8573   3.4259].   
Phi*3D matrix(3-by-180 array) and then add Delta matrix(3-by-3),
through this process it will produce a new 3-by-180 array.Now the new array is the postion that the laser point in the image.
At last ,i would like to overlay the new 180 points to the image.
0 Kudos
Message 4 of 6
(7,169 Views)

What I need just like the image in the attachment.

0 Kudos
Message 5 of 6
(7,166 Views)

I am sorry,i made a mistake. I neglect a most import process. the new 3D array(3-by-180)represent 180 points in the camera system,

it need to do a transiton ,that is xi=fXi/Zi ,yi=fYi/Zi ,f=768mm  is the camera's Focal Length now the x,y is the laser points on the image. untile now, it can be overlay the x,y data to the image.

0 Kudos
Message 6 of 6
(7,160 Views)