How can i divide an image into sectors with MATLAB?
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi
How I can divide an image into 8 equi-angular areas using as center the center of mass of the region? Then the contour points of region are identified and if the distribution of the radii of the polar coordinates of the contour points exhibit large variation for one of the eight areas the 'border' value is increased by one. This happens for all eighths until the final value is estimated that should be between 0 and 8.
Can you help me to do this with MATLAB?
0 Commenti
Risposte (3)
Image Analyst
il 20 Ott 2012
Are the "contour points" the boundary points of the sectors? Do you have those? That's just simple 10th grade trigonometry. Do you have the center of mass? That's just using regionprops where the binary image is true(size(grayImage)), and you ask for 'WeightedCentroid':
measurements = regionprops(true(size(grayImage)), grayImage, 'WeightedCentroid');
centerOfMass = measurements.WeightedCentroid;
or something like that. Then use trig to send out lines from the center of mass to the border of the image. Then use poly2mask() to create a binary image which you then multiply by your gray scale image to get the masked sector.
% Mask the image.
maskedImage = bsxfun(@times, grayImage, cast(mask, class(grayImage)));
So I think that's the step by step process I think you need to follow, if I understood you correctly.
Pamela
il 28 Ott 2012
1 Commento
Image Analyst
il 28 Ott 2012
No. Anyway, you have both already. You have the x,y and you have the distance from the centroid. What did you set for someAmount? You need to run through it and see what the stddev for normal lesions is, and then set someAmount a little more than that.
Pamela
il 29 Ott 2012
Modificato: Pamela
il 29 Ott 2012
7 Commenti
JovanS
il 17 Set 2022
Modificato: JovanS
il 18 Set 2022
@Image Analyst, on the comments above you said that we have to "compute the angle and which of the 8 sectors it belongs in. For each of the 8 groups of distances you computed, get their standard deviation."
I tried to follow your directions but I am not sure if the line used to calculate the angle is correct or not and if the sectors are divided in the right way. I will attach a part of matlab code if you can help me @Image Analyst
Image Analyst
il 17 Set 2022
@Ioanna St I can't run that. Please attach the whole m-file with the paper clip icon along with any image needed to run it.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!