質問編集履歴
8
あ
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,6 +35,8 @@
|
|
35
35
|
そもそもプログラム構成前
|
36
36
|
|
37
37
|
|
38
|
+
|
39
|
+
```
|
38
40
|
|
39
41
|
```#include <cv.h>
|
40
42
|
|
@@ -100,6 +102,10 @@
|
|
100
102
|
|
101
103
|
}
|
102
104
|
|
105
|
+
コード
|
106
|
+
|
107
|
+
```
|
108
|
+
|
103
109
|
|
104
110
|
|
105
111
|
|
7
あ
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,73 +100,7 @@
|
|
100
100
|
|
101
101
|
}
|
102
102
|
|
103
|
-
コード
|
104
103
|
|
105
|
-
```
|
106
|
-
|
107
|
-
#include <cv.h>
|
108
|
-
|
109
|
-
#include <highgui.h>
|
110
|
-
|
111
|
-
int main (int argc, char **argv)
|
112
|
-
|
113
|
-
{
|
114
|
-
|
115
|
-
double min_val, max_val;
|
116
|
-
|
117
|
-
CvPoint min_loc, max_loc;
|
118
|
-
|
119
|
-
CvSize dst_size;
|
120
|
-
|
121
|
-
IplImage *src_img, *tmp_img, *dst_img;
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
if (argc != 3 ||
|
126
|
-
|
127
|
-
(src_img = cvLoadImage (argv[1], CV_LOAD_IMAGE_COLOR)) == 0 ||
|
128
|
-
|
129
|
-
(tmp_img = cvLoadImage (argv[2], CV_LOAD_IMAGE_COLOR)) == 0)
|
130
|
-
|
131
|
-
return -1;
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
// 探索画像全体に対して,テンプレートのマッチング値(指定した手法に依存)を計算
|
136
|
-
|
137
|
-
dst_size = cvSize (src_img->width - tmp_img->width + 1, src_img->height - tmp_img->height + 1);
|
138
|
-
|
139
|
-
dst_img = cvCreateImage (dst_size, IPL_DEPTH_32F, 1);
|
140
|
-
|
141
|
-
cvMatchTemplate (src_img, tmp_img, dst_img, CV_TM_CCOEFF_NORMED);
|
142
|
-
|
143
|
-
cvMinMaxLoc (dst_img, &min_val, &max_val, &min_loc, &max_loc, NULL);
|
144
|
-
|
145
|
-
cvRectangle (src_img, max_loc,
|
146
|
-
|
147
|
-
cvPoint (max_loc.x + tmp_img->width, max_loc.y + tmp_img->height), CV_RGB (255, 0, 0), 3);
|
148
|
-
|
149
|
-
cvNamedWindow ("Image", 1);
|
150
|
-
|
151
|
-
cvShowImage ("Image", src_img);
|
152
|
-
|
153
|
-
cvWaitKey (0);
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
cvDestroyWindow ("Image");
|
158
|
-
|
159
|
-
cvReleaseImage (&src_img);
|
160
|
-
|
161
|
-
cvReleaseImage (&tmp_img);
|
162
|
-
|
163
|
-
cvReleaseImage (&dst_img);
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
return 0;
|
168
|
-
|
169
|
-
}
|
170
104
|
|
171
105
|
|
172
106
|
|
6
あ
test
CHANGED
File without changes
|
test
CHANGED
@@ -33,6 +33,72 @@
|
|
33
33
|
|
34
34
|
|
35
35
|
そもそもプログラム構成前
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```#include <cv.h>
|
40
|
+
|
41
|
+
#include <highgui.h>
|
42
|
+
|
43
|
+
int main (int argc, char **argv)
|
44
|
+
|
45
|
+
{
|
46
|
+
|
47
|
+
double min_val, max_val;
|
48
|
+
|
49
|
+
CvPoint min_loc, max_loc;
|
50
|
+
|
51
|
+
CvSize dst_size;
|
52
|
+
|
53
|
+
IplImage *src_img, *tmp_img, *dst_img;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
if (argc != 3 ||
|
58
|
+
|
59
|
+
(src_img = cvLoadImage (argv[1], CV_LOAD_IMAGE_COLOR)) == 0 ||
|
60
|
+
|
61
|
+
(tmp_img = cvLoadImage (argv[2], CV_LOAD_IMAGE_COLOR)) == 0)
|
62
|
+
|
63
|
+
return -1;
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
// 探索画像全体に対して,テンプレートのマッチング値(指定した手法に依存)を計算
|
68
|
+
|
69
|
+
dst_size = cvSize (src_img->width - tmp_img->width + 1, src_img->height - tmp_img->height + 1);
|
70
|
+
|
71
|
+
dst_img = cvCreateImage (dst_size, IPL_DEPTH_32F, 1);
|
72
|
+
|
73
|
+
cvMatchTemplate (src_img, tmp_img, dst_img, CV_TM_CCOEFF_NORMED);
|
74
|
+
|
75
|
+
cvMinMaxLoc (dst_img, &min_val, &max_val, &min_loc, &max_loc, NULL);
|
76
|
+
|
77
|
+
cvRectangle (src_img, max_loc,
|
78
|
+
|
79
|
+
cvPoint (max_loc.x + tmp_img->width, max_loc.y + tmp_img->height), CV_RGB (255, 0, 0), 3);
|
80
|
+
|
81
|
+
cvNamedWindow ("Image", 1);
|
82
|
+
|
83
|
+
cvShowImage ("Image", src_img);
|
84
|
+
|
85
|
+
cvWaitKey (0);
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
cvDestroyWindow ("Image");
|
90
|
+
|
91
|
+
cvReleaseImage (&src_img);
|
92
|
+
|
93
|
+
cvReleaseImage (&tmp_img);
|
94
|
+
|
95
|
+
cvReleaseImage (&dst_img);
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
return 0;
|
100
|
+
|
101
|
+
}
|
36
102
|
|
37
103
|
コード
|
38
104
|
|
5
円
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
[
|
1
|
+
![国旗](17552902ba438e0d4c0c86c0ed72f69f.jpeg)
|
2
2
|
|
3
|
-
[
|
3
|
+
![赤円](d3f027c07ca9f401522509d93e1891a9.png)
|
4
4
|
|
5
5
|
前提・実現したいこと
|
6
6
|
|
4
少し
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[赤円](69cd466fe7821b2be9540f50e429b37c.png)
|
2
|
+
|
3
|
+
[日本国旗](82d839c5132df804a1bd12e73d023e7b.jpeg)
|
4
|
+
|
1
5
|
前提・実現したいこと
|
2
6
|
|
3
7
|
プログラミング初心者です。
|
@@ -20,7 +24,7 @@
|
|
20
24
|
|
21
25
|
〘調べてわかったこと〙
|
22
26
|
|
23
|
-
openCVのマッチングを使う。
|
27
|
+
openCVのマッチングを使う。!
|
24
28
|
|
25
29
|
|
26
30
|
|
3
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,8 +29,6 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
そもそもプログラム構成前
|
32
|
-
|
33
|
-
|
34
32
|
|
35
33
|
コード
|
36
34
|
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,13 +32,11 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
該当のソースコード
|
36
|
-
|
37
|
-
```c++
|
38
|
-
|
39
35
|
コード
|
40
36
|
|
37
|
+
```
|
38
|
+
|
41
|
-
|
39
|
+
#include <cv.h>
|
42
40
|
|
43
41
|
#include <highgui.h>
|
44
42
|
|
@@ -102,7 +100,7 @@
|
|
102
100
|
|
103
101
|
}
|
104
102
|
|
105
|
-
|
103
|
+
|
106
104
|
|
107
105
|
試したこと
|
108
106
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,9 +38,7 @@
|
|
38
38
|
|
39
39
|
コード
|
40
40
|
|
41
|
-
```
|
42
|
-
|
43
|
-
#include <cv.h>
|
41
|
+
```#include <cv.h>
|
44
42
|
|
45
43
|
#include <highgui.h>
|
46
44
|
|