I readed an image which type of it is CV_8UC1, and I want to convert it to CV_32FC1.but when I use convertTO() function my image become completely white and I don't know why!
Mat Image(512,512,CV_32FC1);
Image = imread("C:\\MGC.jpg",CV_LOAD_IMAGE_GRAYSCALE);
/// show image
namedWindow("pic");
int x = 0; int y = 0;
imshow("pic", Image);
cout<<Image.type()<<endl;
Image.convertTo(Image,CV_32FC1);
cout<<Image.type()<<endl;
////show converted image
namedWindow("pic1");
imshow("pic1",Image );
Because displayable range for 32FC type element images is [0:1] (for imshow). Try this.
Image.convertTo(Image,CV_32FC1, 1.0/255.0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With