import cv2
import matplotlib.pyplot as plt
img = cv2.imread("macro-photography-of-strawberry-934066.jpg")
gray_img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# otsu阈值
(t,thresh) = cv2.threshold(gray_img,0,255,cv2.THRESH_TOZERO_INV+cv2.THRESH_OTSU)
# 三角法阈值:由直方图凹凸性确定的阈值
(t,thresh1) = cv2.threshold(gray_im
2022-04-11 10:41:05
110KB
c
gray
nc
1