feat 传入图片对竖图旋转

dev_lsy
liusiyang 4 weeks ago
parent 4dd6cfe2a0
commit 38480076e9

@ -616,6 +616,28 @@ int ALLImgCheckAnalysisy::PushInImg_New(std::shared_ptr<shareImage> p)
return CHECK_ERROR_Config_Null;
}
// 对传入图片做一步判断,如果高大于宽,则顺时针旋转90°
if (p->Det_Mode != DET_MODE_ReJson)
{
if (!p->img.empty() && p->img.rows > p->img.cols)
{
cv::Mat imgRot;
cv::rotate(p->img, imgRot, cv::ROTATE_90_CLOCKWISE);
printf("PushInImg rotate 90CW: SN %s channel %s img [%d x %d] -> [%d x %d]\n",
p->strImgProductID.c_str(), p->strChannel.c_str(),
p->img.cols, p->img.rows, imgRot.cols, imgRot.rows);
p->img = imgRot;
}
if (!p->img_B.empty() && p->img_B.rows > p->img_B.cols)
{
cv::Mat imgBRot;
cv::rotate(p->img_B, imgBRot, cv::ROTATE_90_CLOCKWISE);
printf("PushInImg rotate 90CW: SN %s channel %s img_B [%d x %d] -> [%d x %d]\n",
p->strImgProductID.c_str(), p->strChannel.c_str(),
p->img_B.cols, p->img_B.rows, imgBRot.cols, imgBRot.rows);
p->img_B = imgBRot;
}
}
std::string strlog = "";
m_strTest += " PushInImg->SN:";
m_strTest += p->strImgProductID;

Loading…
Cancel
Save