使用vlfeat库实现超像素分割时遇到麻烦

时间:2016-03-17 12:11:17

标签: c++ opencv vlfeat

我在这里看到了关于超像素分割的答案SLIC c++ segmentation

我想知道在哪里可以找到那里讨论的新C ++ api。

我实际上是从http://www.vlfeat.org/sandbox/download.html

获得的

这是我的代码:

#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
extern "C"{
#include<C:\\vlfeat\vl\slic.h>
#include"C:\\vlfeat\vl\slic.c"
}

using namespace cv;

int main()
{
    Mat img=imread("E:\\brush.jpg");
    Mat floatimg;
    img.convertTo(floatimg,CV_32FC3);
    Mat label(floatimg.size(),CV_32SC1);
    vl_slic_segment(label.ptr<vl_uint32>(),floatimg.ptr<float>(),floatimg.cols,floatimg.rows,floatimg.channels(),15,0.1,1);
    imshow("out", img);
    waitKey(0);
}

我目前面临的问题是, 我收到这些错误:

Error   2   error C2440: '=' : cannot convert from 'void *' to 'float *'    c:\vlfeat\vl\slic.c 203
Error   3   error C2440: '=' : cannot convert from 'void *' to 'vl_uint32 *'    c:\vlfeat\vl\slic.c 204
Error   4   error C2440: '=' : cannot convert from 'void *' to 'float *'    c:\vlfeat\vl\slic.c 205
Error   8   error C2440: 'initializing' : cannot convert from 'void *' to 'vl_uint32 *' c:\vlfeat\vl\slic.c 341
Error   9   error C2440: 'initializing' : cannot convert from 'void *' to 'vl_uindex *' c:\vlfeat\vl\slic.c 342
11  IntelliSense: a value of type "void *" cannot be assigned to an entity of type "float *"    c:\vlfeat\vl\slic.c 203
12  IntelliSense: a value of type "void *" cannot be assigned to an entity of type "vl_uint32 *"    c:\vlfeat\vl\slic.c 204
13  IntelliSense: a value of type "void *" cannot be assigned to an entity of type "float *"    c:\vlfeat\vl\slic.c 205
14  IntelliSense: a value of type "void *" cannot be used to initialize an entity of type "vl_uint32 *" c:\vlfeat\vl\slic.c 341
15  IntelliSense: a value of type "void *" cannot be used to initialize an entity of type "vl_uindex *" c:\vlfeat\vl\slic.c 342

0 个答案:

没有答案