How to divide image into sectors around CoG
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Burhan
am 29 Dez. 2015
Kommentiert: Image Analyst
am 24 Apr. 2017
How a binary image can be divided into equal size sectors circularly around its center of gravity (CoG).
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 29 Dez. 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 Kommentare
anastasia
am 24 Apr. 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
am 24 Apr. 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.
Weitere Antworten (1)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!