Playing Cards Detection
Playing Cards Detection. Visual recognition of playing cards using OpenCV, Python and Tesseract. Detection and recognition the cards suites. Possibility of integrating existing tests with existing test clouds such as Bitbar, SmartBear, Saucelabs, Browser Stack, Amazon Device Factory and many more.
What is the main goal?
Most of online casinos and gambling providers struggle the real problem with the delivery of their products. Why is it? The reason is the problematic fast testing. Of course that it is caused by that fact, that the games are not easy for the standard test automation. And the approaches, that need to be used are much more complicated and advanced. The topic of playing cards detection and also roulette recognition remains the most popular casino topic in the world of testing.
So, what to do? Just hire more QA engineers? With this approach number of QA engineers will be growing proportionally to the number of the games. It doesn’t sound as the best business strategy. Also, most of the companies have no ideas how to handle this case due to its complexity. Yes, automation testing of the games is not an easy process and requires much more additional skills. Will it be easy to find an appropriate Test automation engineer who will do this? 99% of test engineers are specialising in building automation strategies of standard web and mobile applications, using Appium, Selenium, Cucumber. So, what to do to the game-dev companies?
Here, on Testpic, we developed the framework, specially aimed for testing of casino games.
What we did here?
We have used advanced approaches and techniques of Computer Vision, using OpenCV to recognition and detection the cards of itself. But the recognition of the cards is the only half of the thing. Because the next challenge was to recognise cards values. We have pre-trained own data-set for the most advanced Optical Character Recognition framework called Tesseract version 4.
Testpic provides exceptional highly-qualified test service for the testing of any types of cards games, such as Black Jack, Poker, Spider, Soliter, etc.
Also we have pre-built services for testing of other types of games, such as online racing, shouters, casino slots and many more.
Some code here?
How you can get the contours:
for c in contours:
x, y, w, h = cv2.boundingRect(c)
rect = cv2.minAreaRect(c)
box = cv2.boxPoints(rect)
box = np.int0(box)
angle = int(np.math.fabs(rect[2]))
And this little example will give you understanding how you can cut the characters.
detected_card = th[y:y + h, x:x + w]
detected_name = detected_card[5:int(h / 4), int(5):int(w / 4)]
detected_suit = detected_card[int(h / 4 - 5):int(h / 3 + 3), int(8):int(w / 4 - 5)]Would you like to know more? Contact us and subscribe our page on LinkedIn
Also, we upload our video onto Youtube channel.