find distance from center pixel to next white pixel

조회 수: 3 (최근 30일)
Dinesh Kumar Kanagaraj
Dinesh Kumar Kanagaraj 2018년 3월 27일
댓글: Rik 2018년 3월 27일
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