%morfologicke operace
clear all;close all;clc;

img=imread('srcimg.png');
[height,width,channel]=size(img);

if channel ~=1 
  img=im2bw(img,graythresh(img));
end

se=strel('line',3,0);

figure(1)
subplot(1,2,1); imshow(dilatation(img));  title('fnc dilatation');
subplot(1,2,2); imshow(imdilate(img,se)); title('fnc imdilate');

figure(2)
subplot(1,2,1); imshow(img); title('source image');
subplot(1,2,2); imshow(imerode(imerode(imerode(img,se),se),se)); title('3 x erode image');

figure(3)
subplot(2,2,1); imshow(imdilate(imerode(img,se),se));  title('erode->dilalate');
subplot(2,2,2); imshow(imopen(img,se)); title('imopen');
subplot(2,2,3); imshow(imerode(imdilate(img,se),se));  title('dilate->erode');
subplot(2,2,4); imshow(imclose(img,se)); title('imclose');
