2020-03-11 01:58:06 +00:00
|
|
|
#include "ImageApplyCrop.h"
|
|
|
|
|
|
|
|
CImageApplyCrop::CImageApplyCrop(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CImageApplyCrop::~CImageApplyCrop(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CImageApplyCrop::apply(cv::Mat& pDib,int side)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (pDib.empty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_roi.x < 0 || m_roi.y < 0 || m_roi.br().x >= pDib.cols || m_roi.br().y >= pDib.rows || m_roi.width == 0 || m_roi.height == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDib = pDib(m_roi).clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CImageApplyCrop::apply(std::vector<cv::Mat>& mats, bool isTwoSide)
|
|
|
|
{
|
|
|
|
if (mats.empty()) return;
|
|
|
|
|
2020-03-17 13:06:21 +00:00
|
|
|
if (!mats[0].empty()) {
|
|
|
|
apply(mats[0], 0);
|
|
|
|
}
|
2020-03-11 01:58:06 +00:00
|
|
|
|
2020-03-17 13:06:21 +00:00
|
|
|
if (isTwoSide && mats.size() > 1) {
|
|
|
|
if (!mats[1].empty())
|
|
|
|
apply(mats[1], 1);
|
|
|
|
}
|
2021-07-02 03:29:24 +00:00
|
|
|
}
|