subtract one image from another using openCV

前端 未结 4 1595
不思量自难忘°
不思量自难忘° 2020-12-30 07:50

How can I subtract one image from another using openCV?

Ps.: I coudn\'t use the python implementation because I\'ll have to do it in C++

4条回答
  •  清酒与你
    2020-12-30 08:20

    use cv::subtract() method.

    Mat img1=some_img;
    Mat img2=some_img;
    
    Mat dest;
    
    cv::subtract(img1,img2,dest); 
    

    This performs elementwise subtract of (img1-img2). you can find more details about it http://docs.opencv.org/modules/core/doc/operations_on_arrays.html

提交回复
热议问题