Code covered by the BSD License  

Highlights from
"April, 2011 Image Processing with MATLAB" webinar demo files

image thumbnail

"April, 2011 Image Processing with MATLAB" webinar demo files

by

 

MATLAB demo files used in the image processing webinar held on April, 2011 in Japan.

BinaryClose.m
%% Copyright 2013 The MathWorks, Inc.

%% Initializing
close all; clear all; clc;

%% Create black and white blob
a = zeros(30,50);
a(10:20, 6:40) = 1;
a(10:14, 20:25) = 0;
a(16:20, 20:25) = 0;
a(12:19, 36:40) = 0;
a(15, 40) = 1;
a(15, 30) = 0;
a(14:16, 6:14) = 0;
a(9,  8) = 1;
a(9,  10) = 1;
a(10, 12) = 0;
a(10, 16) = 0;
figure, subplot(4,1,1), imshow(a, 'InitialMagnification', 'fit');
title('Original', 'FontSize', 12, 'color', 'red')

%% Create Morphological strel structure
se = strel('square', 3); %creates 3x3 structure

% Following code is just to show the structure visually.
se_image = padarray(ones(3), [13 23]);
subplot(4,1,2), imshow(se_image, 'InitialMagnification','fit')
title('Morphological Structure', 'FontSize', 12, 'color', 'red')

%% Dilation
b = imdilate(a, se);
subplot(4,1,3), imshow(b,'InitialMagnification', 'fit')
title('Original->Dilation', 'FontSize', 12, 'color', 'red')

%% Erosion
c = imerode(b, se);
subplot(4,1,4), imshow(c,  'InitialMagnification', 'fit')
title('Dilation->Erosion', 'FontSize', 12, 'color', 'red')

Contact us