使用OpenCV函数cv2.threshold()可以实现二值化图片轮廓,具体代码如下:import cv2 image = cv2.imread('image.jpg') gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) ret, thresh = cv2.threshold(gray, 10, 255, cv2.THRESH_BINARY) contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) cv2.drawContours
python opencv 画出二值化图片轮廓具体代码
最新推荐文章于 2023-04-22 12:28:16 发布