当前位置:网站首页>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)
边栏推荐
- Shell/Vim related list
- np.fliplr与np.flipud
- 浏览器中的画中画(Picture-in-Picture)API
- MySQL 入门:Case 语句很好用
- Software Testing Interview Questions 2021
- 活体检测PatchNet学习笔记
- Pytorch学习笔记7——处理多维特征的输入
- cocos2d-x implements cross-platform directory traversal
- The solution to the IDEA console not being able to enter information
- ROS之service传输图片
猜你喜欢
随机推荐
ImportError: cannot import name ‘Xxxx‘ from partially initialized module ‘xx.xx.xx‘
DSPE-PEG-Azide DSPE-PED-N3 磷脂-聚乙二醇-叠氮脂质PFG
CAS:1403744-37-5 DSPE-PEG-FA 科研实验用磷脂-聚乙二醇-叶酸
opencv之图像二值化处理
Attention based ASR(LAS)
cv2.resize()是反的
应用usb_cam同时打开多个摄像头方法
UR3机器人雅克比矩阵
CLS-PEG-FITC Fluorescein-PEG-CLS 胆固醇-聚乙二醇-荧光素简介
Word vector - demo
Solution for MySQL The table is full
禅道安装及使用教程
Talking about the understanding of CAP in distributed mode
pyspark.ml feature transformation module
Web Screenshots and Reverse Proxy
Tensorflow steps on the pit while using it
数据分析之SQL面试真题
多元线性回归方程原理及其推导
钉钉H5微应用免登鉴权
random.randint函数用法









