• OpenCV 对两幅图像求和(求混合(blending))


     1 #include <cv.h>
     2 #include <highgui.h>
     3 #include <iostream>
     4 
     5 using namespace cv;
     6 
     7 int main( int argc, char** argv )
     8 {
     9  double alpha = 0.5; double beta; double input;
    10 
    11  Mat src1, src2, dst;
    12 
    13  /// Ask the user enter alpha
    14  std::cout<<" Simple Linear Blender "<<std::endl;
    15  std::cout<<"-----------------------"<<std::endl;
    16  std::cout<<"* Enter alpha [0-1]: ";
    17  std::cin>>input;
    18 
    19  /// We use the alpha provided by the user iff it is between 0 and 1
    20  if( alpha >= 0 && alpha <= 1 )
    21    { alpha = input; }
    22 
    23  /// Read image ( same size, same type )
    24  src1 = imread("../../images/LinuxLogo.jpg");
    25  src2 = imread("../../images/WindowsLogo.jpg");
    26 
    27  if( !src1.data ) { printf("Error loading src1 
    "); return -1; }
    28  if( !src2.data ) { printf("Error loading src2 
    "); return -1; }
    29 
    30  /// Create Windows
    31  namedWindow("Linear Blend", 1);
    32 
    33  beta = ( 1.0 - alpha );
    34  addWeighted( src1, alpha, src2, beta, 0.0, dst);
    35 
    36  imshow( "Linear Blend", dst );
    37 
    38  waitKey(0);
    39  return 0;
    40 }
  • 相关阅读:
    java设计模式----代理模式
    其他技术----nginx开光
    Less的使用
    C++ 引用和指针
    leetcode 220 Contains Duplicate
    python网络数据采集1
    404
    前端知识点
    tcl自动生成fifo empty checker
    漫话:如何给女朋友解释什么是"大案牍术"?
  • 原文地址:https://www.cnblogs.com/ybqjymy/p/12170886.html
Copyright © 2020-2023  润新知