更新裁切纠偏算法,调整色彩填充问题;Bug-758
This commit is contained in:
parent
c6b255a18a
commit
bcd6475f1b
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue