mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-12-04 20:47:33 +00:00
84 lines
2.3 KiB
Python
84 lines
2.3 KiB
Python
|
import module.config.server as server
|
||
|
|
||
|
server.server = 'cn' # Don't need to edit, it's used to avoid error.
|
||
|
|
||
|
from module.map.grids import Grids
|
||
|
from module.config.config import AzurLaneConfig
|
||
|
from PIL import Image
|
||
|
|
||
|
"""
|
||
|
This file is use to debug a perspective error.
|
||
|
It will call the map detection module (module/map/grids.py), outside Alas.
|
||
|
"""
|
||
|
|
||
|
"""
|
||
|
Put image here.
|
||
|
"""
|
||
|
file = ''
|
||
|
|
||
|
|
||
|
class Config:
|
||
|
pass
|
||
|
|
||
|
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 40
|
||
|
EDGE_LINES_HOUGHLINES_THRESHOLD = 40
|
||
|
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 1.5
|
||
|
|
||
|
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
||
|
'height': (150, 255 - 24),
|
||
|
'width': (0.9, 10),
|
||
|
'prominence': 10,
|
||
|
'distance': 35,
|
||
|
}
|
||
|
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
||
|
'height': (255 - 24, 255),
|
||
|
'prominence': 10,
|
||
|
'distance': 50,
|
||
|
'width': (0, 10),
|
||
|
'wlen': 1000
|
||
|
}
|
||
|
|
||
|
# These are the full configuration in module/config/config.py
|
||
|
"""
|
||
|
MAP_HAS_SIREN = False
|
||
|
MAP_HAS_DYNAMIC_RED_BORDER = False
|
||
|
MAP_SIREN_TEMPLATE = ['1', '2', '3', 'DD']
|
||
|
|
||
|
# Parameters for scipy.signal.find_peaks
|
||
|
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html
|
||
|
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
|
||
|
'height': (150, 255 - 40),
|
||
|
'width': (0.9, 10),
|
||
|
'prominence': 10,
|
||
|
'distance': 35,
|
||
|
}
|
||
|
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
|
||
|
'height': (255 - 24, 255),
|
||
|
'prominence': 10,
|
||
|
'distance': 50,
|
||
|
# 'width': (0, 7),
|
||
|
'wlen': 1000
|
||
|
}
|
||
|
# Parameters for cv2.HoughLines
|
||
|
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 75
|
||
|
EDGE_LINES_HOUGHLINES_THRESHOLD = 75
|
||
|
# Parameters for lines pre-cleansing
|
||
|
HORIZONTAL_LINES_THETA_THRESHOLD = 0.005
|
||
|
VERTICAL_LINES_THETA_THRESHOLD = 18
|
||
|
TRUST_EDGE_LINES = False # True to use edge to crop inner, false to use inner to crop edge
|
||
|
# Parameters for perspective calculating
|
||
|
VANISH_POINT_RANGE = ((540, 740), (-3000, -1000))
|
||
|
DISTANCE_POINT_X_RANGE = ((-3200, -1600),)
|
||
|
# Parameters for line cleansing
|
||
|
COINCIDENT_POINT_ENCOURAGE_DISTANCE = 3
|
||
|
ERROR_LINES_TOLERANCE = (-10, 10)
|
||
|
MID_DIFF_RANGE_H = (129 - 3, 129 + 3)
|
||
|
MID_DIFF_RANGE_V = (129 - 3, 129 + 3)
|
||
|
"""
|
||
|
|
||
|
|
||
|
cfg = AzurLaneConfig().merge(Config())
|
||
|
grids = Grids(Image.open(file), cfg)
|
||
|
grids.predict()
|
||
|
grids.show()
|