美文网首页
混合两幅图像

混合两幅图像

作者: 看风景的人_21744 | 来源:发表于2017-10-20 20:21 被阅读0次
    
    #include "opencv2/imgcodecs.hpp"
    #include "opencv2/highgui.hpp"
    #include <iostream>
    using namespace cv;
    using namespace std;
    int main( void )
    {
       double alpha = 0.5; double beta; double input;
       Mat src1, src2, dst;
       cout << " Simple Linear Blender " << endl;
       cout << "-----------------------" << endl;
       cout << "* Enter alpha [0-1]: ";
       cin >> input;
       // We use the alpha provided by the user if it is between 0 and 1
       if( input >= 0 && input <= 1 )
         { alpha = input; }
       src1 = imread( "../data/LinuxLogo.jpg" );
       src2 = imread( "../data/WindowsLogo.jpg" );
       if( src1.empty() ) { cout << "Error loading src1" << endl; return -1; }
       if( src2.empty() ) { cout << "Error loading src2" << endl; return -1; }
       beta = ( 1.0 - alpha );
       addWeighted( src1, alpha, src2, beta, 0.0, dst);
       imshow( "Linear Blend", dst );
       waitKey(0);
       return 0;
    }
    

    addWeighted( src1, alpha, src2, beta, 0.0, dst) :


    相关文章

      网友评论

          本文标题:混合两幅图像

          本文链接:https://www.haomeiwen.com/subject/rvtbuxtx.html