前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >OpenCV的 60 种图像效果,一篇文章搞定

OpenCV的 60 种图像效果,一篇文章搞定

作者头像
AI算法与图像处理
发布2021-02-05 11:13:45
8500
发布2021-02-05 11:13:45
举报
代码语言:javascript
复制
推荐阅读31个Python实战项目教你掌握图像处理,PDF开放下载opencv_contrib扩展模块中文教程pdf,限时领取

最近在B站看到一个视频关于OpenCV 中的60 种,图像处理,总结的非常棒,因此分享给小伙伴们!

项目:https://github.com/dyh/opencv_tools

接下来我们详细看一下这个项目中到底包含了哪些内容。

一分钟视频:

图像色彩

image_color.py

  • 色度/色调
  • 饱和度
  • 纯度/亮度
  • 固定饱和度s
  • 固定亮度v
  • 固定色度h + 固定饱和度s
  • 固定色度h + 固定亮度v
  • 固定饱和度s + 固定亮度v

图像变换

image_transformation.py

  • 形态学滤波器腐蚀和膨胀图像
  • 腐蚀 3x3
  • 膨胀 3x3 3次
  • 腐蚀 7x7
  • 腐蚀 3x3 3次
  • 形态学滤波器开启和闭合图像
  • Close the image
  • Open the image
  • 灰度图像中应用形态学运算 Gradient | Edge
  • Apply threshold to obtain a binary image
  • 7x7 Black Top-hat Image
  • Apply threshold to obtain a binary image
  • Apply the black top-hat transform using a 7x7 structuring element

图像滤波器

image_filtering.py

  • Blur the image with a mean filter
  • Blur the image with a mean filter 9x9
  • 缩减 采样
  • resizing with NN
  • resizing with bilinear
  • 中值滤波
  • 定向滤波器
  • Compute Sobel X derivative
  • Compute Sobel Y derivative
  • Compute norm of Sobel
  • Compute Sobel X derivative (7x7)
  • Apply threshold to Sobel norm (low threshold value)
  • Apply threshold to Sobel norm (high threshold value)
  • down-sample and up-sample the image
  • down-sample and up-sample the image
  • cv2.subtract
  • cv2.subtract gauss15 - gauss05
  • cv2.subtract gauss22 - gauss20

提取直线、轮廓、区域

image_outline.py

  • Canny Contours
  • Canny Contours Gray
  • Hough tranform for line detection
  • Circles with HoughP
  • Get the contours, Contours with RETR_LIST

图像增强-白平衡等

image_enhancement.py

  • 简单白平衡
  • 灰度世界算法
  • 直方图均衡化
  • 视网膜-大脑皮层(Retinex)增强算法
  • Single Scale Retinex
  • Multi Scale Retinex
  • Multi Scale Retinex With Color Restoration
  • 自动白平衡 AWB
  • 自动色彩均衡 ACE

运行环境

python 3.6+,pip 20+

pip install -r requirements.txt

代码语言:javascript
复制
Pillow==8.0.1
numpy==1.19.4
opencv-python==4.4.0.46
six==1.15.0
matplotlib==3.3.3
cycler==0.10.0
kiwisolver==1.3.1
pkg-resources==0.0.0
pyparsing==2.4.7
python-dateutil==2.8.1

如何运行

克隆代码

进入目录

创建 python 虚拟环境

激活虚拟环境

升级pip

安装软件包

在 main.py 文件中,设置要处理的图片路径 file_path,例如

运行程序

程序将在 output 目录下输出60张图片

是不是非常的实用

利用现有的工具提高效果,如果对你有帮助,可以给我来三连!

代码语言:javascript
复制
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2021-02-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 AI算法与图像处理 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档