forked from ronkashi/SP-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SPImageProc.h
65 lines (58 loc) · 1.83 KB
/
SPImageProc.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
#ifndef SPIMAGEPROC_H_
#define SPIMAGEPROC_H_
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <vector>
extern "C" {
#include "SPConfig.h"
#include "SPPoint.h"
}
namespace sp {
/**
* A class which supports different image processing functionalites.
*/
class ImageProc {
private:
const char* windowName = "Software Project CBIR";
int pcaDim;
int numOfImages;
int numOfFeatures;
cv::PCA pca;
bool minimalGui;
void initFromConfig(const SPConfig);
void getImagesMat(std::vector<cv::Mat>&, const SPConfig);
void getFeatures(std::vector<cv::Mat>&,
cv::Mat&);
void preprocess(const SPConfig config);
void initPCAFromFile(const SPConfig config);
public:
/**
* Creates a new object for the purpose of image processing based
* on the configuration file.
* @param config - the configuration file from which the object is created
*/
ImageProc(const SPConfig config);
/**
* Returns an array of features for the image imagePath. All SPPoint elements
* will have the index given by index. The actual number of features extracted
* for this image will be stored in the pointer given by numOfFeats.
*
* @param imagePath - the target imagePath
* @param index - the index of the image in the database
* @param numOfFeats - a pointer in which the actual number of feats extracted
* will be stored
* @return
* An array of the actual features extracted. NULL is returned in case of
* an error.
*/
SPPoint** getImageFeatures(const char* imagePath,int index,int* numOfFeats);
/**
* Displays the image given by imagePath. Notice that this function works
* only in MinimalGUI mode (otherwise a warnning message is printed).
*
* @param imagePath - the path of the image to be displayed
*/
void showImage(const char* imagePath);
};
}
#endif