Anyway to count poker chip stacks?

7 views (last 30 days)
Rafael Peres
Rafael Peres on 9 Feb 2016
Commented: Image Analyst on 9 Feb 2016
Hi, does anyone have an idea on how to count, how many stacks there are in this image, or even better, count how many chips. I've been searching all around the forums here, and still didnt get a way to do this.
Thanks.

Answers (1)

Image Analyst
Image Analyst on 9 Feb 2016
Have columns where each stack may start and stop, like 10 of them for 5 possible stacks. Then extract each column and take the min horizontally. Then call find() to find out where the top and bottom of each stack is. Measure the height divide by the known height of a single chip. Then you need to take special care for when there are no chips at all - topTow will be empty in that case. Here is some code to get you started. Finish it, and/or come back with modified code if you still need help.
rgbImage = imread(filename);
grayImage = min(rgbImage, [], 3);
% Define columns(5, 2) for starting and stopping columns for each of the 5 possible places.
for k = 1 : 5
thisStack = grayImage(:, columns(k,1):columns(k,2));
verticalProfile = min(thisStack, [], 2);
topRow = find(verticalProfile < someValue, 1, 'first');
bottomRow = find(verticalProfile < someValue, 1, 'last');
numberOfChips(k) = (bottomRow-topRow) / rowsForOneChip;
end
  6 Comments
Rafael Peres
Rafael Peres on 9 Feb 2016
Oh, thank you very much, sorry again, image processing isn't my area, i'm just starting to learn something with the tutorials given by matlab.
Image Analyst
Image Analyst on 9 Feb 2016
You're welcome. If an Answer solves your question, you can click "Accept this answer" to give the answerer "credit" for the help.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!