|
1 | 1 | #! /usr/bin/env python |
2 | 2 | #-*- coding: utf-8 -*- |
3 | 3 |
|
| 4 | +import numpy as np |
4 | 5 | import json |
5 | 6 | import util |
6 | 7 | import copy |
@@ -130,8 +131,9 @@ def run(self): |
130 | 131 | base_path = sys._MEIPASS |
131 | 132 | else: |
132 | 133 | base_path = os.path.abspath(".") |
| 134 | + # 尝试修正可能出现的中文路径编码问题 |
133 | 135 | refImagePath = os.path.join(base_path, 'resource/refImage.png') |
134 | | - refImage = cv2.imread(refImagePath) # 读取参考图 |
| 136 | + refImage = cv2.imdecode(np.fromfile(refImagePath,dtype=np.uint8),cv2.IMREAD_COLOR) # 读取参考图 |
135 | 137 | charIndexCandidateList = [[],[],[],[],[],[]] |
136 | 138 | charCandidateList = [ |
137 | 139 | {'name': '未知角色', 'id': 1000}, |
@@ -425,17 +427,14 @@ def renderSolution(self, solution, mainGUI, buttonGroup): |
425 | 427 | global_logger.exception("renderSolution()渲染错误") |
426 | 428 | global_logger.exception("渲染用solution: %s" % solution) |
427 | 429 | global_logger.exception("Exception %s" % e) |
428 | | - |
429 | | - |
430 | 430 |
|
431 | | - |
432 | 431 |
|
433 | 432 | class GUIMainWin(QMainWindow, Ui_PCRJJCAnalyzerGUI): |
434 | 433 | def __init__(self, parent=None): |
435 | 434 | super(GUIMainWin, self).__init__(parent) |
436 | 435 | self.setupUi(self) |
437 | 436 | self.appExceptionHandler = ExceptHookHandler(self, logFile=os.path.join(os.path.expanduser('~'), "PCRJJCAnalyzer", "log.txt")) |
438 | | - self.setWindowTitle('PCRJJCAnalyzer-v0.1.4-beta3') |
| 437 | + self.setWindowTitle('PCRJJCAnalyzer-v0.1.4-beta4') |
439 | 438 | self.exclusionList = [[], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] |
440 | 439 | self.excludingSolutionIDList = ['','',''] |
441 | 440 | self.exclusionCheckBoxButtonGroup = QButtonGroup() |
@@ -989,8 +988,9 @@ def parseChars(self): |
989 | 988 | base_path = sys._MEIPASS |
990 | 989 | else: |
991 | 990 | base_path = os.path.abspath(".") |
| 991 | + # 尝试修正可能出现的中文路径编码问题 |
992 | 992 | refImagePath = os.path.join(base_path, 'resource/refImage.png') |
993 | | - refImage = cv2.imread(refImagePath) # 读取参考图 |
| 993 | + refImage = cv2.imdecode(np.fromfile(refImagePath,dtype=np.uint8),cv2.IMREAD_COLOR) # 读取参考图 |
994 | 994 | for i in range(len(self.charImageList)): |
995 | 995 | charNum = i+1 |
996 | 996 | charIndex = (util.cv_getIndex(util.cv_getMidPoint(self.charImageList[i], refImage, eval("cv2.%s" % config_dict['algorithm'] )), refImageParams)) # 计算出目标角色在参考图中的坐标位置(行与列) |
|
0 commit comments