Hugin trunk 0.1
Loading...
Searching...
No Matches
ImageFile.h
Go to the documentation of this file.
1/* Import from Gabor API
2
3Copyright (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: Abstract class for reading and storing images
24 Original Author: Mickael Pic
25 Modifications by: Adriaan Tijsseling (AGT)
26*/
27
28#ifndef __IMAGE_FILE_CLASS__
29#define __IMAGE_FILE_CLASS__
30
31#include <iostream>
32#include <fstream>
33#include <string>
34#include <math.h>
35#include <stdio.h>
36#include <stdlib.h>
37
38namespace celeste
39{
40enum
41{
42 kChars = 0x01,
43 kFloats = 0x02,
44 kRGB = 0x04
45};
46
48{
49public:
50
51 ImageFile();
52 virtual ~ImageFile();
53
54 // set or get width of image
55 inline void SetWidth( int w ) { mWidth = w; }
56 inline int GetWidth() { return mWidth; }
57
58 // set or get height of image
59 inline void SetHeight( int h ){ mHeight = h; }
60 inline int GetHeight(){ return mHeight; }
61
62 // set or get one single pixel
63 inline void SetPixel( int x, int y, unsigned char p ) { if ( mPixels != NULL ) mPixels[x][y] = p; }
64 unsigned char GetPixel( int x, int y );
65
66 // set or get pixels
67 inline int*** GetRGBPixels( void ) { return mRGB; }
68 void SetPixels( float** );
69 float** GetPixels( void );
70
71 // allocate pixelmap
72 void Allocate( int dataset );
73 void Deallocate();
74
75 // read to or write image from file
76 virtual int Read( char* ) = 0;
77 virtual void Write( char* ) = 0;
78
79protected:
80
81 int*** mRGB; // rgb pixels
82 unsigned char** mPixels; // pixel storage
83 float** mFloats; // converted to floats
84 int mWidth; // image width
85 int mHeight; // image height
86 bool mVerbosity; // verbosity level
87
88 };
89}//namespace
90#endif
unsigned char ** mPixels
Definition ImageFile.h:82
virtual ~ImageFile()
Definition ImageFile.cpp:43
void SetHeight(int h)
Definition ImageFile.h:59
unsigned char GetPixel(int x, int y)
float ** GetPixels(void)
int *** GetRGBPixels(void)
Definition ImageFile.h:67
virtual void Write(char *)=0
void Allocate(int dataset)
Definition ImageFile.cpp:50
virtual int Read(char *)=0
void SetPixel(int x, int y, unsigned char p)
Definition ImageFile.h:63
void SetPixels(float **)
void SetWidth(int w)
Definition ImageFile.h:55
@ kFloats
Definition ImageFile.h:43