-
Notifications
You must be signed in to change notification settings - Fork 7
/
pbmimage.h
54 lines (42 loc) · 1.46 KB
/
pbmimage.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
#ifndef PBMIMAGE_H_
#define PBMIMAGE_H_
#include <set>
#include "fltimage.h"
class flt_image_t;
class pbm_image_t;
class pbm_image_t {
public:
pbm_image_t(int w, int h);
pbm_image_t(char *filename);
~pbm_image_t();
void flip(int x, int y);
void flip(int x, int y, int wx, int wy);
void set(int x, int y, int val);
int diff(const pbm_image_t &p);
std::set<std::pair<int,int > > contour_bits();
void pick_adjacent_bit(int *x, int *y) const;
bool is_iso_region(int x, int y, int wx, int wy) const;
void pick_iso_region(int *x, int *y, int xw, int yw) const;
void pick_iso_region(int *x, int *y, int wx, int wy,const pbm_image_t &diff, int range) const;
void pick_on_bit(int *x, int *y) const;
void invert();
void single_convolve(const pbm_image_t &src,const flt_image_t &k, int x, int y);
void incremental_convolve(const pbm_image_t &src,const flt_image_t &k, int x, int y, int wx, int wy);
void convolve(const pbm_image_t &src,const flt_image_t &k);
void save(char *filename);
void diff(const pbm_image_t &p1,const pbm_image_t &p2);
int count() const;
int complexity() const;
int singleton(int x, int y) const;
int neighbors(int x, int y) const;
int get(int x, int y) const;
int get_extended(int x, int y) const;
int get_height() const { return(height); };
int get_width() const { return(width); };
pbm_image_t &operator=(const pbm_image_t& f);
private:
int width, height;
int widthbytes;
unsigned char ** image;
};
#endif