This file is indexed.

/usr/share/pyshared/gamera/plugins/thinning.py is in python-gamera 3.3.2-2.

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
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# -*- coding: utf-8 -*-
#
# Copyright (C) 2001-2005 Ichiro Fujinaga, Michael Droettboom, and Karl MacMillan
#
# 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.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

from gamera.plugin import *
import _thinning

class Thinning(PluginFunction):
    self_type = ImageType([ONEBIT])
    return_type = ImageType([ONEBIT])
    doc_examples = [(ONEBIT,)]

class thin_zs(Thinning):
    """
    Thins (skeletonizes) a ONEBIT image using the Zhang and Suen
    algorithm.

    The resulting skeleton is not a medial axis transformation, and
    the ends of the skeleton will not extend to the edges of the
    original image.

    T. Y. Zhang and C. Y. Suen. 1984.  A Fast Parallel Algorithm for
    Thinning Digital Patterns., *Communications of ACM*, 2(3).
  
    R. C. Gonzalez and P. Wintz. 1987 *Digital Image Processing.*,
    2. edition. 398-402.
    """
    pass

    
class thin_hs(Thinning):
    """
    Derives the medial axis transformation from a ONEBIT image using the
    Haralick and Shapiro algorithm.

    Unlike thin_zs_ and thin_lc_, this function performs a medial axis
    transformation, and the ends of the skeleton extend to the corners of
    the original image.

    Consider using thin_hs_large_image_ instead, for faster performance on
    large images with a lot of connected components.

    R. M. Haralick and L. G. Shapiro. 1992.  *Computer and Robot Vision*,
    Vol. 1, Chapter 5 (especially 5.10.1).  Reading, MA: Addison-Wesley.
    """
    pass

class medial_axis_transform_hs(Thinning):
    """"This function is an alias for thin_hs_."""
    pure_python = True
    def __call__(self):
        return _thinning.thin_hs(self)

class thin_hs_large_image(Thinning):
    """
    Thins (skeletonizes) a ONEBIT image using the Haralick and Shapiro
    algorithm.

    Unlike thin_hs_, this algorithm performs skeletonization on one
    connected component at a time.  On large images with a lot of
    connected components, this can be significantly faster.  However,
    for small images with a single connected component, this has
    unnecessary overhead, which is why both versions are included.
    Please note cc_analysis results in a labelled image, which you can
    reset afterwards with reset_onebit_image().
    """
    pure_python = True
    def __call__(self):
        copy = self.image_copy()
        ccs = copy.cc_analysis()
        for cc in ccs:
            thin_cc = cc.thin_hs()
            cc.and_image(thin_cc, in_place=True)
        return copy
    __call__ = staticmethod(__call__)

class medial_axis_transform_large_image_hs(Thinning):
    """
    This function is an alias for thin_hs_large_image_.
    """
    pure_python = True
    def __call__(self):
        return thin_hs_large_image()(self)

class thin_lc(Thinning):
    """
    Thins (skeletonizes) a ONEBIT image using the Lee and Chen
    algorithm.

    This function is a simple extension to the Zhang and Suen
    algorithm in thin_zs_ that ensure that no two pixels are more than
    4-connected.
    
    The resulting skeleton is not a medial axis transformation, and
    the ends of the skeleton will not extend to the edges of the
    original image.

    H.-J. Lee and B. Chen. 1992.  Recognition of handwritten chinese
    characters via short line segments. *Pattern Recognition*. 25(5)
    543-552.
    """
    pass

class ThinningModule(PluginModule):
    category = "Thinning"
    functions = [thin_zs, thin_hs, medial_axis_transform_hs,
                 thin_hs_large_image, medial_axis_transform_large_image_hs,
                 thin_lc]
    cpp_headers = ["thinning.hpp"]
    author = u"Michael Droettboom and Karl MacMillan (based on code by \u00d8ivind Due Trier and Qian Huang)"
    url = "http://gamera.sourceforge.net/"
module = ThinningModule()

del Thinning