How to find the accurate position of first white pixel in an image?
1 view (last 30 days)
Show older comments
I had done several coding to find the first white pixel in an image:
%Mark horizontal pixel
[row1, column1] = find(thinImg, 1, 'last');
hold on;
plot(column1, row1, 'yX', 'MarkerSize', 15);
%Mark vertical pixel
[row2, column2] = find(thinImg, 1, 'first');
hold on;
plot(row2, column2, 'yX', 'MarkerSize', 15);
Here is the result of the processed image http://postimg.org/image/er5r7k4x9/.. There is no problem to find the first white pixel in horizontal axis.. However,problem occurred when i tried to find the first white pixel in vertical axis (*marked by red circle).. Any suggestion on how to solve this problem?
0 Comments
Answers (1)
Jan
on 23 Jul 2013
If finding the first pixel in horizontal direction works well, you can transpose the image:
thinImgT = transpose(thinImg)
and than use the detector for the horizontal direction again.
3 Comments
Dhandapani.S
on 6 Jan 2015
ok what is the way to find top-left, top-right, bottom-left and bottom-right coordinate in a binary image?
Image Analyst
on 6 Jan 2015
Did you not see the answer to this when you asked it as a separate question? Here it is: http://www.mathworks.com/matlabcentral/answers/169071-how-to-find-the-corners-of-an-irregular-binary-shape#answer_164134
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!