stereolabs / zed-opencv

ZED SDK interface sample for OpenCV
https://www.stereolabs.com/docs/opencv/
MIT License
137 stars 79 forks source link

Convert cv::Mat to sl::Mat #33

Closed naiveHobo closed 6 years ago

naiveHobo commented 7 years ago

How do I convert a cv::Mat object to an sl::Mat object?

WASCHMASCHINE commented 7 years ago

Why do you need to go from cv to sl?

Take a look at the API: https://www.stereolabs.com/developers/documentation/API/classsl_1_1Mat.html#details

Mat ( size_t width, size_t height, MAT_TYPE mat_type, sl::uchar1 * ptr, size_t step, MEM memory_type = MEM_CPU )

Seems promising, just make sure the type matches like in the source code (slMat2cvMat function). cv::Mats have a .data() pointer and and .step.