コード例 #1
0
def test_crop_func():
    entire_screen_pil = Image.open(os.path.join(get_dir('tests', 'screenshots'), 'test5.png'))
    top_left_corner = get_table_template_image('GG_TEST1', 'topleft_corner')
    # cv2.imshow('image', top_left_corner)
    # cv2.waitKey(0)
    cropped = crop_screenshot_with_topleft_corner(entire_screen_pil, top_left_corner, scale_m=1.0)
    assert cropped
コード例 #2
0
def test_crop_func():
    entire_screen_pil = Image.open(
        os.path.join(get_dir('tests', 'screenshots'), 'screenshot1.png'))
    top_left_corner = get_table_template_image('default', 'topleft_corner')
    cropped = crop_screenshot_with_topleft_corner(entire_screen_pil,
                                                  top_left_corner)
    assert cropped
コード例 #3
0
def test_cropping():
    entire_screen_pil = Image.open(
        os.path.join(get_dir('tests', 'screenshots'), 'screenshot1.png'))
    top_left_corner = get_table_template_image('default', 'topleft_corner')
    img = cv2.cvtColor(np.array(entire_screen_pil), cv2.COLOR_BGR2RGB)
    count, points, bestfit, minimum_value = find_template_on_screen(
        top_left_corner, img, 0.01)
コード例 #4
0
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)
    count, points, bestfit, minimum_value = find_template_on_screen(
        top_left_corner, img, 0.01)
コード例 #5
0
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,
                                                  scale_m=1.0)
    assert cropped
コード例 #6
0
 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."
         )
コード例 #7
0
 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 corrdinates 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')