scbc.sat2 пре 5 година
родитељ
комит
e5289ad13a
2 измењених фајлова са 20 додато и 14 уклоњено
  1. 2 1
      ssat_sdk/MenuTree3/OptionConfig.py
  2. 18 13
      ssat_sdk/MenuTree3/OptionOCR.py

+ 2 - 1
ssat_sdk/MenuTree3/OptionConfig.py

@@ -198,5 +198,6 @@ if __name__ == "__main__":
     # print "getThresholdDict", optionConfig.getThresholdDict('setting')
     # print "getOptionICONConfig", optionConfig.getOptionICONConfig('picture')
     # print "getValueICONConfig", optionConfig.getValueICONConfig('picture')
-    print "getOptionOCRConfig", optionConfig.getOptionOCRConfig('picture')
+    # print "getOptionOCRConfig", optionConfig.getOptionOCRConfig('picture')
+    print "getICONResolutionConfig", optionConfig.getICONResolutionConfig()
 

+ 18 - 13
ssat_sdk/MenuTree3/OptionOCR.py

@@ -15,18 +15,18 @@ from UIT_PathManage import UITPathManage
 
 
 class COptionOCR(CBaseLog):
-    def __init__(self, optionConfig, pathManager):
+    def __init__(self, optionConfig, optionExcel):
         # COptionConfig对象;
         self.__optionConfig = optionConfig
         if self.__optionConfig is None:
             self.error("configManger对象空")
         # 路径对象;
-        self.__pathManager = pathManager
+        self.__optionExcel = optionExcel
         # 创建OCR对象
         self.__ocr = OCRConvert()
         # 图片切割对象
         self.__imgCMP = ImageCMP()
-        
+
     '''
     函数:获取指定原图中指定的文本区域内的文本内容;
     参数:
@@ -37,6 +37,7 @@ class COptionOCR(CBaseLog):
     返回:
         返回文本内容;
     '''
+
     def getOptionText(self, optionName, src_pic, text_box, ocr_config):
         src_img = src_pic
         # 如果是字符串,认为是路径;
@@ -49,7 +50,7 @@ class COptionOCR(CBaseLog):
             return None
 
         return self.__getOptionText(optionName, src_img, text_box, ocr_config)
-    
+
     '''
     函数:获取指定原图中指定的文本区域内的文本内容;
     参数:
@@ -60,6 +61,7 @@ class COptionOCR(CBaseLog):
     返回:
         返回文本内容;
     '''
+
     def __getOptionText(self, optionName, src_img, text_box, ocr_config):
         if text_box.__len__() == 0:
             self.error(u"【%s】文本区域空" % optionName)
@@ -72,15 +74,16 @@ class COptionOCR(CBaseLog):
         if not os.path.exists(text_pic):
             self.error(u"【%s】保存文本区域截图失败" % optionName)
             return None
-        
+
         # 获取ocr识别时阈值(疑似问题:不是使用optionName,而是对应的first_parent)
         # 示例:threshold = {"Threshold":[25,255,0]}
         threshold = self.__optionConfig.getThresholdDict(optionName)
 
         # 识别文本图片内容;
-        optionText = self.__ocr.getStrWithImgProcess(text_pic, threshold, ocr_config['lan'], ocr_config['type'], reconTimes=1)
+        optionText = self.__ocr.getStrWithImgProcess(text_pic, threshold, ocr_config['lan'], ocr_config['type'],
+                                                     reconTimes=1)
 
-        self.info(u"【%s】识别结果=%s"%(optionName, optionText))
+        self.info(u"【%s】识别结果=%s" % (optionName, optionText))
         # 返回结果;
         return optionText
 
@@ -92,22 +95,24 @@ class COptionOCR(CBaseLog):
         threshold:      orc识别时的阈值,示例:{"Threshold":[25,255,0]}
     返回:
     '''
+
     def getImageText(self, text_pic, ocr_config, threshold):
         # 判断文本图片是否存在;
         if not os.path.exists(text_pic):
             self.error(u"【%s】文本图片不存在" % text_pic)
             return None
-        
-         # 识别文本图片内容;
-        imgText = self.__ocr.getStrWithImgProcess(text_pic, threshold, ocr_config['lan'], ocr_config['type'], reconTimes=1)
 
-        self.info(u"【%s】识别结果=%s"%(text_pic, imgText))
+        # 识别文本图片内容;
+        imgText = self.__ocr.getStrWithImgProcess(text_pic, threshold, ocr_config['lan'], ocr_config['type'],
+                                                  reconTimes=1)
+
+        self.info(u"【%s】识别结果=%s" % (text_pic, imgText))
         # 返回结果;
         return imgText
 
-    
+
 # end-class
 
 
 if __name__ == "__main__":
-    pass
+    pass