Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PGMImage.h
Go to the documentation of this file.
1 /* Import from Gabor API
2 
3 Copyright (c) 2002-3 Adriaan Tijsseling
4 
5 
6  All Rights Reserved
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 /*
23  Description: class for reading and storing pgm images
24  Author: Adriaan Tijsseling ( AGT )
25  Copyright: ( c ) Copyright 2002-3 Adriaan Tijsseling. All rights reserved.
26 */
27 
28 #ifndef __PGM_IMAGE_CLASS__
29 #define __PGM_IMAGE_CLASS__
30 
31 #include "ImageFile.h"
32 #include <cstring>
33 
34 namespace celeste
35 {
36 class PGMImage : public ImageFile
37 {
38 public:
39 
40  PGMImage(){};
41  explicit PGMImage( char* file ) { Read( file ); }
42  virtual ~PGMImage(){};
43 
44  // Read a PGM image from a file
45  int Read( char* );
46 
47  // Write a PGM image in a file
48  void Write( char* );
49  void Write( char*, float**, int, int );
50  void Write( char*, float***, int, int );
51  void Write( char*, float**, int, int, int );
52  void WriteScaled( char* filename, float** output, int height, int width );
53 
54 private:
55  char mMagicNumber[2];
56  int mNumPixels; // Total number of pixels (mHeight x mWidth)
58  int mNumBits;
59 };
60 }; //namespace
61 #endif // __PGM_IMAGE_CLASS__
virtual ~PGMImage()
Definition: PGMImage.h:42
char mMagicNumber[2]
Definition: PGMImage.h:55
int Read(char *)
Definition: PGMImage.cpp:34
void Write(char *)
Definition: PGMImage.cpp:190
void WriteScaled(char *filename, float **output, int height, int width)
Definition: PGMImage.cpp:334
PGMImage(char *file)
Definition: PGMImage.h:41