Showing posts with label morphological operation. Show all posts
Showing posts with label morphological operation. Show all posts

Tuesday, 26 August 2014

morphology operations top hat and bottom hat

 I = im2single(imread('rice.png'));
 htop = vision.MorphologicalTopHat('Neighborhood',strel('disk', 12));

% Improve contrast of output image
   hc = vision.ContrastAdjuster;  J = step(htop,I);
  J = step(hc,J);
  figure;

 subplot(1,2,1),imshow(I); title('Original image');
 subplot(1,2,2),imshow(J);
 title('Top-hat filtered image');




I = im2single(b);
 hbot = vision.MorphologicalBottomHat('Neighborhood',strel('disk', 5));
 J = step(hbot,I);
 figure;
 subplot(1,2,1),imshow(I); title('Original image');
 subplot(1,2,2),imshow(J);
 title('Bottom-hat filtered image'); 

morphological operations in matlab

hcsc = vision.ColorSpaceConverter;
 hcsc.Conversion = 'RGB to intensity';
 hautothresh = vision.Autothresholder;
 hdilate = vision.MorphologicalDilate('Neighborhood', ones(5,5));
 x1 = step(hcsc, a);
 x2 = step(hautothresh, x1);
 y = step(hdilate, x2);
 figure;
 subplot(3,1,1),imshow(a); title('Original image');
 subplot(3,1,2),imshow(x2); title('Thresholded Image');
 subplot(3,1,3),imshow(y); title('Dilated Image');