How to convert an OpenCV cv::Mat
into a float*
that can be fed into Vlfeat vl_dsift_process:
Mat mat = imread("image_name.jpg", 0); // 0 stands for grayscale
vector<float> img;
for (int i = 0; i < mat.rows; ++i)
for (int j = 0; j < mat.cols; ++j)
img.push_back(mat.at<unsigned char>(i, j));
vl_dsift_process(dsift, &img[0]);
参考链接:http://stackoverflow.com/questions/7927105/how-to-convert-an-opencv-cvmat-into-a-float-that-can-be-fed-into-vlfeat-vl-ds/
时间: 2024-11-07 02:56:54