21
21
},
22
22
"colab" : {
23
23
"name" : " 3-Features.ipynb" ,
24
- "provenance" : [],
25
- "toc_visible" : true
24
+ "provenance" : []
26
25
}
27
26
},
28
27
"cells" : [
50
49
},
51
50
{
52
51
"cell_type" : " code" ,
53
- "execution_count" : 0 ,
54
52
"metadata" : {
55
- "colab" : {},
56
53
"colab_type" : " code" ,
57
54
"deletable" : true ,
58
55
"editable" : true ,
59
- "id" : " _8B7e-Rn5NY_"
56
+ "id" : " _8B7e-Rn5NY_" ,
57
+ "colab" : {}
60
58
},
61
- "outputs" : [],
62
59
"source" : [
63
60
" # Download the test image and utils files\n " ,
64
61
" !wget --no-check-certificate \\\n " ,
82
79
" \n " ,
83
80
" \n " ,
84
81
" input_image=cv2.imread('noidea.jpg')"
85
- ]
82
+ ],
83
+ "execution_count" : 0 ,
84
+ "outputs" : []
86
85
},
87
86
{
88
87
"cell_type" : " markdown" ,
99
98
},
100
99
{
101
100
"cell_type" : " code" ,
102
- "execution_count" : 0 ,
103
101
"metadata" : {
104
- "colab" : {},
105
102
"colab_type" : " code" ,
106
103
"deletable" : true ,
107
104
"editable" : true ,
108
- "id" : " JdU2qm635NZC"
105
+ "id" : " JdU2qm635NZC" ,
106
+ "colab" : {}
109
107
},
110
- "outputs" : [],
111
108
"source" : [
112
109
" harris_test=input_image.copy()\n " ,
113
110
" #greyscale it\n " ,
125
122
" #we then plot these on the input image for visualisation purposes, using bright red\n " ,
126
123
" harris_test[dst>0.01*dst.max()]=[0,0,255]\n " ,
127
124
" plt.imshow(cv2.cvtColor(harris_test, cv2.COLOR_BGR2RGB))"
128
- ]
125
+ ],
126
+ "execution_count" : 0 ,
127
+ "outputs" : []
129
128
},
130
129
{
131
130
"cell_type" : " markdown" ,
142
141
},
143
142
{
144
143
"cell_type" : " code" ,
145
- "execution_count" : 0 ,
146
144
"metadata" : {
147
- "colab" : {},
148
145
"colab_type" : " code" ,
149
146
"deletable" : true ,
150
147
"editable" : true ,
151
- "id" : " 7z0RTbtO5NZF"
148
+ "id" : " 7z0RTbtO5NZF" ,
149
+ "colab" : {}
152
150
},
153
- "outputs" : [],
154
151
"source" : [
155
152
" plt.imshow(dst,cmap = 'gray') \n "
156
- ]
153
+ ],
154
+ "execution_count" : 0 ,
155
+ "outputs" : []
157
156
},
158
157
{
159
158
"cell_type" : " markdown" ,
182
181
},
183
182
{
184
183
"cell_type" : " code" ,
185
- "execution_count" : 0 ,
186
184
"metadata" : {
187
- "colab" : {},
188
185
"colab_type" : " code" ,
189
186
"deletable" : true ,
190
187
"editable" : true ,
191
- "id" : " DXu8K_FJ5NZI"
188
+ "id" : " DXu8K_FJ5NZI" ,
189
+ "colab" : {}
192
190
},
193
- "outputs" : [],
194
191
"source" : [
195
192
" orbimg=input_image.copy()\n " ,
196
193
" \n " ,
203
200
" cv2.drawKeypoints(orbimg,kp,orbimg)\n " ,
204
201
" \n " ,
205
202
" plt.imshow(cv2.cvtColor(orbimg, cv2.COLOR_BGR2RGB))"
206
- ]
203
+ ],
204
+ "execution_count" : 0 ,
205
+ "outputs" : []
207
206
},
208
207
{
209
208
"cell_type" : " markdown" ,
222
221
},
223
222
{
224
223
"cell_type" : " code" ,
225
- "execution_count" : 0 ,
226
224
"metadata" : {
227
- "colab" : {},
228
225
"colab_type" : " code" ,
229
226
"deletable" : true ,
230
227
"editable" : true ,
231
- "id" : " xyjEKvnK5NZK"
228
+ "id" : " xyjEKvnK5NZK" ,
229
+ "colab" : {}
232
230
},
233
- "outputs" : [],
234
231
"source" : [
235
232
" img2match=np.zeros(input_image.shape,np.uint8)\n " ,
236
233
" dogface=input_image[60:250, 70:350] # copy out a bit\n " ,
237
234
" img2match[60:250,70:350]=[0,0,0] # blank that region\n " ,
238
235
" dogface=cv2.flip(dogface,0) #flip the copy\n " ,
239
236
" img2match[200:200+dogface.shape[0], 200:200+dogface.shape[1]]=dogface # paste it back somewhere else\n " ,
240
237
" plt.imshow(cv2.cvtColor(img2match, cv2.COLOR_BGR2RGB))"
241
- ]
238
+ ],
239
+ "execution_count" : 0 ,
240
+ "outputs" : []
242
241
},
243
242
{
244
243
"cell_type" : " markdown" ,
258
257
},
259
258
{
260
259
"cell_type" : " code" ,
261
- "execution_count" : 0 ,
262
260
"metadata" : {
263
- "colab" : {},
264
261
"colab_type" : " code" ,
265
262
"deletable" : true ,
266
263
"editable" : true ,
267
- "id" : " a8pk6NeP5NZN"
264
+ "id" : " a8pk6NeP5NZN" ,
265
+ "colab" : {}
268
266
},
269
- "outputs" : [],
270
267
"source" : [
271
268
" \n " ,
272
269
" kp2 = orb.detect(img2match,None)\n " ,
284
281
" oimg = cv2.drawMatches(orbimg,kp,img2match,kp2,matches[:50], orbimg)\n " ,
285
282
" \n " ,
286
283
" plt.imshow(cv2.cvtColor(oimg, cv2.COLOR_BGR2RGB))\n "
287
- ]
284
+ ],
285
+ "execution_count" : 0 ,
286
+ "outputs" : []
288
287
},
289
288
{
290
289
"cell_type" : " markdown" ,
301
300
" [here](https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_feature_homography/py_feature_homography.html)"
302
301
]
303
302
},
304
- {
305
- "cell_type" : " code" ,
306
- "execution_count" : 0 ,
307
- "metadata" : {
308
- "colab" : {},
309
- "colab_type" : " code" ,
310
- "deletable" : true ,
311
- "editable" : true ,
312
- "id" : " mfFgK2Ru5NZQ"
313
- },
314
- "outputs" : [],
315
- "source" : [
316
- " "
317
- ]
318
- },
319
303
{
320
304
"cell_type" : " markdown" ,
321
305
"metadata" : {
325
309
"source" : [
326
310
" [Previous](2-Image_stats_and_image_processing.ipynb) [Next](4-Cascade_classification.ipynb)"
327
311
]
328
- },
329
- {
330
- "cell_type" : " code" ,
331
- "execution_count" : null ,
332
- "metadata" : {},
333
- "outputs" : [],
334
- "source" : []
335
312
}
336
313
]
337
- }
314
+ }
0 commit comments