find distance from center pixel to next white pixel

1 次查看(过去 30 天)
How can I find the center pixel in a normal window like 640 by 480 pixels..I attached my one reference image from this image I want to measure h1, h2, w1, w2 from this mid point.Is it possible to measure the unknown shape of images?
  2 个评论
Rik
Rik 2018-3-27

You can generate a distance grid with the code below. Using find, you can find what you define as a high intensity pixel.

x_center=320;
y_center=240;
[X,Y]=meshgrid((1:640)-x_center,(1:480)-y_center);
distance_to_center=hypot(X,Y);
Rik
Rik 2018-3-27

You can find the center point of a blob with regionprops:

stats = regionprops(your_binary_image);
centroid = stats.centroid;

Then you should be able to use find on the relevant row and column to find the outer edges of your shape.

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by