您的位置:首页 > 运维架构

OpenCV学习十六:copyMakeBorder 边缘处理

2018-02-24 10:26 519 查看
void copyMakeBorder(
InputArray src, 输入
OutputArray dst, 输出
int top, 上边框
int bottom, 下边框
int left, 左边框
int right, 右边框
int borderType, 边框类型
const Scalar& value=Scalar() 填充颜色
)
常用的边框类型:
BORDER_CONSTANT - 填充指定像素
BORDER_REPLICATE - 用已知的边缘像素值
BORDER_WRAR - 用另外一边填充
其它见 opencv学习六#include <opencv2/opencv.hpp>
#include <stdio.h>
#include <stdlib.h>

using namespace cv;
using namespace std;

char file[] = "1.jpg";
int main(int argc, char** argv)
{
Mat img = imread(file, -1);
pyrDown(img, img, Size(img.cols/2, img.rows/2));
imshow("1",img);

Mat out;
copyMakeBorder(img, out, 10, 10, 10, 10, BORDER_REPLICATE);
imshow("2",out);imwrite("2.jpg", out);

waitKey();
return 1;
} 原图



2.jpg

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  copyMakeBorder