Typically if my data is non-const, I can initialize a cv::Mat header on top of it for algebraic manipulation.
float awesome_data[24] = {0};
cv::Mat awesome_mat = cv::Mat(6, 4, CV_32F, awesome_data);
But, if my data is const
const float awesome_data[24] = {0};
cv::Mat awesome_mat = cv::Mat(6, 4, CV_32F, awesome_data);
will have an error: unable to convert from const void * to void *
. I know that I won't be changing awesome_mat, what is the best way to do this?
Currently, I have to do a const cast
const float awesome_data[24] = {0};
cv::Mat awesome_mat = cv::Mat(6, 4, CV_32F, const_cast<float *>(awesome_data));