OpenCV draw an image over another image

前端 未结 4 464
礼貌的吻别
礼貌的吻别 2020-12-07 21:06

Is there an OpenCV function to draw an image over another image? I have one big image of Mat type. And I have a small image of Mat type (5x7<

4条回答
  •  一生所求
    2020-12-07 21:28

    Create a Region Of Interest within the big image and then copy the small image to that region:

    cv::Rect roi( cv::Point( originX, originY ), cv::Size( width, height ));
    cv::Mat destinationROI = bigImage( roi );
    smallImage.copyTo( destinationROI );
    

    If you are certain the small image fits into the big image then you could simply do:

    cv::Rect roi( cv::Point( originX, originY ), smallImage.size() );
    smallImage.copyTo( bigImage( roi ) );
    

提交回复
热议问题