车道线检测识别 [园区道路线检测识别](开源github,欢迎stared)

**

车道线检测识别 [园区道路线检测识别](开源github,欢迎stared)(https://github.com/ZubinHuang/StartUpHub_RoadLaneDetect)

主要实现道路线区域覆盖

依赖库 Python3.6 OpenCV3 numpy moviepy matplotlib

#主要代码 python3 pipeline.py
import os
import cv2
import utils
import matplotlib.pyplot as plt
import numpy as np
from moviepy.editor import VideoFileClip
import line

def thresholding(img):
    #setting all sorts of thresholds
    x_thresh = utils.abs_sobel_thresh(img, orient='x', thresh_min=10 ,thresh_max=230)
    mag_thresh = utils.mag_thresh(img, sobel_kernel=3, mag_thresh=(30, 150))
    dir_thresh = utils.dir_threshold(img, sobel_kernel=3, thresh=(0.7, 1.3))
    hls_thresh = utils.hls_select(img, thresh=(120, 255))
    lab_thresh = utils.lab_select(img, thresh=(155, 200))
    luv_thresh = utils.luv_select(img, thresh=(225, 255))

    #Thresholding combination
    threshholded = np.zeros_like(x_thresh)
    threshholded[((x_thresh == 1) & (mag_thresh == 1)) | ((dir_thresh == 1) & (hls_thresh == 1)) | (lab_thresh == 1) | (luv_thresh == 1)] = 1

    return threshholded


def processing(img,object_points,img_points,M,Minv,left_line,right_line):
    #camera calibration, image distortion correction
    undist = utils.cal_undistort(img,object_points,img_points)
    #get the thresholded binary image
    thresholded = thresholding(undist)
    #perform perspective  transform
    thresholded_wraped = cv2.warpPerspective(thresholded, M, img.shape[1::-1], flags=cv2.INTER_LINEAR)

    #perform detection
    if left_line.detected and right_line.detected:
        left_fit, right_fit, left_lane_inds, right_lane_inds = utils.find_line_by_previous(thresholded_wraped,left_line.current_fit,right_line.current_fit)
    else:
        left_fit, right_fit, left_lane_inds, right_lane_inds = utils.find_line(thresholded_wraped)
    left_line.update(left_fit)
    right_line.update(right_fit)

    #draw the detected laneline and the information
    area_img = utils.draw_area(undist,thresholded_wraped,Minv,left_fit, right_fit)
    curvature,pos_from_center = utils.calculate_curv_and_pos(thresholded_wraped,left_fit, right_fit)
    result = utils.draw_values(area_img,curvature,pos_from_center)

    return result
#
#
left_line = line.Line()
right_line = line.Line()
cal_imgs = utils.get_images_by_dir('camera_cal')
object_points,img_points = utils.calibrate(cal_imgs,grid=(9,6))
M,Minv = utils.get_M_Minv()

##draw the processed video
project_outpath = 'vedio_out/project_video_out2.mp4'
#project_video_clip = VideoFileClip("project_video.mp4")
project_video_clip = VideoFileClip("14s.mp4")
project_video_out_clip = project_video_clip.fl_image(lambda clip: processing(clip,object_points,img_points,M,Minv,left_line,right_line))
project_video_out_clip.write_videofile(project_outpath, audio=False)



##draw the processed test image
test_imgs = utils.get_images_by_dir('test_images')
undistorted = []
for img in test_imgs:
   img = utils.cal_undistort(img,object_points,img_points)
   undistorted.append(img)

result=[]
for img in undistorted:
   res = processing(img,object_points,img_points,M,Minv,left_line,right_line)
   result.append(res)

plt.figure(figsize=(10,10))
for i in range(len(result)):

   plt.subplot(len(result),1,i+1)
   plt.title('thresholded_wraped image')
   plt.imshow(result[i][:,:,::-1])
   plt.show()

demo gif动图
gif图
[1]:https://github.com/ZubinHuang/StartUpHub_RoadLaneDetect

  • 3
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: GitHub 上有多个与车道线检测相关的代码仓库,其主要目的是基于计算机视觉技术对于行驶路段中的车道线进行识别和提取,以实现车道线的自动化辨识功能。其中,常用的技术包括图像处理、机器学习、深度学习等。 在这些代码仓库中,一些基于传统计算机视觉方法的车道线检测算法实现比较简单,包括基于霍夫变换的检测、半自适应阈值处理方法等,但其对于图像的预处理、阈值的设定以及参数的调整相对较为耗时。同时,深度学习技术的应用也提高了车道线检测的精度和鲁棒性,例如使用深度学习框架TensorFlow和PyTorch等建立端到端的反卷积神经网络,对于车道线检测和跟踪进行修正,从而实现更加高效的车道线检测。 此外,一些代码仓库还提供了基于ROS机器人操作系统的车道线检测方法,利用ROS提供的传感器驱动程序,将相机、雷达等传感设备的数据与车道线检测算法结合起来,实现车辆自主导航功能。 总的来说,GitHub上的车道线检测代码涵盖了传统计算机视觉技术和深度学习技术以及ROS机器人操作系统的应用,为开发自动驾驶、车辆导航等应用提供了重要的技术和思路支持。 ### 回答2: GitHub是一个开源的平台,车道线检测代码是其中一个开源的算法。这个算法可以自动检测路上的车道线,并且输出车道线的坐标。 车道线检测算法是一种基于计算机视觉的技术,主要应用在自动驾驶、行车安全和智能交通等领域。在算法的实现中,主要利用了图像处理和机器学习的技术,通过对车道线的形态、颜色和纹理等特征进行分析,来实现车道线的自动识别。 在GitHub上,可以找到很多车道线检测开源代码,这些代码都可以供开发者们参考和使用。其中,有些代码基于传统的图像处理方法,而有些则是采用深度学习的方法,例如卷积神经网络。这些代码的实现方法不尽相同,但其基本步骤都包括图像预处理、车道线检测车道线跟踪等环节。 总的来说,作为一个开源平台,GitHub为智能交通领域的开发者们提供了丰富多样的开源算法和代码,车道线检测算法也是其中之一。通过学习和应用这些算法和代码,我们可以更好地推动智能交通技术的发展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值