mirror of http://192.168.1.51:8099/lmh188/twain3.0
37 lines
798 B
C++
37 lines
798 B
C++
|
#include "ImageApplySplit.h"
|
||
|
#include <vector>
|
||
|
|
||
|
CImageApplySplit::CImageApplySplit()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
CImageApplySplit::~CImageApplySplit(void)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
std::vector<cv::Mat> CImageApplySplit::apply(cv::Mat& pDib)
|
||
|
{
|
||
|
if (pDib.empty())
|
||
|
return std::vector<cv::Mat>();
|
||
|
std::vector<cv::Mat> retMats;
|
||
|
int heigth = pDib.rows;
|
||
|
int width = pDib.cols;
|
||
|
if (heigth > width)
|
||
|
{
|
||
|
cv::Mat matF = pDib(cv::Rect(0, 0, width, (int)(0.5 * heigth)));
|
||
|
cv::Mat matB = pDib(cv::Rect(0, (int)(0.5 * heigth), width, (int)(0.5 * heigth)));
|
||
|
retMats.push_back(matF);
|
||
|
retMats.push_back(matB);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
cv::Mat matF = pDib(cv::Rect(0, 0, (int)(width*0.5), heigth));
|
||
|
cv::Mat matB = pDib(cv::Rect((int)(width*0.5), 0, (int)(width * 0.5), heigth));
|
||
|
retMats.push_back(matF);
|
||
|
retMats.push_back(matB);
|
||
|
}
|
||
|
return retMats;
|
||
|
}
|
||
|
|