Is there any function with same function as strel, but where I can define a center of shape not only the radius

2 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 6 Nov 2022
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 Comments
Walter Roberson
Walter Roberson on 7 Nov 2022
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;

Sign in to comment.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!