-
Notifications
You must be signed in to change notification settings - Fork 16
/
utils.h
63 lines (45 loc) · 2.01 KB
/
utils.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
/***********************************************************
* --- OpenSURF --- *
* This library is distributed under the GNU GPL. Please *
* use the contact form at http://www.chrisevansdev.com *
* for more information. *
* *
* C. Evans, Research Into Robust Visual Features, *
* MSc University of Bristol, 2008. *
* *
************************************************************/
#ifndef UTILS_H
#define UTILS_H
#include <opencv/cv.h>
#include "ipoint.h"
#include <vector>
//! Display error message and terminate program
void error(const char *msg);
//! Show the provided image and wait for keypress
void showImage(const IplImage *img);
//! Show the provided image in titled window and wait for keypress
void showImage(char *title,const IplImage *img);
// Convert image to single channel 32F
IplImage* getGray(const IplImage *img);
//! Draw a single feature on the image
void drawIpoint(IplImage *img, Ipoint &ipt, int tailSize = 0);
//! Draw all the Ipoints in the provided vector
void drawIpoints(IplImage *img, std::vector<Ipoint> &ipts, int tailSize = 0);
//! Draw descriptor windows around Ipoints in the provided vector
void drawWindows(IplImage *img, std::vector<Ipoint> &ipts);
// Draw the FPS figure on the image (requires at least 2 calls)
void drawFPS(IplImage *img);
//! Draw a Point at feature location
void drawPoint(IplImage *img, Ipoint &ipt);
//! Draw a Point at all features
void drawPoints(IplImage *img, std::vector<Ipoint> &ipts);
//! Save the SURF features to file
void saveSurf(char *filename, std::vector<Ipoint> &ipts);
//! Load the SURF features from file
void loadSurf(char *filename, std::vector<Ipoint> &ipts);
//! Round float to nearest integer
inline int fRound(float flt)
{
return (int) floor(flt+0.5f);
}
#endif