|
@@ -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;
|
|
@@ -3512,11 +3513,12 @@ namespace OnLineCard{
|
|
|
#define HSV_VALUE_H hsv_row_first[hsv_offset]
|
|
|
#define HSV_VALUE_S hsv_row_first[hsv_offset+1]
|
|
|
#define HSV_VALUE_V hsv_row_first[hsv_offset+2]
|
|
|
- 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_2 = 255 * 33 / 100;
|
|
|
+ const int hsv_v_valve = /*255 * 50 / 100*/46;
|
|
|
+ const int hsv_h_max_valve = /*180 * 20 / 360*/180;
|
|
|
+ const int hsv_h_min_valve = /*180 * 315 / 360*/156;
|
|
|
+ const int hsv_h_max_valve2 = /*180 * 20 / 360*/10;
|
|
|
+ const int hsv_s_valve_1 = /*255 * 23 / 100*/43;
|
|
|
+ const int hsv_s_valve_2 = /*255 * 33 / 100*/255;
|
|
|
const int hsv_valve_high = 255 * (23 + 70) / 100;
|
|
|
const int hsv_valve_low = 255 * (13 + 60) / 100;
|
|
|
for (int y = 0; y<h; y++)
|
|
@@ -3528,7 +3530,7 @@ namespace OnLineCard{
|
|
|
unsigned char * black_row_first = (unsigned char *)(black->imageData + y*black->widthStep);
|
|
|
for (int x = 0, hsv_offset = 0; x<w; x++, hsv_offset += 3)
|
|
|
{
|
|
|
- if (HSV_VALUE_V >= hsv_v_valve && (HSV_VALUE_H >= hsv_h_min_valve || HSV_VALUE_H <= hsv_h_max_valve)){
|
|
|
+ if (HSV_VALUE_V >= hsv_v_valve && (HSV_VALUE_H >= hsv_h_min_valve || HSV_VALUE_H <= hsv_h_max_valve || HSV_VALUE_H <= hsv_h_max_valve2)){
|
|
|
red1_row_first[x] = (HSV_VALUE_S >= hsv_s_valve_1 && (HSV_VALUE_S + HSV_VALUE_V) >= hsv_valve_low) ? 255 : 0;
|
|
|
red2_row_first[x] = (HSV_VALUE_S >= hsv_s_valve_2 && (HSV_VALUE_S + HSV_VALUE_V) >= hsv_valve_high) ? HSV_VALUE_S : 0;
|
|
|
}
|
|
@@ -3539,11 +3541,11 @@ namespace OnLineCard{
|
|
|
}
|
|
|
}
|
|
|
#if GETREDBINARY_DEBUG
|
|
|
- cvSaveImage("D:\\hsv.png", hsv);
|
|
|
- cvSaveImage("D:\\red_low.png", red_low);
|
|
|
- cvSaveImage("D:\\red_high.png", red_high);
|
|
|
- cvSaveImage("D:\\binary.png", binary);
|
|
|
- cvSaveImage("D:\\black.png", black);
|
|
|
+ cvSaveImage("D:\\ImageDebug\\hsv.png", hsv);
|
|
|
+ cvSaveImage("D:\\ImageDebug\\red_low.png", red_low);
|
|
|
+ cvSaveImage("D:\\ImageDebug\\red_high.png", red_high);
|
|
|
+ cvSaveImage("D:\\ImageDebug\\binary.png", binary);
|
|
|
+ cvSaveImage("D:\\ImageDebug\\black.png", black);
|
|
|
#endif
|
|
|
cvThreshold(red_high, red_high, 0, 255, CV_THRESH_OTSU);
|
|
|
#ifdef _DEBUG
|
|
@@ -3593,12 +3595,14 @@ namespace OnLineCard{
|
|
|
}
|
|
|
}
|
|
|
cvReleaseStructuringElement(&element);
|
|
|
- *red_binary = red;
|
|
|
+ //直接使用red_low作为返回值
|
|
|
+ //TODO 此处不太明白red_high存在的意义是什么?
|
|
|
+ *red_binary = red_low;
|
|
|
cvReleaseImage(&hsv);
|
|
|
cvReleaseImage(&binary);
|
|
|
cvReleaseImage(&black);
|
|
|
cvReleaseImage(&black_dilate);
|
|
|
- cvReleaseImage(&red_low);
|
|
|
+ cvReleaseImage(&red);
|
|
|
cvReleaseImage(&red_dilate);
|
|
|
return TRUE;
|
|
|
}
|