| 1 | initial version |
Use the following:
T* external_mem = .... // external memory of type T
cv::Mat wrapped(rows, cols, cv::DataType<T>::depth, external_mem, CV_AUTOSTEP); // does not copy
| 2 | No.2 Revision |
Use the following:
T* external_mem = .... // external memory of type T
cv::Mat wrapped(rows, cols, cv::DataType<T>::depth, external_mem, CV_AUTOSTEP); // does not copy
Or shorter if you know the type T, e.g. T = float:
float* external_mem = .... // external memory of type float
cv::Mat wrapped(rows, cols, CV_32FC1, external_mem, CV_AUTOSTEP); // does not copy
| 3 | No.3 Revision |
Use the following:
T* external_mem = .... // external memory of type T
cv::Mat wrapped(rows, cols, cv::DataType<T>::depth, external_mem, CV_AUTOSTEP); // does not copy
Or shorter if you know the type T, e.g. T = float:
float* external_mem = .... // external memory of type float
cv::Mat wrapped(rows, cols, CV_32FC1, external_mem, CV_AUTOSTEP); // does not copy
Remember to free/delete the pointer external_mem after usage. The Mat wrapped does not release the memory for you when it is destructed.
Use the following:
T* external_mem = .... // external memory of type T
cv::Mat wrapped(rows, cols, cv::DataType<T>::depth, cv::DataType<T>::type, external_mem, CV_AUTOSTEP); // does not copy
Or shorter if you know the type T, e.g. T = float:
float* external_mem = .... // external memory of type float
cv::Mat wrapped(rows, cols, CV_32FC1, external_mem, CV_AUTOSTEP); // does not copy
Remember to free/delete the pointer external_mem after usage. The Mat wrapped does not release the memory for you when it is destructed.