OpenCV's Mat has a pointer to its data. Armadillo has a constructor that is capable of reading from external data. It's easy to put them together. Remember that Armadillo stores in column-major order, whereas OpenCV uses row-major. I suppose you'll need to add another step for transformation, before or after.
OpenCV's
Mat
has a pointer to its data. Armadillo has a constructor that is capable of reading from external data. It's easy to put them together. Remember that Armadillo stores in column-major order, whereas OpenCV uses row-major. I suppose you'll need to add another step for transformation, before or after.The
cv::Mat
constructor has a form that accepts pointer to data, andarma::mat
has a function for a double* pointer to its data called memptr().So, if you'd like to convert from
arma::mat
tocv::Mat
, this should work: