基于OTSU与三角阈值的方法分割彩色图像(opencv python)
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
用户评论