当前位置:网站首页>Image binarization processing of opencv
Image binarization processing of opencv
2022-07-31 06:32:00 【xp_fangfei】
opencvBinarization operation is divided into:There are two types of global threshold and local threshold.The image needs to be grayscaled before image binarization.
全局阈值
The global threshold is divided into:There are two types of manual threshold and automatic threshold.
手动阈值
opencv函数:
threshold(gray_src, dst, threshold_value, threshold_max,THRESH_BINARY);
//原图,目标图,known threshold(Threshold for comparison),阈值最大值,阈值类型(threshold()函数支持的对图像取阈值的方法由其确定)
There are methods for this function to threshold the image5种:
THRESH_BINARY:过门限的值为最大值,其他值为0

THRESH_BINARY_INV:过门限的值为0,其他值为最大值

THRESH_TRUNC:过门限的值为门限值,其他值不变

THRESH_TOZERO:过门限的值不变,其他设置为0

THRESH_TOZERO_INV:过门限的值为0,其他不变

自动阈值
Automatic thresholds are divided into大津法和三角形算法两种:
- 大津法
opencv函数:
threshold(gray_src,dst,0,255,cv.THRESH_BINARY | cv.THRESH_OTSU)
- 三角形算法
opencv函数:
threshold(gray_src,dst,0,255,cv.THRESH_BINARY | cv.THRESH_TRIANGLE)
局部阈值(自适应阈值)
There are two methods for calculating the local threshold::mean_c 和 guassian_c
- ADAPTIVE_THRESH_MEAN_C
opencv函数:
adaptiveThreshold(gray_src, dst, 255, cv::ADAPTIVE_THRESH_MEAN_C, cv::THRESH_BINARY, 57, 5);
- ADAPTIVE_THRESH_GAUSSIAN_C
opencv函数:
adaptiveThreshold(gray_src, dst, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 25, 10)
边栏推荐
猜你喜欢
随机推荐
After unicloud is released, the applet prompts that the connection to the local debugging service failed. Please check whether the client and the host are under the same local area network.
DSPE-PEG-Azide DSPE-PED-N3 Phospholipid-Polyethylene Glycol-Azide Lipid PFG
【Latex】TexLive+VScode+SumatraPDF 配置LaTex编辑环境
Tensorflow related list
深度学习知识点杂谈
禅道安装及使用教程
MySQL 出现 The table is full 的解决方法
IDEA控制台不能输入信息的解决方法
Navicat从本地文件中导入sql文件
Cholesterol-PEG-NHS NHS-PEG-CLS 胆固醇-聚乙二醇-活性酯可修饰小分子材料
Redis-哈希
mPEG-DSPE 178744-28-0 甲氧基-聚乙二醇-磷脂酰乙醇胺线性PEG磷脂
ImportError: cannot import name ‘Xxxx‘ from partially initialized module ‘xx.xx.xx‘
cv2.resize()是反的
超参数优化-摘抄
Tensorflow——演示
Web Screenshots and Reverse Proxy
opencv之图像二值化处理
Introduction to CLS-PEG-FITC Fluorescein-PEG-CLS Cholesterol-PEG-Fluorescein
人脸识别AdaFace学习笔记









