find distance from center pixel to next white pixel

3 visualizaciones (últimos 30 días)
Dinesh Kumar Kanagaraj
Dinesh Kumar Kanagaraj el 27 de Mzo. de 2018
Comentada: Rik el 27 de Mzo. de 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 comentarios
Rik
Rik el 27 de Mzo. de 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 el 27 de Mzo. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by