diff --git a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp index 60a898e..00e7387 100644 --- a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp @@ -616,6 +616,28 @@ int ALLImgCheckAnalysisy::PushInImg_New(std::shared_ptr 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;