def read_river_card(game_position): """ Example: returns ('Four', 'Spade') table_5th_card = river_card """ query_image = download_table_card(game_position, 5) value_image, suit_image = match_card.pre_process_query_image(query_image, True) river_card = match_card.match_floating_card(value_image, suit_image, True) return river_card[:2]
def read_turn_card(): """ Example: returns ('Four', 'Spade') table_4th_card = turn_card """ query_image = download_table_card(4) value_image, suit_image = match_card.pre_process_query_image(query_image, True) turn_card = match_card.match_floating_card(value_image, suit_image, True) return turn_card[:2]
def read_flop_cards(game_position): """ Example: returns [('Unknown', 'Spade') , ('Queen', 'Club') , ('Two', 'Club')] table_1th_card, table_2th_card, table_3th_card = flop_cards """ flop_cards = [] for xth_card in [1,2,3]: query_image = download_table_card(game_position, xth_card) value_image, suit_image = match_card.pre_process_query_image(query_image, True) result = match_card.match_floating_card(value_image, suit_image, True) flop_cards.append(result[:2]) return flop_cards
def read_my_cards(my_seat): """ Example: returns [('Eight', 'Spade') , ('Ace', 'Club')] my_1th_card, my_2th_card = my_cards """ my_cards = [] for xth_card in [1, 2]: query_image = download_my_card(my_seat, xth_card) value_image, suit_image = match_card.pre_process_query_image( query_image, False) result = match_card.match_floating_card(value_image, suit_image, False) my_cards.append(result[:2]) return my_cards
def read_my_cards(game_position, my_seat): """ Example: returns [('Eight', 'Spade') , ('Ace', 'Club')] my_1th_card, my_2th_card = my_cards """ my_cards = [] for xth_card in [1,2]: query_image = download_my_card(game_position, my_seat , xth_card) value_image, suit_image = match_card.pre_process_query_image(query_image, False) #cv2.imwrite('%s screenshot value_image.png' %xth_card, value_image) #cv2.imwrite('%s screenshot suit_image.png' %xth_card, suit_image) result = match_card.match_floating_card(value_image, suit_image, False) my_cards.append(result[:2]) return my_cards