-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify.cpp
More file actions
87 lines (69 loc) · 1.73 KB
/
Copy pathverify.cpp
File metadata and controls
87 lines (69 loc) · 1.73 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
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
using namespace cv;
/// Global variables
int difference_type = 1;
int const max_type = 3;
Mat orig, res, dst;
const char* window_name = "Threshold Demo";
const char* trackbar_type = "Type: \n 0: bitwise_and \n 1: bitwise_or \n 2: bitwise_or \n 3: bitwise_not";
const char* trackbar_value = "Value";
/// Function headers
void difference( int, void* );
/**
* @function main
*/
int main( int argc, char** argv )
{
/// Load an image
orig = imread( argv[1],CV_LOAD_IMAGE_GRAYSCALE );
res = imread( argv[2],CV_LOAD_IMAGE_GRAYSCALE );
/// Create a window to display results
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
/// Create Trackbar to choose type of Threshold
createTrackbar( trackbar_type,
window_name, &difference_type,
max_type, difference );
// createTrackbar( trackbar_value,
// window_name, &threshold_value,
// max_value, Threshold_Demo );
/// Call the function to initialize
difference( 0, 0 );
/// Wait until user finishes program
while(true)
{
int c;
c = waitKey( 20 );
if( (char)c == 27 )
{ break; }
}
}
/**
* @function Threshold_Demo
*/
void difference( int, void* )
{
/* 0: Binary
1: Binary Inverted
2: Threshold Truncated
3: Threshold to Zero
4: Threshold to Zero Inverted
*/
switch(difference_type){
case 0:
bitwise_and(orig, res, dst);
break;
case 1:
bitwise_or(orig, res, dst);
break;
case 2:
bitwise_xor(orig, res, dst);
break;
case 3:
bitwise_not(orig, dst);
break;
}
imshow( window_name, dst );
}