Example #1
0
    def test_in_game_caesar_portrait_standard_template_matching_cross_corr(
            self):
        threshold = unit_constants.ui_standard_template_matching_threshold
        wargroove_ctrl.vision.load_frame(
            self.__get_eval_folder() +
            'in-game/hud-mirror/portrait-caesar-mirrored.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'gameplay/wargroove_caesar_portrait', threshold=threshold)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_equal_to(153)
        assert_that(match.top_left[1]).is_equal_to(13)
        assert_that(match.bottom_right[0]).is_equal_to(224)
        assert_that(match.bottom_right[1]).is_equal_to(86)
    def test_in_game_mercia_portrait_standard_template_matching_cross_corr_img4(
            self):
        threshold = unit_constants.ui_standard_template_matching_threshold
        wargroove_ctrl.vision.load_frame(
            self.__get_eval_folder() +
            'in-game/hud-mirror/portrait-mercia-low-res.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'gameplay/wargroove_mercia_portrait', threshold=threshold)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_close_to(6, 1)
        assert_that(match.top_left[1]).is_close_to(7, 1)
        assert_that(match.bottom_right[0]).is_close_to(42, 1)
        assert_that(match.bottom_right[1]).is_close_to(43, 1)
Example #3
0
    def test_in_game_mercia_portrait_standard_template_matching_square_diff_img4(
            self):
        threshold = unit_constants.ui_standard_template_matching_square_diff_threshold
        wargroove_ctrl.vision.load_frame(
            self.__get_eval_folder() +
            'in-game/hud-mirror/portrait-mercia-mirrored.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'gameplay/wargroove_mercia_portrait',
            threshold=threshold,
            method=cmp504.computer_vision.TemplateMatchingMethod.
            SQUARE_DIFFERENCE_NORMALIZED)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_equal_to(153)
        assert_that(match.top_left[1]).is_equal_to(13)
        assert_that(match.bottom_right[0]).is_equal_to(224)
        assert_that(match.bottom_right[1]).is_equal_to(86)
Example #4
0
    def test_in_game_caesar_portrait_standard_template_matching_corr_coeff(
            self):
        threshold = unit_constants.ui_standard_template_matching_corr_coeff_threshold
        wargroove_ctrl.vision.load_frame(
            self.__get_eval_folder() +
            'in-game/hud-mirror/portrait-caesar-mirrored.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'gameplay/wargroove_caesar_portrait',
            threshold=threshold,
            method=cmp504.computer_vision.TemplateMatchingMethod.
            CORRELATION_COEFFICIENT_NORMALIZED)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_equal_to(153)
        assert_that(match.top_left[1]).is_equal_to(13)
        assert_that(match.bottom_right[0]).is_equal_to(224)
        assert_that(match.bottom_right[1]).is_equal_to(86)
    def test_in_game_emeric_portrait_standard_template_matching_corr_coeff_img4(
            self):
        threshold = unit_constants.ui_standard_template_matching_corr_coeff_threshold
        wargroove_ctrl.vision.load_frame(
            self.__get_eval_folder() +
            'in-game/hud-mirror/portrait-emeric-low-res.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'gameplay/wargroove_emeric_portrait',
            threshold=threshold,
            method=cmp504.computer_vision.TemplateMatchingMethod.
            CORRELATION_COEFFICIENT_NORMALIZED)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_close_to(6, 1)
        assert_that(match.top_left[1]).is_close_to(7, 1)
        assert_that(match.bottom_right[0]).is_close_to(42, 1)
        assert_that(match.bottom_right[1]).is_close_to(43, 1)
Example #6
0
    def test_event_editor_button_standard_template_matching_cross_corr(self):
        pre_process = cmp504.image_processing.ImageProcessingStepChain()
        pre_process.append(cmp504.image_processing.BGR2Grayscale())
        pre_process.append(cmp504.image_processing.Threshold(200))

        threshold = unit_constants.ui_standard_template_matching_threshold
        wargroove_ctrl.vision.load_frame(self.__get_eval_folder() +
                                         'change-color.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'event_editor_button',
            threshold=threshold,
            template_pre_processing_chain=pre_process,
            frame_pre_processing_chain=pre_process,
            method=cmp504.computer_vision.TemplateMatchingMethod.
            CROSS_CORRELATION_NORMALIZED)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_equal_to(588)
        assert_that(match.top_left[1]).is_equal_to(366)
        assert_that(match.bottom_right[0]).is_equal_to(690)
        assert_that(match.bottom_right[1]).is_equal_to(400)
Example #7
0
    def test_save_and_exit_button_standard_template_matching_square_diff(self):
        pre_process = cmp504.image_processing.ImageProcessingStepChain()
        pre_process.append(cmp504.image_processing.BGR2Grayscale())
        pre_process.append(cmp504.image_processing.Threshold(200))

        threshold = unit_constants.ui_standard_template_matching_threshold
        wargroove_ctrl.vision.load_frame(self.__get_eval_folder() +
                                         'change-color.png')
        match = wargroove_ctrl.find_ui_item_with_template_matching(
            'save_and_exit_button',
            threshold=threshold,
            template_pre_processing_chain=pre_process,
            frame_pre_processing_chain=pre_process,
            method=cmp504.computer_vision.TemplateMatchingMethod.
            SQUARE_DIFFERENCE_NORMALIZED)

        assert_that(match).is_not_none()
        assert_that(match.top_left[0]).is_equal_to(590)
        assert_that(match.top_left[1]).is_equal_to(450)
        assert_that(match.bottom_right[0]).is_equal_to(690)
        assert_that(match.bottom_right[1]).is_equal_to(484)