Detecting playing cards by separating each card in the image

13 次查看(过去 30 天)

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 个)

类别

Help CenterFile Exchange 中查找有关 Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by