Receiving x and y coordinates of an image.
49 views (last 30 days)
Show older comments
Using the code:
"I = imread('pic.png');
[m, n, p] = size (I);
x = 1: n;
y = 1: m;
[x, y] = meshgrid (x, y);"
I was able to plot this image onto MATLAB.
However, now I am unable to retrieve all of the x and y coordinates. I need to have all of the x and y coordinates in order to later use it in a different code, where i use Fourier Transform and Epicycles in order to trace this image.
Can somebdy please help me to retrieve all of the x and y coordinates for the traced image.
Many thanks
0 Comments
Accepted Answer
KSSV
on 22 Nov 2020
Edited: KSSV
on 22 Nov 2020
I = imread("image.jpeg") ;
[y,x] = find(I~=255) ;
coor = [x y] ;
2 Comments
Image Analyst
on 22 Nov 2020
Edited: Image Analyst
on 22 Nov 2020
You mean
if ndims(I) == 3
I = rgb2gray(I); % Convert to gray scale if needed.
end
[y, x] = find (I ~ = 255);
coor = [x, y]; % Comma is needed
KSSV
on 22 Nov 2020
Yes, I meant.
coor = [x y] ;
But, today mathworks link is behaving wierd. It is creating extra spaces or removing the spaces after updating the answer.
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!