How to isolate everything inside of a contour, scale it, and test the similarity to an image?

I’m working on a project just for fun, and my goal is to play online poker and have the program identify the cards that are on the table. I am using OpenCV with python to isolate the area where the cards are going to be. I have been able to take an image of that area, grayscale and threshold it, and draw a contour around the edge of the card. I am now stuck on how to move forward.

Add an image in a specific position in the document (.docx)?

I use Python-docx to generate Microsoft Word document.The user want that when he write for eg: “Good Morning every body,This is my %(profile_img)s do you like it?”
in a HTML field, i create a word document and i recuper the picture of the user from the database and i replace the key word %(profile_img)s by the picture of the user NOT at the END OF THE DOCUMENT. With Python-docx we use this instruction to add a picture: