Borrar filtros
Borrar filtros

How to Find the min and max coordinates of an object in an image

7 visualizaciones (últimos 30 días)
How to find the minX,minY,maxX,maxY of an object in a binary image

Respuesta aceptada

Matt J
Matt J el 3 de Oct. de 2015
Editada: Matt J el 3 de Oct. de 2015
[I,J]=find(yourImage);
minIJ=min([I,J],[],1);
maxIJ=max([I,J],[],1);
  5 comentarios
Prathveraj Shetty
Prathveraj Shetty el 16 de Feb. de 2019
hello,
I have a doubt . if i have coordinates of a point and a digital image (i.e., either black or white (bitmap)). How to find the distance between the point and each pixel of the image.
Image Analyst
Image Analyst el 16 de Feb. de 2019
Try this, where (xp, yp) are the coordinates of your single point.
[rows, columns, numberOfColorChannels] = size(yourImage);
[x, y] = meshgrid(1:columns, 1:rows);
distanceImage = sqrt((x-xp).^2 + (y-yp).^2);
imshow(distanceImage, []);

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 3 de Oct. de 2015
Note: Matt's solution only works if you have only 1 object in your binary image. If you have multiple objects, use regionprops() and ask for the BoundingBox measurement. See my Image Segmentation Tutorial for a full demo: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

Community Treasure Hunt

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

Start Hunting!

Translated by