How to find the accurate position of first white pixel in an image?

1 view (last 30 days)
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?

Answers (1)

Jan
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
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?

Sign in to comment.

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!