Skip to content

Commit 839db84

Browse files
authored
Add files via upload
1 parent 50cb44f commit 839db84

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# coding: utf-8
2+
# 2021-05-17 Eastmount CSDN
3+
import numpy as np
4+
import cv2
5+
from matplotlib import pyplot as plt
6+
7+
#读取原始图像
8+
img = cv2.imread('test01.png')
9+
10+
#图像灰度化处理
11+
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
12+
13+
#图像阈值化处理
14+
ret, thresh = cv2.threshold(gray, 0, 255,
15+
cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
16+
17+
#显示图像
18+
cv2.imshow('src', img)
19+
cv2.imshow('res', thresh)
20+
cv2.waitKey()
21+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)