|
12 | 12 |
|
13 | 13 | #%% Get image and templates by cropping
|
14 | 14 | image = coins()
|
| 15 | + |
15 | 16 | smallCoin = image[37:37+38, 80:80+41]
|
16 | 17 | bigCoin = image[14:14+59,302:302+65]
|
| 18 | +listTemplates = [('small', smallCoin), |
| 19 | + ('big', bigCoin)] |
17 | 20 |
|
18 | 21 |
|
19 | 22 | #%% Perform matching
|
20 | | -tableHit = MTM.matchTemplates([('small', smallCoin), ('big', bigCoin)], image, score_threshold=0.3, method=cv2.TM_CCOEFF_NORMED, maxOverlap=0) # Correlation-score |
21 | | -#tableHit = MTM.matchTemplates([('small', smallCoin), ('big', bigCoin)], image, score_threshold=0.4, method=cv2.TM_SQDIFF_NORMED, maxOverlap=0) # Difference-score |
| 23 | +tableHit = MTM.matchTemplates(listTemplates, image, score_threshold=0.3, method=cv2.TM_CCOEFF_NORMED, maxOverlap=0) # Correlation-score |
| 24 | +#tableHit = MTM.matchTemplates(listTemplates, image, score_threshold=0.4, method=cv2.TM_SQDIFF_NORMED, maxOverlap=0) # Difference-score |
22 | 25 |
|
23 | 26 | print("Found {} coins".format(len(tableHit)))
|
24 | 27 | print(tableHit)
|
|
0 commit comments