copencvcomputer-vision

How to convert an OpenCV cv::Mat into a float* that can be fed into Vlfeat vl_dsift_process ?


How to convert an OpenCV cv::Mat into a float* that can be fed into Vlfeat vl_dsift_process? I cannot understand how vl_dsift_process works on a one-dimensional float array. The official samples only demonstrate how to use MatLab API. It seems that there are no samples about C API, and the only clue is the MEX file in the source package.


Solution

  • float* matData = (float*)myMat.data;

    Make sure the matrix is not deleted/goes out of scope before finishing using the pointer to data. And make sure the matrix contain floats.