how to calculate width and length of binary image?

 Respuesta aceptada

Image Analyst
Image Analyst el 18 de Oct. de 2014
You can use the size() function:
[theLength, width] = size(binaryImage);
The first return argument, theLength, is the number of rows (the height), and the second output argument, width, is the number of columns.
As an aside, don't use length as the name of a variable since it's the name of a built-in function.

8 comentarios

Image Analyst
Image Analyst el 18 de Oct. de 2014
If you want the width and height for each blob in the binary image, then you'll have to use regionprops as shown in my Image Segmentation Tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
sou
sou el 19 de Oct. de 2014
Thanx sir
sou
sou el 19 de Oct. de 2014
But it returns the size of the whole image wat I gav.. But I need length width of the binary object in my image...
Image Analyst
Image Analyst el 19 de Oct. de 2014
Please see my demo. It will find the two most distant points in any arbitrarily shaped binary blob, shown by the red line in the image below. It also finds the length inside the blob of the perpendicular mid-point of the longest line, shown in magenta. Feel free to adapt as needed.
sou
sou el 20 de Oct. de 2014
Thanx for your help sir.... But there exist an error while executing this code.. nume1 is undefinedundefined function for logical plz say me wat it represents
Image Analyst
Image Analyst el 20 de Oct. de 2014
There is no error in my code - in fact I just copied and pasted and it worked just fine. You must have changed it and broke it. It looks like you wrote nume1 (with a one) instead of numel (ending in a lower case "L"). Correct your code and try again. Post your code if you have problems with your code.
sou
sou el 20 de Oct. de 2014
ok sir i will check this...
sou
sou el 20 de Oct. de 2014
sir but this gives wrong width for my image sir...
my image is in this link http://labs.fme.aegean.gr/decision/downloads in this link under martin2003 zip file New database pictures\normal superficiel cells are my images sir... plz try it

Iniciar sesión para comentar.

Más respuestas (1)

Matt J
Matt J el 18 de Oct. de 2014
Editada: Matt J el 18 de Oct. de 2014
The size() command?
[Width,Length]=size(binaryImage);

Categorías

Más información sobre Image Processing Toolbox en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

sou
el 18 de Oct. de 2014

Comentada:

sou
el 20 de Oct. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by