【OpenCV笔记】图像预处理

对输入的任意一张图片要做预处理,本文的预处理主要有:灰度化、尺寸归一化、灰度直方图均衡化。

1、改变图片大小

(1)创建新图像

c函数接口:

 IplImage* cvCreateImage(CvSize size, int depth, int channels);

参数:

  • size – Image width and height 图像的大小
  • depth – Bit depth of image elements. 图像的深度,可以是IPL_DEPTH8U,IPL_DEPTH_16U等
  • channels – Number of channels per pixel. This function only creates images with interleaved channels. 图像的通道数

(2)图像变换大小

c函数接口:

void cvResize(const CvArr* src, CvArr* dst, int interpolation=CV_INTER_LINEAR )

参数:

  • src – input image.
  • dst – output image; the type of dst is the same as of src
  • interpolation –表示插值方法

    interpolation method:

    • INTER_NEAREST - a nearest-neighbor interpolation最近邻插值
    • INTER_LINEAR - a bilinear interpolation (used by default)双线性插值(缺省使用)
  • 3
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值