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

7 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 6 de Nov. de 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 comentarios
Walter Roberson
Walter Roberson el 7 de Nov. de 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;

Iniciar sesión para comentar.

Más respuestas (0)

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by