% bwmorph_example converts bwmorph example in bwmorph.m to C mex file
%**************************************************************************
%
% MATLAB (R) is a trademark of The Mathworks (R) Corporation
%
% Function: bwmorph_example
% Filename: bwmorph_example.c
% Programmer: James Tursa
% Version: 1.0
% Date: March 4, 2008
% Copyright: (c) 2008 by James Tursa, All Rights Reserved
% Permission: Permission is granted to freely distribute and use this code
% as long as the header information is included.
%
% bwmorph_example converts the following example from bwmorph.m to c:
%
% BW1 = imread('circles.png');
% figure, imshow(BW1)
% BW2 = bwmorph(BW1,'remove');
% BW3 = bwmorph(BW1,'skel',Inf);
% figure, imshow(BW2)
% figure, imshow(BW3)
%
% To create the dll, do the following at the MATLAB prompt:
%
% >> mex -setup
% (then pick any C/C++ compiler, such as lcc)
% >> mex bwmorph_example.c
%
% That's it. Now you are ready to use bwmorph_example as follows:
%
% >> bwmorph_example
%
%**************************************************************************
disp('You must create the bwmorph_example dll first. So do this:');
disp(' ');
disp('>> mex -setup');
disp(' (then pick any C/C++ compiler, such as lcc)');
disp('>> mex bwmorph_example.c');
disp(' ');
disp(' ');
disp('That''s it. Now you are ready to use bwmorph_example, which uses');
disp('C mex code to perform the following commands:');
disp(' ');
disp('BW1 = imread(''circles.png'');');
disp('figure, imshow(BW1)');
disp('BW2 = bwmorph(BW1,''remove'');');
disp('BW3 = bwmorph(BW1,''skel'',Inf);');
disp('figure, imshow(BW2)');
disp('figure, imshow(BW3)');
disp(' ');
disp('These commands will now be performed. Three figures should appear.');
BW1 = imread('circles.png');
figure, imshow(BW1)
BW2 = bwmorph(BW1,'remove');
BW3 = bwmorph(BW1,'skel',Inf);
figure, imshow(BW2)
figure, imshow(BW3)
clear BW1
clear BW2
clear BW3