|
|
|
|
@ -194,13 +194,18 @@ int CameraCheckAnalysisy::Detect_Pre()
|
|
|
|
|
|
|
|
|
|
if (shiftLeft < 0)
|
|
|
|
|
{
|
|
|
|
|
cv::Mat M = (cv::Mat_<double>(2, 3) << 1, 0, 0, 0, 1, (double)shiftLeft);
|
|
|
|
|
cv::warpAffine(img, img, M, img.size(), cv::INTER_NEAREST, cv::BORDER_CONSTANT, cv::Scalar(0));
|
|
|
|
|
// 内容向上平移 |shiftLeft| 行,底部补黑。
|
|
|
|
|
int dy = -shiftLeft;
|
|
|
|
|
cv::Mat shifted = cv::Mat::zeros(img.size(), img.type());
|
|
|
|
|
img(cv::Rect(0, dy, img.cols, img.rows - dy)).copyTo(shifted(cv::Rect(0, 0, img.cols, img.rows - dy)));
|
|
|
|
|
img = shifted;
|
|
|
|
|
}
|
|
|
|
|
if (shiftRight < 0)
|
|
|
|
|
{
|
|
|
|
|
cv::Mat M = (cv::Mat_<double>(2, 3) << 1, 0, 0, 0, 1, (double)shiftRight);
|
|
|
|
|
cv::warpAffine(img_B, img_B, M, img_B.size(), cv::INTER_NEAREST, cv::BORDER_CONSTANT, cv::Scalar(0));
|
|
|
|
|
int dy = -shiftRight;
|
|
|
|
|
cv::Mat shifted = cv::Mat::zeros(img_B.size(), img_B.type());
|
|
|
|
|
img_B(cv::Rect(0, dy, img_B.cols, img_B.rows - dy)).copyTo(shifted(cv::Rect(0, 0, img_B.cols, img_B.rows - dy)));
|
|
|
|
|
img_B = shifted;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@ -208,8 +213,16 @@ int CameraCheckAnalysisy::Detect_Pre()
|
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_1, "Detect_Pre", "Cam %s ==================GetProductFirstRow fail, skip align", strBasic.c_str());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int overlap;
|
|
|
|
|
if(pImageResult->result->in_shareImage->strCameraName.find("TA") != std::string::npos)
|
|
|
|
|
{
|
|
|
|
|
overlap = 1056;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
overlap = 1440;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int overlap = 1056;
|
|
|
|
|
if (img.cols <= overlap)
|
|
|
|
|
{
|
|
|
|
|
m_pdetlog->AddCheckstr(PrintLevel_1, "Detect_Pre", "Cam %s ==================img.cols <= overlap %d ", strBasic.c_str(), overlap);
|
|
|
|
|
|