-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEdgeDetection-image.h
87 lines (62 loc) · 1.36 KB
/
EdgeDetection-image.h
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
#ifndef IMAGE_H_
#define IMAGE_H_
//Adding header files
#include <iostream>
#include <math.h>
#include <fstream>
#include <vector>
#include <sstream>
#include <time.h>
using namespace std;
//Creating image class (base class)
class Image{
public:
Image():
height(0),
width(0),
maxPixelValue(0),
minpix(0),
maxpix(0),
imageSize(0){}
virtual ~Image(){}
virtual void readImage(ifstream &inFile) = 0;
virtual void writeImage(ofstream &outFile) = 0;
void readHeader(ifstream &inFile);
void scaleImage();
void edgeDection();
//Accessor methods
int getHeight(){return height;}
int getWidth(){return width;}
int getMaxPixelValue(){return maxPixelValue;}
//Mutator methods
void setHeight(int h){height = h;}
void setWidth(int w){width = w;}
void setMaxPixelValue(int mpv){maxPixelValue = mpv;}
//Member variables
protected:
int height;
int width;
int maxPixelValue;
int minpix;
int maxpix;
unsigned int imageSize;
vector<int>pixels;
inline void findMin();
inline void findMax();
};
//Binary image class (derived class)
class BinaryImage: public Image{
public:
BinaryImage(){}
~BinaryImage(){}
void readImage(ifstream &inFile);
void writeImage(ofstream &outFile);
};
class AsciiImage: public Image{
public:
AsciiImage(){}
~AsciiImage(){}
void readImage(ifstream &infile);
void writeImage(ofstream &outFile);
};
#endif /* IMAGE_H_ */