Home Mat.convertTo is not giving me expected result in OpenCv
Reply: 0

Mat.convertTo is not giving me expected result in OpenCv

t4taurus
1#
t4taurus Published in 2017-12-06 22:19:58Z

After usage of the method convertTo(Mat,CV_32F), image become white or something not expecting. I am testing this code hosted on githup Face Morph

    string filename1("G:\cppprojects\VSOpencvTest\x64\Debug\hillary_clinton.jpg");
    string filename2("G:\cppprojects\VSOpencvTest\x64\Debug\ted_cruz.jpg");
    //alpha controls the degree of morph
    double alpha = 0.5;
    //Read input images
    Mat img1 = imread(filename1);
    Mat img2 = imread(filename2);
    imshow("f1", img1);
    imshow("f2", img2);
    waitKey(); // here I can see the images in proper format and look
    //convert Mat to float data type
    img1.convertTo(img1, CV_32F);
    img2.convertTo(img2, CV_32F);
    imshow("f1",img1);
    imshow("f2", img2);
    waitKey();
    // after conversion to 32F format, images become almost white

Is this result is normal using convertTo ?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.327502 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO