-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
88 lines (67 loc) · 2.26 KB
/
main.cpp
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
88
/*
* Aditya Dhulipala
* MediaQueires
*/
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include "Frame.h"
#include "SceneDetector.cpp"
using namespace std;
cv::Mat src; cv::Mat dst;
void testMyImage();
void testSceneDetector();
int main( int argc, char** argv )
{
/// Load the source image
src = cv::imread( "../../Resources/fruits.jpg", 1 );
testMyImage();
testSceneDetector();
//cv::namedWindow( window_name1, cv::WINDOW_AUTOSIZE );
//imshow("Unprocessed Frame",src);
dst = src.clone();
GaussianBlur( src, dst, cv::Size( 15, 15 ), 0, 0 );
//cv::namedWindow( window_name2, cv::WINDOW_AUTOSIZE );
//imshow("Processed Frame",dst);
cv::waitKey();
return 0;
}
void testSceneDetector() {
// setup
Frame img1, img2;
int width = 352;
int height = 288;
string s1 = "../../Resources/StarCraft179.rgb";
string s2 = "../../Resources/StarCraft179.rgb";
img1.setWidth(width);
img1.setHeight(height);
img2.setWidth(width);
img2.setHeight(height);
img1.setImagePath(s1.c_str());
img2.setImagePath(s2.c_str());
img1.ReadImage();
img2.ReadImage();
// test - without GPU methods
string suffix = " for " + s1.substr(16) + " & " + s2.substr(16);
cout << "ECR = " << computeECR(&img1, &img2) << suffix << endl;
imshow(s1.substr(16) + " f1", img1.getMatData());
imshow(s2.substr(16) + " f2", img2.getMatData());
// // test - using GPU methods
// // REQUIRES OpenCV built with GPU support - http://stackoverflow.com/questions/12910902/opencv-error-no-gpu-support-library-is-compiled-without-cuda-support
// string suffix = " for " + s1.substr(16) + " & " + s2.substr(16);
// cout << "ECR = " << computeECRGpu(&img1, &img2) << suffix << endl;
// imshow(s1.substr(16) + " f1", img1.getMatData());
// imshow(s2.substr(16) + " f2", img2.getMatData());
}
void testMyImage() {
Frame image;
image.setHeight(288);
image.setWidth(352);
image.setImagePath("../../Resources/StarCraft180.rgb");
image.ReadImage();
char *img;
img = image.getImageData();
std::cout << "Hello from testMyImage()" << std::endl;
cv::Mat TempMat = cv::Mat(288, 352, CV_8UC3, img);
imshow("this is a test",TempMat);
}