I have a uchar* raw
from an API which represents an image raw data. The width, height and number of channels of this raw
is already known. I have already pre-allocated an cv::Mat (OpenCV) with this width and height.
My question is - how is it possible to set raw into this cv::Mat. I would like to copy raw into cv::Mat instead of just switching pointers. Is there a function to accomplish this or I need to do so manually myself?
我想这不是最复杂的方法,但它应该工作:
uchar* raw; cv::Mat image(size, type, raw); image = image.clone();
cv::Mat mat(cv::Size(width, height), CV_8UC1, raw, cv::Mat::AUTO_STEP);
copiedImage = mat.clone();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.