import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('coin.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
print(thresh.shape)
# cv2.imshow(thresh)
# cv2.waitKeyai(0)
# cv2.destroyAllWindows()
plt.
python opencv 分水岭算法对图像进行分割
最新推荐文章于 2025-03-03 17:44:58 发布