当前位置:网站首页>Opencv learning log 12 binarization of Otsu method
Opencv learning log 12 binarization of Otsu method
2022-07-06 15:42:00 【@Spring sauce】
Preface
This article focuses on opencv How to use Otsu method to binarize images in .
One 、 Binarization of Otsu method
// Third question Binarization of Otsu method
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
int main()
{
cv::Mat srcMat = imread("C://Users//john//Desktop//1.jpg", 0);
cv::Mat resMat;
// imshow("src", srcMat);
// threshold(srcMat, resMat, 100, 255, THRESH_OTSU); // Dajin law
threshold(srcMat, resMat, 100, 255, THRESH_BINARY); // Fixed threshold
// adaptiveThreshold(srcMat, resMat, 255, ADAPTIVE_THRESH_GAUSSIAN_C, THRESH_BINARY_INV, 15, 10); // The adaptive
imshow("res", resMat);
waitKey(0);
}
summary
1. The code can run directly , If you don't understand, please leave a message .
边栏推荐
- Leetcode notes - dynamic planning -day7
- 1010 things that college students majoring in it must do before graduation
- JS --- JS function and scope (II)
- Cost accounting [13]
- Learning record: how to perform PWM output
- csapp shell lab
- LeetCode#198. raid homes and plunder houses
- JS --- all basic knowledge of JS (I)
- Research Report on market supply and demand and strategy of China's medical chair industry
- MATLAB综合练习:信号与系统中的应用
猜你喜欢
随机推荐
Cost accounting [15]
Printing quality inspection and verification system Industry Research Report - market status analysis and development prospect forecast
Stm32 dossiers d'apprentissage: saisie des applications
Medical colposcope Industry Research Report - market status analysis and development prospect forecast
ucore lab5
Path problem before dynamic planning
Learning record: use stm32f1 watchdog
Alice and Bob (2021牛客暑期多校训练营1)
LeetCode#118. Yanghui triangle
Lab 8 file system
差分(一维,二维,三维) 蓝桥杯三体攻击
Accounting regulations and professional ethics [2]
用C语言写网页游戏
力扣刷题记录--完全背包问题(一)
The wechat red envelope cover designed by the object is free! 16888
ucore lab 6
Accounting regulations and professional ethics [4]
ucore lab7
LeetCode#198. raid homes and plunder houses
程序员的你,有哪些炫技的代码写法?