Find X and Y coordinates of white pixels in a grayscale image

3 views (last 30 days)
Hi, I want to find the x and y coordinates of all the pixels corresponding to the white pixels in this image and store them in an array. Later I want to find the equation of the best fitting curve passing through these coordinates. Can someone please help me with how this can be done?
PS I am very new to MATLAB and programming in general.
Thank you in advance

Accepted Answer

Matt J
Matt J on 27 Oct 2022
Edited: Matt J on 27 Oct 2022
You will first need to get rid of the horizontal line of white pixels near the top,
load Image
Image(1:20,:)=0; Image=bwpropfilt(Image>0,'ConvexArea',1); %Image cleanup
[y,x]=find(Image); %Get coordinates
plot(x,y,'x')
  4 Comments
Matt J
Matt J on 27 Oct 2022
Edited: Matt J on 27 Oct 2022
You're welcome, but if your posted question (about finding X,Y) has been answered, kindly Accept-click.

Sign in to comment.

More Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!