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

조회 수: 2 (최근 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

채택된 답변

Walter Roberson
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
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개)

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by