cv::Mat 与 *data互转

int main()

{

Mat src = imread("C:\\Users\\Administrator\\Desktop\\TestImage\\clip_2.png");

const unsigned char *data = src.ptr<uchar>(0);

Mat dst;

dst = cv::Mat(src.rows, src.cols, CV_8UC3);

int imageSize = src.rows*src.cols*src.channels();

memcpy_s(dst.data, imageSize, data, imageSize);

namedWindow("output");

imshow("output", dst);

waitKey();

return 0;

}

猜你喜欢

转载自blog.csdn.net/qq_33628827/article/details/85765508