private void ProcessCommunityCardActions(Bitmap screenshot) { /* If community cards are supported, try to match them */ if (colorMap.SupportsCommunityCards) { List <Bitmap> communityCardImages = new List <Bitmap>(); ArrayList communityCardsActions = colorMap.GetCommunityCardsActions(); foreach (String action in communityCardsActions) { Rectangle actionRect = recognitionMap.GetRectangleFor(action); if (!actionRect.Equals(Rectangle.Empty)) { communityCardImages.Add(ScreenshotTaker.Slice(screenshot, actionRect)); } else { Globals.Director.WriteDebug("Warning: could not find a rectangle for action " + action); } } // We try to identify as many cards as possible CardList communityCards = matcher.MatchCards(communityCardImages, true, communityCardsActions, table.MatchHistogramThreshold(), table.MatchTemplateThreshold(), table.AllowableMatchTemplateThreshold() ); if (communityCards != null && communityCards.Count > 0) { //Globals.Director.WriteDebug("~~~ Matched board cards! " + communityCards.ToString()); handler.BoardRecognized(communityCards); } else { Globals.Director.WriteDebug("~~~ Warning: could not find a commnity cards "); } // Dispose foreach (Bitmap image in communityCardImages) { if (image != null) { image.Dispose(); } } } }