我在图像中收集了对象。
我想找到每个对象的轮廓。我正在按照以下方法使用OpenCV2识别轮廓
gray = cv2.cvtColor(input_image, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 0)
edged = cv2.Canny(gray, 50, 100)
dilate= cv2.dilate(edged, None, iterations=1)
erode= cv2.erode(dilate, None, iterations=1)
cnts = cv2.findContours(erode, cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
这是我为上述代码得到的轮廓输出:
有没有更好的方法来识别图像中的物体?
相关分类