1 | /* |
---|
2 | * Speeded-Up Robust Features (SURF) |
---|
3 | * http://people.ee.ethz.ch/~surf |
---|
4 | * |
---|
5 | * Authors: Herbert Bay, Andreas Ess, Geert Willems |
---|
6 | * Windows port by Stefan Saur |
---|
7 | * |
---|
8 | * Copyright (2006): ETH Zurich, Switzerland |
---|
9 | * Katholieke Universiteit Leuven, Belgium |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * For details, see the paper: |
---|
13 | * Herbert Bay, Tinne Tuytelaars, Luc Van Gool, |
---|
14 | * "SURF: Speeded Up Robust Features" |
---|
15 | * Proceedings of the ninth European Conference on Computer Vision, May 2006 |
---|
16 | * |
---|
17 | * Permission to use, copy, modify, and distribute this software and |
---|
18 | * its documentation for educational, research, and non-commercial |
---|
19 | * purposes, without fee and without a signed licensing agreement, is |
---|
20 | * hereby granted, provided that the above copyright notice and this |
---|
21 | * paragraph appear in all copies modifications, and distributions. |
---|
22 | * |
---|
23 | * Any commercial use or any redistribution of this software |
---|
24 | * requires a license from one of the above mentioned establishments. |
---|
25 | * |
---|
26 | * For further details, contact Andreas Ess (aess@vision.ee.ethz.ch). |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef __IMAGE_H |
---|
30 | #define __IMAGE_H |
---|
31 | |
---|
32 | namespace surf { |
---|
33 | |
---|
34 | class Image { |
---|
35 | |
---|
36 | public: |
---|
37 | //! Constructor |
---|
38 | Image(const int w, const int h); |
---|
39 | |
---|
40 | //! Destructor |
---|
41 | ~Image(); |
---|
42 | |
---|
43 | //! Constructor from existing double array |
---|
44 | Image(double **pixels, int w, int h); |
---|
45 | |
---|
46 | //! constructor for integral image |
---|
47 | Image(Image *im, bool doubleImSize=false); |
---|
48 | |
---|
49 | //! Pass a single frame to the (pre-initialized) structure |
---|
50 | void setFrame(unsigned char *im); |
---|
51 | void setFrame(Image *im); |
---|
52 | |
---|
53 | //! Divide the image size by two |
---|
54 | Image *HalfImage(); |
---|
55 | |
---|
56 | //! Get Hessian response at a certain point |
---|
57 | double getHessian(int *x); |
---|
58 | |
---|
59 | //! Get Trace of the Hessian |
---|
60 | int getTrace(int *x); |
---|
61 | |
---|
62 | //! Get the pointer to the image pixels |
---|
63 | double **getPixels() const; |
---|
64 | |
---|
65 | //! Get the pixel intensity at location (\a x, \a y) |
---|
66 | double getPix(const int x, const int y) const { |
---|
67 | return _pixels[y][x]; |
---|
68 | } |
---|
69 | |
---|
70 | //! Overload of getPix returning the reference |
---|
71 | double &getPix(const int x, const int y) { |
---|
72 | return _pixels[y][x]; |
---|
73 | } |
---|
74 | |
---|
75 | //! Set the Pixel at location (\a x, \a y) to the value "\a val" |
---|
76 | void setPix(const int x, const int y, const double val) { |
---|
77 | _pixels[y][x] = val; |
---|
78 | } |
---|
79 | |
---|
80 | //! get width |
---|
81 | int getWidth(); |
---|
82 | |
---|
83 | //! get height |
---|
84 | int getHeight(); |
---|
85 | |
---|
86 | //! set width |
---|
87 | void setWidth(int wi); |
---|
88 | |
---|
89 | //! set height |
---|
90 | void setHeight(int hi); |
---|
91 | |
---|
92 | protected: |
---|
93 | //! Allocate 2D array of image pixels |
---|
94 | void allocPixels(int w, int h); |
---|
95 | |
---|
96 | private: |
---|
97 | //! Actual image buffer |
---|
98 | double *_buf; |
---|
99 | |
---|
100 | //! 2D array of image pixels |
---|
101 | double **_pixels; |
---|
102 | |
---|
103 | //! Image height and width |
---|
104 | int _height, _width; |
---|
105 | |
---|
106 | //! Original image height |
---|
107 | int _orihi; |
---|
108 | |
---|
109 | //! Flag if this image is just a reference |
---|
110 | bool _ref; |
---|
111 | }; |
---|
112 | |
---|
113 | } |
---|
114 | |
---|
115 | #endif //IMAGE_H |
---|