Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

imwrite a Mat_float keeping the image.

$
0
0
I at moment trying to save a Mat which is given the type Mat_.. When i try to save it it saver an black image, but imshow shows that the image isn't black at all. Is there a way to save the image even though it has the type Mat_float? I am not sure whether this is going to help but there is the function where i want to save the image void fft2(Mat_ src) { int x = getOptimalDFTSize(2* src.rows ); int y = getOptimalDFTSize(2* src.cols ); copyMakeBorder(src, src, 0, (x - src.rows), 0, (y - src.cols), BORDER_CONSTANT, Scalar::all(0)); // Get padded image size const int wx = src.cols, wy = src.rows; const int cx = wx/2, cy = wy/2; //--------------------------------// // DFT - performing // cv::Mat_ imgs[] = {src.clone(), Mat::zeros(src.size(), CV_32F)}; cv::Mat_ img_dft; merge(imgs,2,img_dft); dft(img_dft, img_dft); split(img_dft,imgs); cv::Mat_ magnitude, phase; cartToPolar(imgs[0],imgs[1],magnitude,phase); dftshift(magnitude); magnitude = magnitude + 1.0f; log(magnitude,magnitude); normalize(magnitude,magnitude,0,1,CV_MINMAX); namedWindow("img_dft",WINDOW_NORMAL); imshow("img_dft",magnitude); //imwrite waitKey(0); cout << "out" << endl; } Here is the function which is intended to be used for outputting the images.. but the images i save always becomes black..

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>