MATLAB Answers

How to erosion and dilation of the image to achieve the desired effect?

99 views (last 30 days)
The reference document says that the left image erodes first and then dilates,that will get the image on the right. However, after I test the effect is not so good, I wonder if experts have any good way. Thank you.
1.The effect of the reference
2.Test results
3.Reference description
5.Test code
clear all; clear; clc; load('TData.mat');
subplot(1,2,1) imagesc(imgx,imgy,imagdata); colormap(imagecolorset); colorbar('northoutside'); set(gca,'YDir','reverse') caxis(gca,[0.5 256])
se = strel('line',25,90);
erodedBW = imerode(imagdata,se); se = strel('line',11,90); erodedBW = imdilate(erodedBW,se); subplot(1,2,2) imagesc(imgx,imgy,erodedBW);
colormap(imagecolorset); colorbar('northoutside'); set(gca,'YDir','reverse')


Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 14 Dec 2017
It looks like you need to adjust the parameters that specify the size of your structuring element. It seems they're too big for your image's resolution so the image is getting smoothed out more than the example in the paper. By the way, erosion followed by dilation is called "opening" and can be done with the function imopen().


Show 1 older comment
Shel on 20 Sep 2019
I have a very large series of images (cross-section) of a column of soil (two layer of soil) with very low resolution. I have the porosity of the two layers and I used many diffrent methods and neighborhoods to do the segmentation. I have found the best methods (which gave me the true difference between porosity of two layers but the porosity of each layer is different from the experimental data. Now, I was wondering if you can have any duggestions on which dilation/erosion method might workin this case (to reduce the porosity of two layers in the same amount for example: the porosity that I got after segmentation is 0.5 and 0.55 and I need to change it to 0.35 and 0.4)
Image Analyst
Image Analyst on 22 Sep 2019
The porosity of the soil is what it is. It is not made to be that by any image you take of it or any processing you do of that image. The porosity of the soil is a physical property of the soil.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!