# How can i calculate the ( area ,... ) automatic for gray scale image using Matlab code ??

5 visualizaciones (últimos 30 días)
Aya Ahmed el 21 de Feb. de 2020
Comentada: Aya Ahmed el 4 de Mzo. de 2020
How can i calculate the
( (i) area , (ii) centriod , (iii) bounding box , (iv) major axis , (v) minor axis , (vi) eccentricity , (vii) orientation ,(viii) convex area and (ix) extrema ) automatic
for gray scale galaxy image like that using Matlab code ??
to make feature extraction for galaxy images ?
Note >>this image after makeing galaxy oriantation horizontal and cropping it >>
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

### Respuestas (1)

Daniel Vieira el 21 de Feb. de 2020
you don't calculate areas in grayscale directly, you need to binarize to indicate which pixels count in the area and which dont.
For that:
bw=imbinarize(I);
R=struct2table(regionprops(bw,{'Area','Centroid','BoundingBox',...
'MajoraxisLength','MinoraxisLength','Eccentricity',...
'Orientation','ConvexArea','Extrema'}))
Note that imbinarize hardly ever yields good results at the default properties, without exploring parameters.
##### 3 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Daniel Vieira el 28 de Feb. de 2020
the imbinarize function takes a grayscale image and automatically sets a threshold, all gray values below it are set to zero and all values above it are set to one. it becomes a purely black and white image, no gray scale, that segments light objects from dark background in your original image.
what regionprops does is take every isolate white region in a black and white image (not grayscale, just black and white) and measure it. it returns a struct or table with the properties measured, one white region per line. So the 1st line of your output contains the properties of a reagion that corresponds to most of your galaxy, since it's the largest region and all others are <10 pixels in area. It is centered in pixel (x,y)=[76.753 49.208], and its excentricity is ~0.72, for example. The other lines are other regions of the image, which are probably just noise, and should be filtered out of your black and white image before applying regionprops, with morphological transformations for example.
Aya Ahmed el 4 de Mzo. de 2020
thank you very much ..

Iniciar sesión para comentar.

### Categorías

Más información sobre Region and Image Properties en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by