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);

}

你可能感兴趣的:(opencv)