像这样的一副图片, 我想用 opencv 把道路的坐标确定出来应该怎么操作? 我从网上找了这个识别轮廓的代码,
import numpy as np
import cv2
im = cv2.imread('path.png')
imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(imgray,127,255,0)
im2, contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.namedWindow("Contours", cv2.WINDOW_NORMAL)
cv2.imshow("Contours", im2)
cv2.drawContours(im, contours, -1, (0,255,0), 3)
cv2.drawContours(im, contours, 3, (0,255,0), 3)
cnt = contours[4]
cv2.drawContours(im, [cnt], 0, (0,255,0), 3)
# 等待键盘输入
cv2.waitKey(0)
cv2.destroyAllWindows()

得到的结果是黑的... 所以我想知道如何获取这个道路的位置。~
