更新裁切纠偏算法,调整色彩填充问题;Bug-758

This commit is contained in:
yangjiaxuan 2023-12-07 18:29:26 +08:00
parent c6b255a18a
commit bcd6475f1b
2 changed files with 8 additions and 4 deletions

View File

@ -175,7 +175,7 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst
cv::Mat temp_bgc; cv::Mat temp_bgc;
cv::resize(resizeMat(boudingRect), temp_bgc, cv::Size(200, 200)); cv::resize(resizeMat(boudingRect), temp_bgc, cv::Size(200, 200));
blankColor = hg::getBackGroundColor(temp_bgc, cv::Mat(), threshold); blankColor = hg::getBackGroundColor(temp_bgc, cv::Mat(), 10);
} }
else else
blankColor = cv::Scalar::all(255); blankColor = cv::Scalar::all(255);
@ -186,7 +186,7 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst
if (isDesaskew) if (isDesaskew)
dst = cv::Mat(cv::Size(rect.size), src.type(), blankColor); dst = cv::Mat(cv::Size(rect.size), src.type(), blankColor);
else else
dst = cv::Mat(rect.boundingRect().size(), src.type(), blankColor); dst = cv::Mat(/*rect.boundingRect().size()*/ cv::boundingRect(maxContour).size(), src.type(), blankColor);
else else
dst = cv::Mat(dHeight, dWidth, src.type(), blankColor); dst = cv::Mat(dHeight, dWidth, src.type(), blankColor);
@ -234,6 +234,8 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst
dstROI = dst(cv::Rect((dst.cols - bounding.width) / 2, (dst.rows - bounding.height) / 2, bounding.width, bounding.height)); dstROI = dst(cv::Rect((dst.cols - bounding.width) / 2, (dst.rows - bounding.height) / 2, bounding.width, bounding.height));
src(bounding).copyTo(dstROI); src(bounding).copyTo(dstROI);
//cv::imwrite("dst.bmp", dst);
} }
if (isFillBlank) if (isFillBlank)
@ -258,7 +260,8 @@ void CImageApplyAutoCrop::autoCrop_desaskew_fillBlank(cv::Mat& src, cv::Mat& dst
} }
else else
{ {
cv::Rect bounding = rect.boundingRect(); //cv::Rect bounding = rect.boundingRect();
cv::Rect bounding = cv::boundingRect(maxContour);
srcTri[0] = cv::Point(bounding.x, bounding.br().y - 1); srcTri[0] = cv::Point(bounding.x, bounding.br().y - 1);
srcTri[1] = cv::Point(bounding.x, bounding.y); srcTri[1] = cv::Point(bounding.x, bounding.y);
srcTri[2] = cv::Point(bounding.br().x - 1, bounding.y); srcTri[2] = cv::Point(bounding.br().x - 1, bounding.y);

View File

@ -36,7 +36,8 @@
2023/11/02 v1.6 2023/11/02 v1.6
2023/12/05 v1.6.1 BUG 2023/12/05 v1.6.1 BUG
2023/12/06 v1.6.2 BUG 2023/12/06 v1.6.2 BUG
* v1.6.2 2023/12/07 v1.6.3 BUG
* v1.6.3
* ==================================================== * ====================================================
*/ */