Is there any function with same function as strel, but where I can define a center of shape not only the radius
4 次查看(过去 30 天)
显示 更早的评论
Hello, I have a binary image, I would like to create strel function with shape of circle, but I would like to define the center of it.
So for example, I have a point where I would like the strel has a midle with define radius. Thank you so much
0 个评论
采纳的回答
Walter Roberson
2022-11-6
No such function is provided.
You will need to use strel() and then pad the array or crop the array as appropriate.
Note that structuring elements are "slid" over the entire image when in use. You would not be defining a structure element based on data (pixel) coordinates. It would be rather unusual to define a structure element that was an off-center circle (not impossible, but there is not typically any use for such a thing.)
I wonder if you are trying to use strel() to define a circle mask to use once for the entire image, rather than for morphological operations? That kind of processing would typically be done using ROI operations or by mathematical calculations.
3 个评论
Walter Roberson
2022-11-7
You would typically use ROI operations for that, or mathematical calculations
D = sqrt((X-Xc).^2 + (Y-Yc).^2);
Then as you loop
mask = D <= current_radius;
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!