This file is indexed.

/usr/include/itpp/srccode/pnm.h is in libitpp-dev 4.3.1-8.

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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
/*!
 * \file
 * \brief Definitions of PNM graphics format I/O function
 * \author
 *
 * -------------------------------------------------------------------------
 *
 * Copyright (C) 1995-2010  (see AUTHORS file for a list of contributors)
 *
 * This file is part of IT++ - a C++ library of mathematical, signal
 * processing, speech processing, and communications classes and functions.
 *
 * IT++ 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.
 *
 * IT++ 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 IT++.  If not, see <http://www.gnu.org/licenses/>.
 *
 * -------------------------------------------------------------------------
 */

#ifndef PNM_H
#define PNM_H

#include <itpp/base/mat.h>
#include <itpp/itexports.h>


namespace itpp
{

/*!
  \addtogroup image

  The PNM graphics format is actually a family of formats consisting of
  PBM (black and white, not implemented yet), PGM (gray) and PPM (RGB color).
  This interface proposes input/output functions for images in the raw
  formats (type 'P4', 'P5' and 'P6').

  There are several utilities available for manipulating PNM images. Search
  the net for the netpbm package.
*/

//--------------------------------------------------------------
// General PNM functions
/*!
  \ingroup image
  \brief Determines the type of a PNM file, based on magic numbers.
  The returned value is a character between '1' and '6'.
  If an error occured, the returned value is the character '0'
  \param filename The name of the file from which the image is retrieved
*/
ITPP_EXPORT char pnm_type(const std::string & filename);

/*!
  \ingroup image
  \brief Retrieve some information about an pnm file
  \param filename The name of the file from which the image is retrieved
  \param pnm_type The type of the pnm file (5: pgm file, 6: ppm file)
  \param width The image width
  \param height The image height
  \param max_val The greatest possible value
  \param comments The comments in the file
*/
ITPP_EXPORT bool pnm_info(const std::string & filename,
              char & pnm_type,
              int & width,
              int & height,
              int & max_val,
              std::string & comments);

//--------------------------------------------------------------
// PGM related functions (gray images)
/*!
  \ingroup image
  \brief Read the entire graymap into the matrix \a m or return false if
  the function failed.
  \param filename The name of the file from which the image is retrieved
  \param m The matrix in which the image will be stored
  \param comments This std::string variable is used to retrieve the comments of
  the file
*/
ITPP_EXPORT bool pgm_read(const std::string & filename, imat & m,
              std::string & comments);


/*!
  \ingroup image
  \brief Read a part of the graymap into the matrix \a m.
  \param filename The name of the file from which the image is retrieved
  \param m The matrix in which the image will be stored
  \param r1 first row to be included in the matrix
  \param r2 last row to be included in the matrix
  \param c1 first column to be included in the matrix
  \param c2 last column to be included in the matrix
*/
ITPP_EXPORT bool pgm_read(const std::string & filename, imat &m,
              int r1, int r2, int c1, int c2);


/*!
  \ingroup image
  \brief Read a pgm file of name filename and return the corresponding
  matrix of integers.
  Return a void matrix if an error ocurred.
  \param filename The name of the file from which the image is retrieved
*/
ITPP_EXPORT imat pgm_read(const std::string & filename);


/*!
  \ingroup image
  \brief Create an image file from the matrix of integer
  \param filename The name of the image file to create
  \param m The matrix of integer representing the image
  \param comments Comments included in the file

  Coefficients greater than 255 and smaller than 0 are clipped.
*/
ITPP_EXPORT bool pgm_write(const std::string & filename,
               const imat &m,
               const std::string & comments = "Generated by IT++ (http://itpp.sourceforge.net)");


//--------------------------------------------------------------
// PPM related functions (color images)
/*!
  \ingroup image
  \brief Read the color image file in the format ppm.
  The image is retrieved as a set of three matrices, each of whom is a
  plan of RGB component.
  \param filename The name of the file to be read
  \param r the red component of the image
  \param g the green component of the image
  \param b the blue component of the image
  \param comments a string variable to retrieve the comments
  contained in the file header.
*/
ITPP_EXPORT bool ppm_read(const std::string & filename,
              imat &r, imat &g, imat &b,
              std::string & comments);


/*!
  \ingroup image
  \brief Read the color image file in the PPM format.
  \param filename The name of the file to be read
  \param r the red component of the image
  \param g the green component of the image
  \param b the blue component of the image
*/
ITPP_EXPORT bool ppm_read(const std::string & filename,
              imat &r, imat &g, imat &b);


/*!
  \ingroup image
  \brief Read a part of the pixmap into the matrix \a m.
  The parameters \a r1, \a r2, \a c1 and \a c2 are the rows and columns
  (inclusive) of the subimage.
*/

ITPP_EXPORT bool ppm_read(const std::string & filename,
              imat &r, imat &g, imat &b,
              int r1, int r2, int c1, int c2);

/*!
  \ingroup image
  \brief Write the matrix \a m as a pixmap.
  \param filename The name of the file to create
  \param r the red component of the image
  \param g the green component of the image
  \param b the blue component of the image
  \param comments a comment that will be inserted in the image file
  \param max_val The maximum value of a component. This quantity should be
  lower than 255 (raw type).
*/
ITPP_EXPORT bool ppm_write(const std::string & filename,
               const imat &r,
               const imat &g,
               const imat &b,
               const std::string & comments = "Generated by IT++ (http://itpp.sourceforge.net)",
               int max_val = 255);

/*!
  \ingroup image
  \brief Prepare a matrix of double to be writted as an image
  \param m The matrix of real.
  The components are assumed to be between double_min and double_max,
  and will be scaled by factor \a max_val / (\a double_max - \a double_min )
  in the output matrix.
  \param max_val The maximum value for the output matrix.
  This value is usually set to 255.
  \param double_min The value corresponding to the integer value 0.
  Note that all the values smaller that this quantity will be \a double_min.
  \param double_max The value corresponding to the integer value max_val.
  Similarly to \a double_min, values greater than \a double_max will be
  set to double_max
*/
ITPP_EXPORT imat img_double2int(const mat & m,
                    int max_val = 255,
                    double double_min = 0 ,
                    double double_max = 1);

/*!
  \ingroup image
  \brief Return a matrix of double which is a scaled version of the
  input matrix \a m of integers.
  \param m The matrix of real. The components are assumed to be between 0
  and 1, and will be scaled by factor max_val in the output matrix.
  \param max_val The maximum value for the output matrix.
  This value is usually set to 255.
  \param double_min The value on which the integer value 0 will be mapped
  \param double_max The value on which the integer value \a max_val will
  be mapped
*/
ITPP_EXPORT mat img_int2double(const imat & m,
                   int max_val = 255,
                   double double_min = 0,
                   double double_max = 1);

} // namespace itpp

#endif // #ifndef PNM_H