| | |
| | | } |
| | | 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; |
| | | |
| | |
| | | }*/ |
| | | } |
| | | 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) { |
| | |
| | | } |
| | | |
| | | 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; |
| | |
| | | } |
| | | |
| | | if (contentStartRow < 0) { |
| | | LogUtil::error("图像分隔出错:title分隔出错"); |
| | | throw string("图像分隔出错:title分隔出错"); |
| | | } |
| | | |
| | | LogUtil::debug("\n\n\n\n"); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //释放数据 |
| | | free(*ele); |
| | | |
| | | |
| | | } |