How can i divide an image into sectors with MATLAB?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (3)
Image Analyst
el 20 de Oct. de 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.
14 comentarios
Pamela
el 28 de Oct. de 2012
1 comentario
Image Analyst
el 28 de Oct. de 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
el 29 de Oct. de 2012
Editada: Pamela
el 29 de Oct. de 2012
7 comentarios
JovanS
el 17 de Sept. de 2022
Editada: JovanS
el 18 de Sept. de 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
el 17 de Sept. de 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.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!