-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
95 lines (74 loc) · 1.71 KB
/
main.cpp
File metadata and controls
95 lines (74 loc) · 1.71 KB
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
89
90
91
92
93
94
95
// 24, July, 2017 Digital Image Processing 5th week
// This program was made by Kim Dong Hyun for Studying
// Motion Vector Estimation based on Block Matching Algorithm
#pragma once
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
#include <stack>
#define _USE_MATH_DEFINES
#include <math.h>
#include "motion_vector.h"
using namespace std;
#pragma warning(disable: 4819)
int main(int argc, char** argv)
{
// load image
IplImage* frame1 = cvLoadImage("FOREMAN072.tif", 0);
IplImage* frame2 = cvLoadImage("FOREMAN069.tif", 0);
if (frame1 == NULL)
{
printf(" could not find the image");
return 0;
}
if (frame2 == NULL)
{
printf(" could not find the image");
return 0;
}
cvNamedWindow("frame1", CV_WINDOW_AUTOSIZE);
cvShowImage("frame1", frame1);
display_img_info(frame1);
cvNamedWindow("frame2", CV_WINDOW_AUTOSIZE);
cvShowImage("frame2", frame2);
display_img_info(frame2);
while (1)
{
printf(" (1) Difference \n");
printf(" (2) Block Matching \n");
printf(" (3) Block Matching MSE \n");
printf(" (4) Block Matching 3 Step \n");
int num;
scanf("%d", &num);
switch (num)
{
case 1:
printf(" Get diffrence \n");
get_diff(frame1, frame2);
break;
case 2:
printf(" Block Matching \n");
blockMatching(frame1, frame2);
break;
case 3:
printf(" Block Matching MSE \n");
matchingMSE(frame1, frame2);
break;
case 4:
printf(" Block Matching - 3Step \n");
BMA3step(frame1, frame2);
break;
case 5:
break;
default:
printf(" selected process does not exist\n");
break;
}
}
return 0;
cvDestroyAllWindows();
}