diff --git a/huagao/ImageProcess/ImageApplyAdjustColors.cpp b/huagao/ImageProcess/ImageApplyAdjustColors.cpp index d298e84e..0d1eead8 100644 --- a/huagao/ImageProcess/ImageApplyAdjustColors.cpp +++ b/huagao/ImageProcess/ImageApplyAdjustColors.cpp @@ -44,11 +44,15 @@ void CImageApplyAdjustColors::apply(cv::Mat& pDib,int side) void CImageApplyAdjustColors::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; + if (!mats[0].empty()) { + apply(mats[0], 0); + } - apply(mats[0], 0); - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + if (isTwoSide && mats.size() > 1) { + if(!mats[1].empty()) + apply(mats[1], 1); + } } void CImageApplyAdjustColors::setAdjustColors(int brightness, int contrast, float gamma) diff --git a/huagao/ImageProcess/ImageApplyAutoCrop.cpp b/huagao/ImageProcess/ImageApplyAutoCrop.cpp index 2dd22256..93b9fcd3 100644 --- a/huagao/ImageProcess/ImageApplyAutoCrop.cpp +++ b/huagao/ImageProcess/ImageApplyAutoCrop.cpp @@ -166,8 +166,10 @@ void CImageApplyAutoCrop::apply(cv::Mat& pDib, int side) void CImageApplyAutoCrop::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; + if (!mats[0].empty()) { + apply(mats[0], 0); + } - apply(mats[0], 0); if (isTwoSide && mats.size() > 1) { @@ -175,7 +177,8 @@ void CImageApplyAutoCrop::apply(std::vector& mats, bool isTwoSide) if (!mats[0].empty()) m_fixedSize = mats[0].size(); - apply(mats[1], 1); + if(!mats[0].empty()) + apply(mats[1], 1); if (!mats[0].empty()) m_fixedSize = dSize; diff --git a/huagao/ImageProcess/ImageApplyBWBinaray.cpp b/huagao/ImageProcess/ImageApplyBWBinaray.cpp index 2d1125b9..14d868b9 100644 --- a/huagao/ImageProcess/ImageApplyBWBinaray.cpp +++ b/huagao/ImageProcess/ImageApplyBWBinaray.cpp @@ -74,10 +74,15 @@ void CImageApplyBWBinaray::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; - apply(mats[0], 0); + if (!mats[0].empty()) { + apply(mats[0], 0); + } - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + + if (isTwoSide && mats.size() > 1) { + if (!mats[1].empty()) + apply(mats[1], 1); + } } void CImageApplyBWBinaray::errorDiffuse(cv::Mat & image) diff --git a/huagao/ImageProcess/ImageApplyChannel.cpp b/huagao/ImageProcess/ImageApplyChannel.cpp index ba96ca49..4e1832b4 100644 --- a/huagao/ImageProcess/ImageApplyChannel.cpp +++ b/huagao/ImageProcess/ImageApplyChannel.cpp @@ -63,10 +63,14 @@ void CImageApplyChannel::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; - apply(mats[0], 0); + if (!mats[0].empty()) { + apply(mats[0], 0); + } - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + if (isTwoSide && mats.size() > 1) { + if (!mats[1].empty()) + apply(mats[1], 1); + } } void CImageApplyChannel::except_channel(const cv::Mat & src, cv::Mat & dst, int channel) diff --git a/huagao/ImageProcess/ImageApplyCrop.cpp b/huagao/ImageProcess/ImageApplyCrop.cpp index 763da940..a95e63b5 100644 --- a/huagao/ImageProcess/ImageApplyCrop.cpp +++ b/huagao/ImageProcess/ImageApplyCrop.cpp @@ -41,8 +41,12 @@ void CImageApplyCrop::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; - apply(mats[0], 0); + if (!mats[0].empty()) { + apply(mats[0], 0); + } - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + if (isTwoSide && mats.size() > 1) { + if (!mats[1].empty()) + apply(mats[1], 1); + } } diff --git a/huagao/ImageProcess/ImageApplyDiscardBlank.cpp b/huagao/ImageProcess/ImageApplyDiscardBlank.cpp index ff768b79..7d28c26f 100644 --- a/huagao/ImageProcess/ImageApplyDiscardBlank.cpp +++ b/huagao/ImageProcess/ImageApplyDiscardBlank.cpp @@ -168,8 +168,12 @@ void CImageApplyDiscardBlank::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; - apply(mats[0], 0); + if (!mats[0].empty()) { + apply(mats[0], 0); + } - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + if (isTwoSide && mats.size() > 1) { + if (!mats[1].empty()) + apply(mats[1], 1); + } } \ No newline at end of file diff --git a/huagao/ImageProcess/ImageApplyResize.cpp b/huagao/ImageProcess/ImageApplyResize.cpp index ddf7e8f5..34073789 100644 --- a/huagao/ImageProcess/ImageApplyResize.cpp +++ b/huagao/ImageProcess/ImageApplyResize.cpp @@ -48,8 +48,12 @@ void CImageApplyResize::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; - apply(mats[0], 0); + if (!mats[0].empty()) { + apply(mats[0], 0); + } - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + if (isTwoSide && mats.size() > 1) { + if (!mats[1].empty()) + apply(mats[1], 1); + } } diff --git a/huagao/ImageProcess/ImageApplyRotation.cpp b/huagao/ImageProcess/ImageApplyRotation.cpp index e82fe2d0..f2706c6b 100644 --- a/huagao/ImageProcess/ImageApplyRotation.cpp +++ b/huagao/ImageProcess/ImageApplyRotation.cpp @@ -121,8 +121,12 @@ void CImageApplyRotation::apply(std::vector& mats, bool isTwoSide) { if (mats.empty()) return; - apply(mats[0], 0); + if (!mats[0].empty()) { + apply(mats[0], 0); + } - if (isTwoSide && mats.size() > 1) - apply(mats[1], 1); + if (isTwoSide && mats.size() > 1) { + if (!mats[1].empty()) + apply(mats[1], 1); + } }