Prechádzať zdrojové kódy

【bug修复】(黄根)优化红笔打分识别逻辑(优化opencv 图像HSV”红色“的查找范围)
【工作量】16h
【评审人】

huanggen 2 rokov pred
rodič
commit
52e9465b60

+ 2 - 2
Identifier/OnLineCardPageIdentifier.cpp

@@ -3210,7 +3210,7 @@ namespace OnLineCard{
 						for (int j = 0; j<1; j++){
 							CvRect rect_detect = cvRect(qs.scoreBox.pos.x, qs.scoreBox.pos.y, qs.scoreBox.pos.w, qs.scoreBox.pos.h);
 							int red_area = GetTianKongTiRedCount(dst, rect_detect, rect_detect, 1, 0);
-							if (red_area>25){
+							if (red_area > 25){
 								tiankongti_result_value[tiankong_count].isright = TRUE;
 								break;
 							}
@@ -3639,7 +3639,7 @@ namespace OnLineCard{
 		const int hsv_v_valve = 255 * 50 / 100;
 		const int hsv_h_max_valve = 180 * 20 / 360;
 		const int hsv_h_min_valve = 180 * 315 / 360;
-		const int hsv_s_valve_1 = 255 * 23 / 100;
+		const int hsv_s_valve_1 = 43;
 		const int hsv_s_valve_2 = 255 * 33 / 100;
 		const int hsv_valve_high = 255 * (23 + 70) / 100;
 		const int hsv_valve_low = 255 * (13 + 60) / 100;

+ 5 - 4
Identifier/PageIdentify.cpp

@@ -732,7 +732,7 @@ namespace OnLineCard{
 			//根据图片像素比例调整定位点检查区域高度
 			double dLocPointHeight = m_pTemplate->pages[1].location.at(0).pos.h;
 			m_pTemplate->dingweidian_range_top = dLocPointHeight * 6 * src_gray_img->height / m_pTemplate->pages[1].h;
-			m_pTemplate->dingweidian_rang_buttom = dLocPointHeight * 6 * src_gray_img->height / m_pTemplate->pages[1].h;
+			m_pTemplate->dingweidian_rang_buttom = dLocPointHeight * 7 * src_gray_img->height / m_pTemplate->pages[1].h;
 		}
 		int range = m_pTemplate->dingweidian_range_top;
 		//LOGFMTI("MyFindDingWeiDian 1 range=%d", range);
@@ -1516,7 +1516,7 @@ namespace OnLineCard{
 				schema_param.paper_bar_width1 = page.QrCode.w*w_scale + 40;
 				if (schema_param.paper_bar_width1 + x >= dst_gray_img->width)
 					schema_param.paper_bar_width1 = dst_gray_img->width - x - 2;
-				schema_param.paper_bar_height1 = page.QrCode.h*h_scale + 40;
+				schema_param.paper_bar_height1 = ( page.QrCode.h + 40 ) * h_scale;
 				schema_param.paper_bar_offsetx1 = x;
 				schema_param.paper_bar_offsety1 = y;
 
@@ -3085,7 +3085,7 @@ namespace OnLineCard{
 						for (int j = 0; j<1; j++){
 							CvRect rect_detect = cvRect(qs.scoreBox.pos.x, qs.scoreBox.pos.y, qs.scoreBox.pos.w, qs.scoreBox.pos.h);
 							int red_area = GetTianKongTiRedCount(dst, rect_detect, rect_detect, 1, 0);
-							if (red_area>25){
+							if (red_area > 25){
 								tiankongti_result_value[tiankong_count].isright = TRUE;
 								break;
 							}
@@ -3207,6 +3207,7 @@ namespace OnLineCard{
 		IplImage * temp = cvCloneImage(red);
 		CvMemStorage* storage = cvCreateMemStorage();
 		CvSeq* contours = NULL;
+		//cv::imwrite("D:\\RedContours.jpg", cv::cvarrToMat(red));
 		cvFindContours(temp, storage, &contours, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
 		int top = normal_rect.y - rect.y;
 		int bottom = normal_rect.y + normal_rect.height - 1 - rect.y;
@@ -3515,7 +3516,7 @@ namespace OnLineCard{
 		const int hsv_v_valve = 255 * 50 / 100;
 		const int hsv_h_max_valve = 180 * 20 / 360;
 		const int hsv_h_min_valve = 180 * 315 / 360;
-		const int hsv_s_valve_1 = 255 * 23 / 100;
+		const int hsv_s_valve_1 = /*255 * 23 / 100*/43;
 		const int hsv_s_valve_2 = 255 * 33 / 100;
 		const int hsv_valve_high = 255 * (23 + 70) / 100;
 		const int hsv_valve_low = 255 * (13 + 60) / 100;