You need to allocate storage for seg
correctly. If you are going to use the C++ API as in berak's answer, (which I also recommend) you could create a Mat
to hold the label data to make later access easier and automatically manage memory:
cv::Mat labels(floatimg.size(), CV_32SC1); // Mat doesn't support 32-bit unsigned directly, but this should work fine just to hold data.
vl_slic_segment(labels.ptr<vl_uint32>(),floatimg.ptr<float>(),floatimg.cols,floatimg.rows,floatimg.channels(),15,0.1,1);
If for some reason you don't want to do that, you would allocate a chunk of raw memory like this (not recommended):
vl_uint32* seg = new vl_uint32[floatimg.total()]; // don't forget to delete[]
Or if you decide to continue with the C API, you would use malloc
(really not recommended):
vl_uint32* seg = (vl_uint32*)malloc(img->height * img->width); // don't forget to free()