Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
display image in Cartesian coordinates

Subject: display image in Cartesian coordinates

From: xiong

Date: 22 Jan, 2010 11:58:06

Message: 1 of 4

Hello for everyone,
I have a 200-by-500 matrix,each row corresponds to an individual beam (taken at a particular sonar transducer angle)(1.8 degree) and each column corresponds to the bin obtained at a particular distance from the transducer(0.1m).The values in the matrix represent echo-amplitude-returns in acoustic images.
I want to represent the matrix in polar coordinates and represent it in in Cartesian coordinates.I have used imagesc to represent the matrix in polar coordinates,but I do not known how to tell Matlab to represent the matrix in Cartesian coordinates.
Would anyone can help me?
Thanks.

Subject: display image in Cartesian coordinates

From: Bjorn Gustavsson

Date: 22 Jan, 2010 13:06:21

Message: 2 of 4

"xiong " <xionglei092292@sina.com> wrote in message <hjc3sd$5l6$1@fred.mathworks.com>...
> Hello for everyone,
> I have a 200-by-500 matrix,each row corresponds to an individual beam (taken at a particular sonar transducer angle)(1.8 degree) and each column corresponds to the bin obtained at a particular distance from the transducer(0.1m).The values in the matrix represent echo-amplitude-returns in acoustic images.
> I want to represent the matrix in polar coordinates and represent it in in Cartesian coordinates.I have used imagesc to represent the matrix in polar coordinates,but I do not known how to tell Matlab to represent the matrix in Cartesian coordinates.
> Would anyone can help me?
> Thanks.
Maybe what you're after is something like this:
phi = ([1:200]*dphi+phi0)*pi/180;
r = [1:500]*1.8;
[PHI,R] = meshgrid(phi,r);
% To display the data:
pcolor(R.*cos(PHI),R.*sin(PHI),data),shading flat
% To resample to cartesian coordinates:
n_bins = 2000;
% set it to something suitable, medium big here since data points close to
% (0,0)
x = linspace(-max(r),max(r),n_bins);
y = linspace(-max(r),max(r),n_bins);
Data = griddata(R(:).*cos(PHI(:)),R(:).*cos(PHI(:)),data(:));

HTH,
Bjeorn

Subject: display image in Cartesian coordinates

From: xiong

Date: 22 Jan, 2010 13:54:04

Message: 3 of 4

"Bjorn Gustavsson" <bjonr@irf.se> wrote in message <hjc7sd$jhh$1@fred.mathworks.com>...
> "xiong " <xionglei092292@sina.com> wrote in message <hjc3sd$5l6$1@fred.mathworks.com>...
> > Hello for everyone,
> > I have a 200-by-500 matrix,each row corresponds to an individual beam (taken at a particular sonar transducer angle)(1.8 degree) and each column corresponds to the bin obtained at a particular distance from the transducer(0.1m).The values in the matrix represent echo-amplitude-returns in acoustic images.
> > I want to represent the matrix in polar coordinates and represent it in in Cartesian coordinates.I have used imagesc to represent the matrix in polar coordinates,but I do not known how to tell Matlab to represent the matrix in Cartesian coordinates.
> > Would anyone can help me?
> > Thanks.
> Maybe what you're after is something like this:
> phi = ([1:200]*dphi+phi0)*pi/180;
> r = [1:500]*1.8;
> [PHI,R] = meshgrid(phi,r);
> % To display the data:
> pcolor(R.*cos(PHI),R.*sin(PHI),data),shading flat
> % To resample to cartesian coordinates:
> n_bins = 2000;
> % set it to something suitable, medium big here since data points close to
> % (0,0)
> x = linspace(-max(r),max(r),n_bins);
> y = linspace(-max(r),max(r),n_bins);
> Data = griddata(R(:).*cos(PHI(:)),R(:).*cos(PHI(:)),data(:));
>
> HTH,
> Bjeorn
I used imagesc to represent it in polor coordinates.Somebody told me to use poi2cart to represent it in Cartesian coordinates.But until now I can not make it .
Could anyone help me?

Subject: display image in Cartesian coordinates

From: Anthony Hopf

Date: 26 Apr, 2010 20:43:20

Message: 4 of 4

"xiong " <xionglei092292@sina.com> wrote in message <hjcals$ibb$1@fred.mathworks.com>...
> "Bjorn Gustavsson" <bjonr@irf.se> wrote in message <hjc7sd$jhh$1@fred.mathworks.com>...
> > "xiong " <xionglei092292@sina.com> wrote in message <hjc3sd$5l6$1@fred.mathworks.com>...
> > > Hello for everyone,
> > > I have a 200-by-500 matrix,each row corresponds to an individual beam (taken at a particular sonar transducer angle)(1.8 degree) and each column corresponds to the bin obtained at a particular distance from the transducer(0.1m).The values in the matrix represent echo-amplitude-returns in acoustic images.
> > > I want to represent the matrix in polar coordinates and represent it in in Cartesian coordinates.I have used imagesc to represent the matrix in polar coordinates,but I do not known how to tell Matlab to represent the matrix in Cartesian coordinates.
> > > Would anyone can help me?
> > > Thanks.
> > Maybe what you're after is something like this:
> > phi = ([1:200]*dphi+phi0)*pi/180;
> > r = [1:500]*1.8;
> > [PHI,R] = meshgrid(phi,r);
> > % To display the data:
> > pcolor(R.*cos(PHI),R.*sin(PHI),data),shading flat
> > % To resample to cartesian coordinates:
> > n_bins = 2000;
> > % set it to something suitable, medium big here since data points close to
> > % (0,0)
> > x = linspace(-max(r),max(r),n_bins);
> > y = linspace(-max(r),max(r),n_bins);
> > Data = griddata(R(:).*cos(PHI(:)),R(:).*cos(PHI(:)),data(:));
> >
> > HTH,
> > Bjeorn
> I used imagesc to represent it in polor coordinates.Somebody told me to use poi2cart to represent it in Cartesian coordinates.But until now I can not make it .
> Could anyone help me?

Xiong,

It looks like Bjeorn basically did this... except he calculated the pol2cart transform in the last line starting with Data.

Did you find another way to do this?

T

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us