【opencv 官方教程】翻译3 图像处理 上

本文介绍了使用OpenCV进行图像处理的基本方法,包括平滑处理、边缘检测、阈值操作等核心功能,并详细讲解了如何利用这些功能实现图像的增强与分析。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

图像处理

 平滑处理

  • Smoothing Images

    Compatibility: > OpenCV 2.0

    Author: Ana Huamán

    Let's take a look at some basic linear filters!

以分布位置为坐标,按照正态分布的值为权重,重新填充每个像素,以拉近相邻像素之间的值。

g(i,j)=k,lf(i+k,j+l)h(k,l)

 蚀刻和扩张

  • Eroding and Dilating

    Compatibility: > OpenCV 2.0

    Author: Ana Huamán

    Let's change the shape of objects!


Morphology_1_Tutorial_Theory_Original_Image.png Morphology_1_Tutorial_Theory_Dilation.png
Morphology_1_Tutorial_Theory_Dilatation_2.png
蚀刻是将深色部分减少
扩张是把亮色部分减少

图像缩放

  • Image Pyramids

    Compatibility: > OpenCV 2.0

    Author: Ana Huamán

    What if I need a bigger/smaller image?

                                                                                 Pyramids_Tutorial_Pyramid_Theory.png
    1161464141624164624362464162416414641
Use the OpenCV functions cv::pyrUp and cv::pyrDown to downsample or upsample a given image.
通过上面的函数放大或者缩小图片

阈值操作

  • Basic Thresholding Operations

    Compatibility: > OpenCV 2.0

    Author: Ana Huamán

    After so much processing, it is time to decide which pixels stay!



Threshold_Tutorial_Theory_Base_Figure.png如同电路中的触发器, cv::threshold这个功能通过特定阈值,将图像进行二值化操作
Perform basic thresholding operations using OpenCV function cv::threshold
类比于threshold,inRange函数提供了一个区间不必从极限值开始的阈值界定方法,使程序进行二值化时关注于是否处于区间内。
Perform basic thresholding operations using OpenCV function cv::inRange

自定义线性变换、加边框

属于简单的小练手,可以进入官网尝试一下

梯度

  • Sobel Derivatives

    Compatibility: > OpenCV 2.0

    Author: Ana Huamán

    Where we learn how to calculate gradients and use them to detect edges!

获取图片轮廓用的

关键步骤

  • Use the OpenCV function cv::Sobel to calculate the derivatives from an image.
  • Use the OpenCV function cv::Scharr to calculate a more accurate derivative for a kernel of size 33

拉普拉斯变换

 
  • Laplace Operator

    Compatibility: > OpenCV 2.0

    Author: Ana Huamán

    Where we learn about the Laplace operator and how to detect edges with it.


上面一部分从一阶导数中获取了图像变化强烈程度的信息,也就是梯度,这一部分获取变化程度的变化程度,即二阶导数(通过拉普拉斯变换)
据描述,这个功能:1具有表现轮廓的能力;2增强了色彩差别不大的部分的轮廓表现效果。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值