find distance from center pixel to next white pixel

3 Ansichten (letzte 30 Tage)
Dinesh Kumar Kanagaraj
Dinesh Kumar Kanagaraj am 27 Mär. 2018
Kommentiert: Rik am 27 Mär. 2018
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 Kommentare
Rik
Rik am 27 Mär. 2018

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 am 27 Mär. 2018

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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by