X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fimage-1.0.15%2Fimopen.m;fp=octave_packages%2Fimage-1.0.15%2Fimopen.m;h=d5c814d933d34689938140c28affa1688d5bb1b6;hp=0000000000000000000000000000000000000000;hb=c880e8788dfc484bf23ce13fa2787f2c6bca4863;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/image-1.0.15/imopen.m b/octave_packages/image-1.0.15/imopen.m new file mode 100644 index 0000000..d5c814d --- /dev/null +++ b/octave_packages/image-1.0.15/imopen.m @@ -0,0 +1,41 @@ +## Copyright (C) 2008 Soren Hauberg +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License +## as published by the Free Software Foundation; either version 2 +## of the License, or (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## -*- texinfo -*- +## @deftypefn {Function File} @var{B} = imopen (@var{A}, @var{se}) +## Perform morphological opening on a given image. +## The image @var{A} must be a grayscale or binary image, and @var{se} must be a +## structuring element. +## +## The opening corresponds to an erosion followed by a dilation of the image, i.e. +## @example +## B = imdilate(imerode(A, se), se); +## @end example +## @seealso{imdilate, imerode, imclose} +## @end deftypefn + +function retval = imopen(im, se) + ## Checkinput + if (nargin != 2) + print_usage(); + endif + if (!ismatrix(im) || !isreal(im)) + error("imopen: first input argument must be a real matrix"); + endif + if (!ismatrix(se) || !isreal(se)) + error("imopen: second input argument must be a real matrix"); + endif + + ## Perform filtering + retval = imdilate(imerode(im, se), se); + +endfunction