def test_cropping(): entire_screen_pil = Image.open( os.path.join(get_dir('tests', 'screenshots'), '53269218_PreFlop_0.png')) top_left_corner = get_table_template_image("PartyPoker Old", 'topleft_corner') img = cv2.cvtColor(np.array(entire_screen_pil), cv2.COLOR_BGR2RGB) find_template_on_screen(top_left_corner, img, 0.01)
def test_cropping(): entire_screen_pil = Image.open( os.path.join(get_dir('tests', 'screenshots'), '173280759_PreFlop_0.png')) top_left_corner = get_table_template_image( "PartyPoker 6 Players Fast Forward $1-$2 NL Hold'em", 'topleft_corner') img = cv2.cvtColor(np.array(entire_screen_pil), cv2.COLOR_BGR2RGB) find_template_on_screen(top_left_corner, img, 0.01)
def load_topleft_corner(self): self.table_name = self.ui.table_name.currentText() log.info(f"Load top left corner for {self.table_name}") try: self.top_left_corner_img = get_table_template_image(self.table_name, 'topleft_corner') except KeyError: log.error("No top left corner saved yet. " "Please mark a top left corner and click on the save newly selected top left corner.")
def test_crop_func(): entire_screen_pil = Image.open( os.path.join(get_dir('tests', 'screenshots'), '53269218_PreFlop_0.png')) top_left_corner = get_table_template_image("PartyPoker Old", 'topleft_corner') cropped = crop_screenshot_with_topleft_corner(entire_screen_pil, top_left_corner) assert cropped
def test_crop_func(): entire_screen_pil = Image.open( os.path.join(get_dir('tests', 'screenshots'), '173280759_PreFlop_0.png')) top_left_corner = get_table_template_image( "PartyPoker 6 Players Fast Forward $1-$2 NL Hold'em", 'topleft_corner') cropped = crop_screenshot_with_topleft_corner(entire_screen_pil, top_left_corner) assert cropped
def save_topleft_corner(self): self.table_name = self.ui.table_name.currentText() log.info(f"Load top left corner for {self.table_name}") try: self.top_left_corner_img = get_table_template_image(self.table_name, 'topleft_corner') resp = pop_up("Are you sure?", "You already defined a top left corner for this table before. " "You will need to enter all buttons (but not images) again if you have already saved" "coordinates for any other items.", ok_cancel=True) if resp == 1024: self.save_image('topleft_corner') except KeyError: # no top left corner yet, continue self.save_image('topleft_corner')