opencv边界扩展

图像滤波中经常需要处理边界,opencv提供了一个边界扩展函数

#include <opencv2/opencv.hpp>

using namespace cv;
using namespace std;

void main()
{
    Mat src = imread("test.jpg");
    Mat makebordimg = src.clone();
    int sh2 = 20;
    int sw2 = 20;
    int top, bottom, left, right;
    int borderType = BORDER_REPLICATE;
    top = sh2;
    bottom = sh2;
    left = sw2;
    right = sw2;
    copyMakeBorder(src, makebordimg, top, bottom, left, right, borderType);
    imwrite("left_bord.jpg", makebordimg);
}

posted on 2015-07-10 19:16  Maddock  阅读(1047)  评论(0编辑  收藏  举报

导航