uchar* cv::Mat::data
returns a pointer to the data of Mat. But the pointer type is uchar. Taking the following code as an example, what I need is float type pointer because the dtype is CV_32FC1. How can I get the float pointer to the data of CV_32F Mat.
int main()
{
float src[75];
for (int i = 0; i < 75; i++)
{
src[i] = (float)i;
}
auto B = cv::Mat(Size(3, 25), CV_32FC1, src);
const uchar* dataindex = B.datastart;
int index = 0;
while (dataindex != B.dataend)
{
printf("Index:%d, Data:%d\n", index, * dataindex);
dataindex++;
}