// #include "ImageStitch.h" // #include // using namespace cv; // ImageStitch::ImageStitch(int pixtype, int width, int heigth) : m_pixtype(pixtype), // m_width(width), // m_height(heigth) // { // } // ImageStitch::~ImageStitch() // { // } // cv::Mat ImageStitch::GetStitchImage(cv::Mat mat) // { // //cv::imwrite("orgmat.jpg",mat); // cv::Mat dst; // cv::Mat ch_mats[3]; // int dstwidth, dstheight; // dstwidth = m_width * 3; // dstheight = m_height / 3; // if (m_pixtype == IMAGE_COLOR) // { // //mat = cv::Mat(m_height / 3, m_width * 9, CV_8UC1, imgdata); // dst = cv::Mat(dstheight, dstwidth, CV_8UC3); // cv::Mat mat1 = mat(cv::Rect(m_width * 3 * 1, 0, m_width * 3, m_height / 3)); //R 对应红通道 // cv::Mat mat2 = mat(cv::Rect(m_width * 3 * 2, 0, m_width * 3, m_height / 3)); //G 对应绿通道 // cv::Mat mat3 = mat(cv::Rect(m_width * 3 * 0, 0, m_width * 3, m_height / 3)); //B 对应蓝通道 // ch_mats[0] = mat1; // ch_mats[1] = mat2; // ch_mats[2] = mat3; // cv::merge(ch_mats, 3, dst); // for (int i = 0; i < 3; i++) // ch_mats[i].release(); // LOG("merge mats end \n"); // return dst.clone(); // } // else // { //gray // return mat; // } // }