Hello I m using VS2013 and openvc 3.0
I'm trying to convert a image from CV::mat to float* I have found some code snippet but couldn't understand anything.. Here is the code snippet
`
#include<iostream>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img = imread("foggyHouse.jpg");
int height = img.rows;
int width = img.cols;
//conversion from cv::mat to float*
float* cpu_image = (float *)malloc((size+1) * 3 * sizeof(float));
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
for (int k = 0; k < 3; k++)
{
cpu_image[(i * width + j) * 3 + k] = img.at<Vec<float, 3> >(i, j)[k];
}
}
}
//converting back from float* cv::mat
Mat dest(height, width, CV_32FC1, cpu_image);
imwrite("output.jpg",dest);
return 0;
} ` the problem is I couldn't understand the logic behind the conversion from CV:MAT to float* n vice versa Can anyone explain me??