chore: 优化编队模板图片,识别不到对应职业图标时在 全部 中寻找

This commit is contained in:
uye
2024-10-02 14:29:13 +08:00
parent 69da70c1ba
commit 73bf9f4e21
12 changed files with 21 additions and 19 deletions

View File

@@ -4437,8 +4437,10 @@
"template": "empty.png",
"action": "ClickSelf",
"roi": [1155, 41, 125, 679],
"method": "RGBCount",
"templThreshold": 0.7,
"maskRange": [100, 140],
"colorScales": [[90, 150]],
"colorWithClose": false,
"postDelay": 500
},
"BattleQuickFormationFilter": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -431,7 +431,7 @@ bool asst::BattleFormationTask::click_role_table(battle::Role role)
tasks = { "BattleQuickFormationRole-All", "BattleQuickFormationRole-All-OCR" };
}
else {
tasks = { "BattleQuickFormationRole-" + role_iter->second };
tasks = { "BattleQuickFormationRole-" + role_iter->second, "BattleQuickFormationRole-All", "BattleQuickFormationRole-All-OCR"};
}
return ProcessTask(*this, tasks).set_retry_times(0).run();
}

View File

@@ -16,24 +16,24 @@ if __name__ == '__main__':
rgb_base_mask_range_ignore_dark = [[[20, 20, 20], [255, 255, 255]]] # 忽略暗色背景
# 自动判断图片的合适 mask_ranges
image = cv2.imread(str(maa_dir / "resource" / "template" / "Sarkaz@Roguelike@StageEmergencyTransportation.png"))
generate_mask_ranges(image, 'luv', luv_base_mask_range_ignore_light_dark)
generate_mask_ranges(image, 'hsv', hsv_base_mask_range_ignore_dark)
generate_mask_ranges(image, 'rgb', rgb_base_mask_range_ignore_dark)
# image = cv2.imread(str(maa_dir / "resource" / "template" / "BattleQuickFormationRole-Pioneer.png"))
# generate_mask_ranges(image, 'luv', luv_base_mask_range_ignore_light_dark)
# generate_mask_ranges(image, 'hsv', hsv_base_mask_range_ignore_dark)
# generate_mask_ranges(image, 'rgb', rgb_base_mask_range_ignore_dark)
# 在给定的 mask_ranges 下展示一张图
image = cv2.imread(str(maa_dir / "resource" / "template" / "Sarkaz@Roguelike@StageEmergencyTransportation.png"))
mask_ranges = [[[78, 60, 80], [93, 140, 120]]]
show_image_mask(image, calc_mask_from_ranges(image, mask_ranges, 'hsv', True), 'hsv')
mask_ranges = [[[93, 81, 130], [102, 97, 142]], [[128, 100, 164], [134, 110, 169]], [[95, 85, 145], [105, 95, 155]]]
show_image_mask(image, calc_mask_from_ranges(image, mask_ranges, 'luv', True), 'luv')
image = cv2.imread(str(maa_dir / "resource" / "template" / "BattleQuickFormationRole-Pioneer.png"))
mask_ranges = [[[90, 90, 90], [150, 150, 150]]]
show_image_mask(image, calc_mask_from_ranges(image, mask_ranges, 'rgb', True), 'rgb')
# mask_ranges = [[[93, 81, 130], [102, 97, 142]], [[128, 100, 164], [134, 110, 169]], [[95, 85, 145], [105, 95, 155]]]
# show_image_mask(image, calc_mask_from_ranges(image, mask_ranges, 'luv', True), 'luv')
# 在给定的 mask_ranges 下比较两张图
image1 = cv2.imread(str(maa_dir / "resource" / "template" / "Sarkaz@Roguelike@StageEmergencyTransportation.png"))
image2 = cv2.imread(str(maa_dir / "resource" / "template" / "Sarkaz@Roguelike@StageConfrontation.png"))
mask_ranges = [[[78, 60, 80], [93, 140, 120]], [[18, 90, 130], [23, 130, 150]], [[14, 130, 200], [16, 150, 220]]]
compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "hsv")
compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "hsv", True)
mask_ranges = [[[93, 81, 125], [102, 97, 150]], [[95, 85, 145], [105, 95, 155]]]
compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "luv")
compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "luv", True)
image1 = cv2.imread(str(maa_dir / "resource" / "template" / "BattleQuickFormationRole-Pioneer.png"))
image2 = cv2.imread(str(maa_dir / "resource" / "template" / "BattleQuickFormationRole-Tank.png"))
mask_ranges = [[[90, 90, 90], [150, 150, 150]]]
compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "rgb")
compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "rgb", True)
# mask_ranges = [[[93, 81, 125], [102, 97, 150]], [[95, 85, 145], [105, 95, 155]]]
# compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "luv")
# compare_2_image_with_mask_ranges(image1, image2, mask_ranges, "luv", True)