当前位置:网站首页>Opencv learning note 5 - gradient calculation / edge detection
Opencv learning note 5 - gradient calculation / edge detection
2022-07-07 08:23:00 【I am a little rice】
To get the outline , An image can be expanded first and then corroded , Then the result of expansion minus the result of corrosion .
1. Sobel
operator
dst = cv2.Sobel(src, ddepth, dx, dy, ksize)
ddepth
: The depth of the imagedx
nucleusdy
Horizontal and vertical directions respectivelyksize
yesSobel
Operator size
image1 = cv2.imread('./ro.png')
plt.imshow(image1);
image1 = cv2.imread('./ro.png')
plt.imshow(image1);
image2 = cv2.Sobel(image1, cv2.CV_64F, 1, 0, ksize=3)
plt.imshow(image2);
The convolution calculation from white to black is positive , The convolution calculation from black to white is negative , All negative numbers will be truncated to 0
, So take the absolute value
Calculation x
Direction gradient
image2 = cv2.Sobel(image1, cv2.CV_64F, 1, 0, ksize=3)
image2 = cv2.convertScaleAbs(image2)
plt.imshow(image2);
Calculation x
Direction gradient
image3 = cv2.Sobel(image1, cv2.CV_64F, 0, 1, ksize=3)
image3 = cv2.convertScaleAbs(image3)
plt.imshow(image3);
Get the outline of the image
image4 = cv2.addWeighted(image2, 0.5, image3, 0.5, 0)
plt.imshow(image4);
Try another picture
import cv2
import matplotlib.pyplot as plt
image = cv2.imread('image.png')
image2 = cv2.Sobel(image, cv2.CV_64F, 1, 0, ksize=3)
image2 = cv2.convertScaleAbs(image2)
image3 = cv2.Sobel(image, cv2.CV_64F, 0, 1, ksize=3)
image3 = cv2.convertScaleAbs(image3)
image4 = cv2.addWeighted(image2, 0.5, image3, 0.5, 0)
image4 = cv2.cvtColor(image4, cv2.COLOR_BGR2RGB)
plt.imshow(image4);
2. Scharr
operator
The usage is the same , But the calculated value will be relatively large , Will be more sensitive
3. laplacian
operator
边栏推荐
- ROS bridge notes (05) - Carla_ ackermann_ Control function package (convert Ackermann messages into carlaegovehiclecontrol messages)
- Practice of combining rook CEPH and rainbow, a cloud native storage solution
- Practice of implementing cloud native Devops based on rainbow library app
- 【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器
- 数据中台落地实施之法
- 提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
- Famine cloud service management script
- opencv学习笔记四——膨胀/腐蚀/开运算/闭运算
- 船载雷达天线滑环的使用
- Myabtis_ Plus
猜你喜欢
一种适用于应用频繁测试下快速查看Pod的日志的方法(grep awk xargs kuberctl)
藏书馆App基于Rainbond实现云原生DevOps的实践
轻松上手Fluentd,结合 Rainbond 插件市场,日志收集更快捷
使用BiSeNet实现自己的数据集
PVTV2--Pyramid Vision TransformerV2学习笔记
One click deployment of highly available emqx clusters in rainbow
解析机器人科技发展观对社会研究论
Practice of combining rook CEPH and rainbow, a cloud native storage solution
Application of slip ring of shipborne radar antenna
DeiT学习笔记
随机推荐
柯基数据通过Rainbond完成云原生改造,实现离线持续交付客户
在Rainbond中一键部署高可用 EMQX 集群
opencv学习笔记五——梯度计算/边缘检测
解析创新教育体系中的创客教育
Detailed explanation of apply, also, let, run functions and principle analysis of internal source code in kotlin
饥荒云服管理脚本
在Rainbond中实现数据库结构自动化升级
Complete linear regression manually based on pytoch framework
[quick start of Digital IC Verification] 11. Introduction to Verilog testbench (VTB)
IELTS review progress and method use [daily revision]
Interpreting the practical application of maker thinking and mathematics curriculum
offer收割机:两个长字符串数字相加求和(经典面试算法题)
电池、电机技术受到很大关注,反而电控技术却很少被提及?
Rsync remote synchronization
MES系統,是企業生產的必要選擇
通俗易懂单点登录SSO
Transformation function map and flatmap in kotlin
Complex network modeling (II)
Famine cloud service management script
【Go ~ 0到1 】 第七天 获取时间戳,时间比较,时间格式转换,Sleep与定时器