Skip to content Skip to sidebar Skip to footer

Detect Object By Name Of Card And Crop It Using Opencv

I have a image with ID card, Bank card and signature i want to get id_card.jpg and bank_card.jpg and signature.jpg. The problem ID card and Bank card has the same width and height,

Solution 1:

there's a plenty of things you could do, a good way is to crop the logo at the most top corner of the Mastercard or the id card, and save it as template, than every time you want to check if it's Mastercard you look for a good match between the logo and the image, if you find a good match than this is a MasterCard. Here is a simple code to do a template matching using opencv

image = cv2.imread("scan.jpg")
template  = cv2.imread("masterCardLogo.jpg")
res = cv2.matchTemplate(image,template,cv2.TM_SQDIFF_NORMED)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
if(max_val>0.5):
    print("This is a master Card")

as I mentioned before, there are a lot of other methods, like the following

Post a Comment for "Detect Object By Name Of Card And Crop It Using Opencv"