function y = opening( x, ntimes )
  
% FUNCTION Y = OPENING( X, NTIMES )
  
  if nargin < 2
    error( [ mfilename ' needs 2 input arguments.' ] );
  end
  
  y = dilation( erosion( x, ntimes ), ntimes );
  