How to resize Float Matrix in OpenCV
I have a Mat object of type CV_32FC1 of size 300x300 ....
I tried :
B=Mat::ones(rows,cols,CV_32FC1)*100;
...process B...
Mat res_B=Mat::zeros(480,640,CV_32FC1);
resize(B, res_B, Size(640,480), 0, 0, INTER_CUBIC);
How to resize it to size 640x480 ?? When I used the resize() function in OpenCV it doesnt seem to work...Any suggestions??
what exactly does not work ?
I could reproduce your code and it works. I printed the matrix using the following code:
cv::namedWindow("Display Image", CV_WINDOW_AUTOSIZE); imshow("Display Image", res_B); waitKey(0);
@berak All values in res_B are 100.... But after processing B contains several floating point nos... In the resized Mat res_B it is not !!
@Nyenna Did you use Float Mat ??? I think,imshow function supports only CV_8UC1 ..
I used the very same code that you posted (without the processing part, of course). Are you sure you process B correctly? Can you verify that you do by showing the image just before the
resize()
line?No...aftr processing there will be floating values in Mat.... You manually assign certain pixels with float values such as 21.11,19.33,88.43 and then resize ...and display...do you get same result???