admin
2022-06-30 a17738e1545ff7dbef6398b8ec1eab93ab59c9a1
ConsoleApplication/ImgUtil.cpp
@@ -251,11 +251,11 @@
   }
   return nums;
}
//分隔整数
list<cv::Mat> ImgUtil::splitNum(cv::Mat src)  throw(string) {
list<cv::Mat> ImgUtil::splitNum(cv::Mat src,int threshold_value)  throw(string) {
   cv::Mat binary;
   //去除上下的空白图
   threshold(src, binary, _IMG_BINARY_THRESHOLD, 255, cv::THRESH_BINARY);
   threshold(src, binary, threshold_value , 255, cv::THRESH_BINARY);
   int rows = src.rows;
   int cols = src.cols;
@@ -340,6 +340,11 @@
      }*/
   }
   return resultList;
}
//分隔整数
list<cv::Mat> ImgUtil::splitNum(cv::Mat src)  throw(string) {
   return splitNum(src,_IMG_BINARY_THRESHOLD);
}
cv::Mat  ImgUtil::formatNumLevel2(cv::Mat num)  throw(string) {
@@ -459,6 +464,7 @@
}
list<int*> ImgUtil::divideImg(cv::Mat img, bool save) {
   //cv::imwrite("C:\\Users\\Administrator\\Desktop\\ocr\\demo\\0_gray.jpg", img);
   clock_t start_time = clock();
   LogUtil::info("开始分隔图像");
   list<list<int*>> resultList;
@@ -495,7 +501,7 @@
   }
   if (contentStartRow < 0) {
      LogUtil::error("图像分隔出错:title分隔出错");
      throw string("图像分隔出错:title分隔出错");
   }
   LogUtil::debug("\n\n\n\n");
@@ -757,7 +763,8 @@
         }
      }
      //释放数据
      free(*ele);
   }