Image Morphing in Matlab
I want to use the math morphology function in MATLAB to find the can.png border of an image. Input image:
I want to get a border like:
I tried different combinations and parameters using strel, imerode, imdilate but the result is not good enough (far from expectation)
One of my trial codes:
a = imread ('can.png'); b = im2bw(a); SE = strel('rectangle', [10 50 ]) ; i2 = imdilate(b,SE); figure(1); imshow(i2); p = ones(4); c = b - imerode(b,p); figure(2); imshow(c);
Output:
Can anyone help me how to create the expected image (black background with thin border for the jar, please?) Thanks a lot.
+3
source to share
2 answers