I'm refactoring some code from cimg to opencv. I have the following lines that should return Mat_<float>.data
.
// Get a pointer to the data.
// T* Data() { return image_.data(); } <-cimg calls
// const T* Data() const { return image_.data(); } <-cimg.calls
T* Data() { return image_.data; }
const T* Data() const { return image_.data; }
but I get a compile error:
error: cannot initialize return object of type 'float *' with an lvalue of type 'uchar *' (aka 'unsigned char *')
T* Data() { return image_.data; }
Other part of the code:
cv::Mat_<T> image_;
...
image_ = cv::imread(filename.c_str(), CV_LOAD_IMAGE_ANYCOLOR | CV_LOAD_IMAGE_ANYDEPTH);
From what I've read Mat.data is of type uchar. But shouldn't data be float when I use Mat_<float>
?
Thanks, Jason