1. 首页
  2. 数据库
  3. 其它
  4. 基于OTSU与三角阈值的方法分割彩色图像(opencv python)

基于OTSU与三角阈值的方法分割彩色图像(opencv python)

上传者: 2020-12-25 03:39:27上传 PDF文件 109.88KB 热度 27次
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
用户评论