This file is indexed.

/usr/share/octave/packages/image-2.2.2/mmgradm.m is in octave-image 2.2.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
## Copyright (C) 2010, 2013 Carnë Draug <carandraug@octave.org>
##
## 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 3 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.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Function File} {} mmgradm (@var{img})
## @deftypefnx {Function File} {} mmgradm (@var{img}, @var{se_dil})
## @deftypefnx {Function File} {} mmgradm (@var{img}, @var{se_dil}, @var{se_ero})
## Perform morphological gradient.
##
## The matrix @var{img} must be numeric whose gradients is calculated, while
## @var{se_dil} and @var{se_ero} are the structuring elements for the dilation
## and erosion respectively.  They can be a:
## @itemize @bullet
## @item
## strel object;
## @item
## array of strel objects as returned by `@@strel/getsequence';
## @item
## matrix of 0's and 1's.
## @end itemize
##
## The @var{se_dil} and @var{se_ero} default to the elementary cross, i.e.:
## @example
## [ 0 1 0
##   1 1 1
##   0 1 0];
## @end example
##
## The basic morphological gradient corresponds to a matrix erosion
## subtracted to its dilation, which is equivalent to:
## @example
## imdilate (img, se_dil) - imerode (img, se_ero)
## @end example
##
## To perform the half-gradients by erosion or dilation, or the internal or
## external gradients, simply pass an empty matrix as structuring element:
## @example
## mmgradm (img, [], se_ero) # half-gradient by erosion or internal gradient
## mmgradm (img, se_dil, []) # half-gradient by dilation or external gradient
## @end example
##
## @seealso{imerode, imdilate, imopen, imclose, imtophat, imbothat}
## @end deftypefn

function grad = mmgradm (img, se_dil = strel ("diamond", 1), se_ero = strel ("diamond", 1))

  ## This function does not exist in Matlab. It is meant to be compatible
  ## with the mmgradm function from the SDC morphology toolbox

  if (nargin < 1 || nargin > 3)
    print_usage ();
  elseif (! isimage (img))
    error("imtophat: IMG must be a numeric matrix");
  endif
  se_dil = prepare_strel ("mmgradm", se_dil);
  se_ero = prepare_strel ("mmgradm", se_ero);

  dilated   = imdilate  (img, se_dil);
  eroded    = imerode   (img, se_ero);

  if (islogical (img))
    grad  = dilated & ! eroded;
  else
    grad  = dilated - eroded;
  endif
endfunction