Need help finding coordinates of an image.

Hi there,
I was just wondering if there is anyway that I can insert an image into Matlab and recieve the coordinates of the image.
The aim would be to recieve the coordinates of the image so that I could use Fouriers Transform and Epicycles in order to redraw the image.

2 Comments

What coordinates you want to get for an image?
The x and y coordinates, as if it were plotted onto a graph.

Sign in to comment.

 Accepted Answer

The image will be plotted wrt it's indices. If I is your image.
[m, n, p] = size (I);
x = 1: n;
y = 1: m;
[X, Y] = meshgrid (x, y);

2 Comments

Thank you so much, but how do i get it to give me every individual coordinate for the image? It is just displaying the image on a plot for me.
Try this:
[rows, columns, numberOfColorChannels] = size (I);
x = 1 : columns;
y = 1 : rows;
[X, Y] = meshgrid(x, y);
xy = [X(:), Y(:)];
This will give you a 2-D array of x,y values. The x are in the first column and the y are in the second column. It will have one row for every pixel in the image.
IMPORTANT: realize that image variables are not indexed (x,y), they are indexed (row, column), which is like grayImage(y, x) if you want to retrieve the gray level of the pixel at row=y and column = x.
For what it's worth, I'm attaching a demo to turn an image into a CSV file.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!