gpt4 book ai didi

python - 特定对象识别。 [ python ]

转载 作者:行者123 更新时间:2023-12-02 16:54:29 24 4
gpt4 key购买 nike

我们的技术任务是识别输送机上的煤。

输入数据:有(或没有)煤的输送机的照片。
输出数据:具有传送带边界的已处理图像。
(下一步是识别输送机上的煤量)

我们尝试将图像处理为黑白,增加对比度,模糊,但是图像上有太多的“噪点”。那是第一个问题:如何消除图像上不需要的像素?

第二个问题:如何在图像上正确检测输送机(然后在其上运煤)?

源图像示例:

enter image description here

最佳答案

不确定这是否有帮助,但是您可以尝试使用霍夫变换找到三角形区域。

下面是示例:

  • 加载并将图像转换为灰色
  • 阈值并应用细化
  • Fit Hough转换

  • 例如,
    import cv2
    from skimage import morphology

    # Load image and convert to gray
    img = cv2.imread('test.jpg')
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    # Otsu threshold
    t, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)

    # Apply thinning
    thin = morphology.thin(thresh)
    show_img(thin, 'Thinned')

    # Hough transform: experiment with params here
    from skimage.transform import probabilistic_hough_line

    lines = probabilistic_hough_line(thin, threshold=100, line_length=10, line_gap=20)
    print('Total lines={0}'.format(len(lines)))

    # Plot lines over the input image
    for p1, p2 in lines:
    cv2.line(img, p1, p2, (255, 0, 0), 4)

    图片:
    enter image description here
    enter image description here
    enter image description here

    关于python - 特定对象识别。 [ python ],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49998281/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com