Copy an cv::Mat inside a ROI of another one

前端 未结 3 1062
暖寄归人
暖寄归人 2020-11-27 14:58

I need to copy a cv::Mat image (source) to an ROI of another (Destination) cv::Mat image.

I found this reference, but it seems that it does

3条回答
  •  攒了一身酷
    2020-11-27 15:21

    OpenCV 2.4:

    src.copyTo(dst(Rect(left, top, src.cols, src.rows)));
    

    OpenCV 2.x:

    Mat dst_roi = dst(Rect(left, top, src.cols, src.rows));
    src.copyTo(dst_roi);
    

提交回复
热议问题