ncnn::Mat 转 cv::Mat
ncnn::Mat in = ncnn::Mat::from_pixels(a.data, ncnn::Mat::PIXEL_BGR2RGB, a.cols, a.rows);
cv::Mat 转ncnn::Mat
//You may need to call in.substract_mean_normalize() first to scale values from 0..1 to 0..255
// ncnn::Mat in(w, h, 3);
cv::Mat a(in.h, in.w, CV_8UC3);
in.to_pixels(a.data, ncnn::Mat::PIXEL_BGR2RGB);
参考:use ncnn with opencv · Tencent/ncnn Wiki · GitHub