print float(count) / len(descriptor) # if 50% of the poins matches, write in the bill if float(count) / len(descriptor) >= 0.5: # cv2.putText(img,">>BIG BOX<<", (int(x),int(y)), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255)) cv2.putText(frame, ">>" + bill_name + "<<", bill_center, cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255)) # SURF extraction surf = cv2.xfeatures2d.SURF_create() surf.setHessianThreshold(500) print "opening templates images..." # get the templates # FRONT temp_002_front = glib.readGrayImage("files/template/front/02.jpg") temp_005_front = glib.readGrayImage("files/template/front/05.jpg") temp_010_front = glib.readGrayImage("files/template/front/10.jpg") temp_020_front = glib.readGrayImage("files/template/front/20.jpg") temp_050_front = glib.readGrayImage("files/template/front/50.jpg") temp_100_front = glib.readGrayImage("files/template/front/100.jpg") # BACK temp_002_back = glib.readGrayImage("files/template/back/02.jpg") temp_005_back = glib.readGrayImage("files/template/back/05.jpg") temp_010_back = glib.readGrayImage("files/template/back/10.jpg") temp_020_back = glib.readGrayImage("files/template/back/20.jpg") temp_050_back = glib.readGrayImage("files/template/back/50.jpg") temp_100_back = glib.readGrayImage("files/template/back/100.jpg") # get keypoints and descriptors for each template # FRONT
# if 50% of the poins matches, write in the bill if float(count) / len(descriptor) >= 0.5: # cv2.putText(img,">>BIG BOX<<", (int(x),int(y)), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255)) cv2.putText(frame, ">>" + bill_name + "<<", bill_center, cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255)) # SURF extraction surf = cv2.xfeatures2d.SURF_create() surf.setHessianThreshold(500) print "opening templates images..." # get the templates # FRONT temp_002_front = glib.readGrayImage("files/template/front/02.jpg") temp_005_front = glib.readGrayImage("files/template/front/05.jpg") temp_010_front = glib.readGrayImage("files/template/front/10.jpg") temp_020_front = glib.readGrayImage("files/template/front/20.jpg") temp_050_front = glib.readGrayImage("files/template/front/50.jpg") temp_100_front = glib.readGrayImage("files/template/front/100.jpg") # BACK temp_002_back = glib.readGrayImage("files/template/back/02.jpg") temp_005_back = glib.readGrayImage("files/template/back/05.jpg") temp_010_back = glib.readGrayImage("files/template/back/10.jpg") temp_020_back = glib.readGrayImage("files/template/back/20.jpg") temp_050_back = glib.readGrayImage("files/template/back/50.jpg") temp_100_back = glib.readGrayImage("files/template/back/100.jpg") # get keypoints and descriptors for each template # FRONT
#!/usr/bin/env python from lib import glib # sebir http://www.g7smy.co.uk/?p=366 # open the image in gray scale img_gray = glib.readGrayImage("files/bills/20_02.jpg") # convert img to binary mode, black or white img_bnry = glib.binarize(img_gray) glib.display_image('binary',img_bnry) # get the templates # get keypoints and descriptors for each template # start the video capture # for each frame, # try to match the templates # if one of them matches, # show results, go next frame or next template? #
#!/usr/bin/env python from lib import glib # sebir http://www.g7smy.co.uk/?p=366 # open the image in gray scale img_gray = glib.readGrayImage("files/bills/20_02.jpg") # convert img to binary mode, black or white img_bnry = glib.binarize(img_gray) glib.display_image("binary", img_bnry) # get the templates # get keypoints and descriptors for each template # start the video capture # for each frame, # try to match the templates # if one of them matches, # show results, go next frame or next template? #