How to divide image into sectors around CoG

4 visualizaciones (últimos 30 días)
Burhan
Burhan el 29 de Dic. de 2015
Comentada: Image Analyst el 24 de Abr. de 2017
How a binary image can be divided into equal size sectors circularly around its center of gravity (CoG).

Respuesta aceptada

Image Analyst
Image Analyst el 29 de Dic. de 2015
Create x,y coordinates of an arc using the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_arc.3F.
Then pass those coordinates into poly2mask(x,y,rows,columns) to get a binary image (mask). Then multiply that by, or assign, the image to mask off everything except that sector.
Let me know if you can't figure out the attached, well commented code.
  5 comentarios
anastasia
anastasia el 24 de Abr. de 2017
What if I don't want the background pixels in my pie-shaped sectors? Is it possible to automatically determine the radius for the sector taking into account different sizes of the apples?
cr = floor(size(im,1)/2);
cl = floor(size(im,2)/2);
r = min(cr, cl);
When I do this, I get quite a few background pixels in my pie-shaped sectors. My final aim is to find the color asymmetry between two sectors by determining the euclidean distance. For this, I need to minimise the no. of background pixels. How do I do that?
2. Is there any other way of using poly2mask ONLY for my apple (which is an irregularshape) Instead of dividing it into pie-shaped sectors, Can I just divide the apple into 4 parts starting from the centre and then determine the color asymmetry?
Please help
Image Analyst
Image Analyst el 24 de Abr. de 2017
Find the apple mask by converting to hsv colorspace with rgb2hsv() then thresholding the S channel. The apple will have S values more than about 0.2. Now you have a mask and you can use it to blacken outside the apple, crop the image, or both.

Iniciar sesión para comentar.

Más respuestas (1)

Burhan
Burhan el 31 de Dic. de 2015
thank a lot

Community Treasure Hunt

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

Start Hunting!

Translated by