liuliu / ccv

C-based/Cached/Core Computer Vision Library, A Modern Computer Vision Library
http://libccv.org
Other
7.07k stars 1.71k forks source link

cv::Mat to ccv_dense_matrix_t* #226

Closed carlosost closed 3 years ago

carlosost commented 3 years ago

Is there a way to convert an image from cv::Mat format into a ccv_dense_matrix_t*?

liuliu commented 3 years ago

Either use the last ccv_read method to copy that buffer over: https://libccv.org/lib/ccv-io/#ccvread-2 or use ccv_dense_matrix_new to pass the proper formatted buffer (i.e., not owned, you have to make sure the lifetime is correct) in the last parameter: https://libccv.org/lib/ccv-memory/#ccvdensematrixnew