Im trying to segment an image using SLIC in OpenCV. Im trying to use the following function:
void vl_slic_segment ( vl_uint32 * segmentation,
float const * image,
vl_size width,
vl_size height,
vl_size numChannels,
vl_size regionSize,
float regularization,
vl_size minRegionSize
)
the #include is fine and the linking to libraries is fine. I just need to know how can I pass the image to this function. the image parameter in this function is of type float const *
and I dont know how to convert the image to this type.
Here is how i am loading the image into the code:
IplImage *image = cvLoadImage("train.tif", 1);
and here is the whole code:
extern "C" {
#include </home/me/Downloads/vlfeat-0.9.17/vl/slic.h>
}
#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2/opencv.hpp>
#include<opencv/highgui.h>
using namespace std;
using namespace cv;
int main () {
IplImage *image = cvLoadImage("train.tif", 1);
vl_uint32 * seg;
vl_slic_segment(seg,(const float *)image,image->width,image->height,image->nChannels,15,0.1,1);
waitKey(0);
}
and also i dont know if i am using the vl_uint32 * seg
correctly. Please if someone has an example or sample code to do this segmentation.
Thanks !!