Grayscale erosion and Grayscale dilation simulink block

2 views (last 30 days)
I was trying to find the minimum and maximum of the 3 x 3 neighbourhood for the video signal. I have used grayscale erosion and grayscale dilation simulation block. For some of the instances the maximum values is found to be less than the minimum value.
It would be great if example for using these two blocks posted in mathwork community.
Can someone tell me how to overcome this situation?
Thanks in advance

Answers (1)

Akshat
Akshat on 30 Apr 2024
Hi Gayathri,
It would have been easier for me to help you out with this task if you would've provided a code you are using. But I will try my best to guide you through the process.
As you want to perform an erosion and dilation task, you need to first generate a "structuring element" using the "strel"/"offsetstrel" function. Post that, you can simply erode or dilate using the "imerode" or "imdilate" respectively. Following is the code you can use:
frame = rgb2gray(imread('example.jpg'));
se = strel('square', 3);
minFrame = imerode(frame, se);
maxFrame = imdilate(frame, se);
You need to make sure that the image is grayscale before you perform the erosion or dilation.
Now, to the second part of you question, examples for the same are here"
Feel free to follow up, in case you have any doubts!

Community Treasure Hunt

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

Start Hunting!