00001 /* Import from Gabor API 00002 00003 Copyright (c) 2002-3 Adriaan Tijsseling 00004 00005 00006 All Rights Reserved 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /* 00023 Description: class for reading and storing pgm images 00024 Author: Adriaan Tijsseling ( AGT ) 00025 Copyright: ( c ) Copyright 2002-3 Adriaan Tijsseling. All rights reserved. 00026 */ 00027 00028 #ifndef __PGM_IMAGE_CLASS__ 00029 #define __PGM_IMAGE_CLASS__ 00030 00031 #include "ImageFile.h" 00032 #include <cstring> 00033 00034 namespace celeste 00035 { 00036 class PGMImage : public ImageFile 00037 { 00038 public: 00039 00040 PGMImage(){}; 00041 PGMImage( char* file ) { Read( file ); } 00042 virtual ~PGMImage(){}; 00043 00044 // Read a PGM image from a file 00045 int Read( char* ); 00046 00047 // Write a PGM image in a file 00048 void Write( char* ); 00049 void Write( char*, float**, int, int ); 00050 void Write( char*, float***, int, int ); 00051 void Write( char*, float**, int, int, int ); 00052 void WriteScaled( char* filename, float** output, int height, int width ); 00053 00054 private: 00055 char mMagicNumber[2]; 00056 int mNumPixels; // Total number of pixels (mHeight x mWidth) 00057 int mNumLevels; 00058 int mNumBits; 00059 }; 00060 }; //namespace 00061 #endif // __PGM_IMAGE_CLASS__
1.3.9.1