【问题标题】:How to detect street lines in satellite aerial image using openCV?如何使用openCV检测卫星航拍图像中的街道线?
【发布时间】:2019-09-11 06:44:12
【问题描述】:

我是 openCV 的新手,我必须检测卫星图像中的街道线

这是原图

我应用了不同的阈值,我能够区分背景和 fg

retval, threshold = cv2.threshold(img1,150, 255, cv2.THRESH_BINARY)
plt.imshow(threshold)

在此之后,我进行了平滑处理以消除 HoughLines 的噪声

# Initialize output
out = cv2.cvtColor(threshold, cv2.COLOR_GRAY2BGR)

# Median blurring to get rid of the noise; invert image
threshold_blur = 255 - cv2.medianBlur(threshold, 5)

plt.imshow(threshold_blur,cmap='gray', vmin = 0, vmax = 255)

现在当我应用霍夫线时,我得到了这个

# Detect and draw lines
lines = cv2.HoughLinesP(threshold_blur, 1, np.pi/180, 10, minLineLength=10, maxLineGap=100)
for line in lines:
    for x1, y1, x2, y2 in line:
        cv2.line(out, (x1, y1), (x2, y2), (0, 0, 255), 2)

plt.imshow(out)

我需要这样的线条

为什么它不起作用,我该怎么办?

【问题讨论】:

  • 你试过反转图像吗?很可能是霍夫线变换期望图像具有深色背景和浅色线条。

标签: python opencv image-processing hough-transform


【解决方案1】:

不确定您是否只想使用 openCV 来执行此操作,您可能还想使用 tensorflow 之类的东西。

但如果您只想使用 openCV,这里有几个选项:

你可以试试dilate and erode。并使用findContours,并循环遍历这些轮廓以找到具有特定最小长度的对象,并使用它来创建从 A 到 B 的线。

另一种解决方案是训练一个cascade 来检测属于街道的部分图像并连接这些点。不过这要花很多时间。

【讨论】:

  • 这些级联也可以用于图像分割吗?
猜你喜欢
  • 2021-10-30
  • 2014-02-25
  • 1970-01-01
  • 1970-01-01
  • 2017-10-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-29
相关资源
最近更新 更多