How can i divide an image into sectors with MATLAB?
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (3개)
Image Analyst
2012년 10월 20일
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
2012년 10월 28일
댓글 수: 1
Image Analyst
2012년 10월 28일
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
2012년 10월 29일
편집: Pamela
2012년 10월 29일
댓글 수: 7
JovanS
2022년 9월 17일
편집: JovanS
2022년 9월 18일
@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
2022년 9월 17일
@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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!