Detecting playing cards by separating each card in the image

29 ビュー (過去 30 日間)
ROHIT AILA 2016 年 9 月 24 日
編集済み: ROHIT AILA 2016 年 9 月 24 日

I am working on a project that detects playing cards in a poker game. I will have three cards on the table and i have to separate each card and save them as a separate image so that i can do template matching or SIFT on them. Can anyone tell me how to do this? All i have done till now is threshold the image, use sobel edge detector on the thresholded image, dilate the image and apply hough transform to the image.


Image Analyst
Image Analyst 2016 年 9 月 24 日
編集済み: Image Analyst 2016 年 9 月 24 日
Please show the original image.
If the background behind the cards is a different color than the cards, like black background and white cards, then you can simply threshold, call imfill, and label then use ismember to create a mask for each card.
backgroundMask = ....... % Do color segmentation.
allCardsMask = imfill(~backgroundMask, 'holes');
% Extract only the 3 largest blobs
allCardsMask = bwareafilt(allCardsMask, 3);
labeledImage = bwlabel(allCardsMask);
cardMask1 = ismember(allCardsMask, 1);
cardMask2 = ismember(allCardsMask, 2);
cardMask3 = ismember(allCardsMask, 3);
Your edge detection method could have a lot of problems if your edges are not completely connected, like in the upper right corner of your card on the right.
To identify the cards, you might use SIFT but a simpler way might be to simply count the number of colored pixels on each card in each color channel. It could be that every card has a unique count for R, G, and B. Then you could simply look up that number in a lookup table that you've filled up in advance with the "official" counts for each card. This would probably be far simpler than SIFT or SURF.

その他の回答 (0 件)


Find more on Card games in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by