NCNN和OPENCV 数据互相转换

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

上一篇:shell脚本实现hive增量加载


下一篇:java简易爬虫Crawler