@@ -238,27 +238,4 @@ def drawBoxesOnGray(image, tableHit, boxThickness=2, boxColor=255, showLabel=Fal
238
238
cv2 .rectangle (outImage , (x , y ), (x + w , y + h ), color = boxColor , thickness = boxThickness )
239
239
if showLabel : cv2 .putText (outImage , text = row ['TemplateName' ], org = (x , y ), fontFace = cv2 .FONT_HERSHEY_SIMPLEX , fontScale = labelScale , color = labelColor , lineType = cv2 .LINE_AA )
240
240
241
- return outImage
242
-
243
-
244
- if __name__ == '__main__' :
245
- from skimage .data import coins
246
- import matplotlib .pyplot as plt
247
-
248
- ## Get image and templates by cropping
249
- smallCoin = coins ()[37 :37 + 38 , 80 :80 + 41 ]
250
- bigCoin = coins ()[14 :14 + 59 ,302 :302 + 65 ]
251
- image = coins ()
252
-
253
- ## Perform matching
254
- #tableHit = matchTemplates([('small', smallCoin), ('big', bigCoin)], image, score_threshold=0.6, method=cv2.TM_CCOEFF_NORMED, maxOverlap=0) # Correlation-score
255
- tableHit = matchTemplates ([('small' , smallCoin ), ('big' , bigCoin )], image , score_threshold = 0.4 , method = cv2 .TM_SQDIFF_NORMED , maxOverlap = 0 ) # Difference-score
256
-
257
- print ("Found {} coins" .format (len (tableHit )))
258
-
259
- print (tableHit )
260
-
261
-
262
- ## Display matches
263
- Overlay = drawBoxesOnRGB (image , tableHit , showLabel = True )
264
- plt .imshow (Overlay )
241
+ return outImage
0 commit comments