I am trying to use the OpenCV Mat::Mat constructor with the option of passing in data.
I have read on this forum that you can pass in a float pointer to an array, but every time I do that it tries to pass in the address (I think that is what is happening) rather than the actual values from the array.
I have tried two different way of creating the float array:
float *outputimg = (float*)malloc(img1.rows*img1.cols*sizeof(float));
and
float *outputimg = (float*)malloc(img1.step*img1.elemSize());
then I have tried the Mat constructor as follows:
Mat contrastimg(img1.rows, img1.cols, CV_32F, outputimg, img1.step);
Mat contrastimg(img1.rows, img1.cols, CV_32F, outputimg);
Mat contrastimg(img1.rows, img1.cols, CV_32F, outputimg, img1.cols*sizeof(float));
none of these are working for me. Any ideas?