首页 > 代码库 > 在VLFEAT中mat类型图片转换成constant float* 来进行vl_dsift_process

在VLFEAT中mat类型图片转换成constant float* 来进行vl_dsift_process

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 grayscalevector<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/

在VLFEAT中mat类型图片转换成constant float* 来进行vl_dsift_process