所以我正在学习车道检测,我想检测视频上的车道线。我收集了一些受欢迎的视频,人们可以进行车道检测,并且效果很好。当我从互联网上收到新视频时,我偶然发现了此错误。我检查了视频的路径及其正确性,但给了我一个错误,我不知道为什么。 这是我的代码:
from moviepy.editor import VideoFileClip
from IPython.display import HTML
def process_image(image,
kernel_size = 5,
low_threshold = 100, high_threshold = 250,
rho = 1, theta = np.pi/180, threshold = 30,
min_line_len = 100, max_line_gap = 200):
#turn in grayscale
gray = grayscale(image)
#apply blur
blur_gray = gaussian_blur(gray, kernel_size)
#finding edges
edges = canny(image, low_threshold, high_threshold)
#setting vertices
vertices = np.array([[(0,image.shape[0]),(450, 315), (490, 315),
(image.shape[1],image.shape[0])]], dtype=np.int32)
#creating a region of interest
masked_edges = region_of_interest(edges, vertices)
#finding lines
lines = hough_lines(masked_edges, rho, theta, threshold, min_line_len, max_line_gap)
#merge with original image
lines_edges = weighted_img(lines, image, α=0.8, β=1., λ=0.)
return lines_edges
white_output = 'test_videos_output/video1.mp4'
clip1 = VideoFileClip("test_videos/video1.mp4")
white_clip = clip1.fl_image(process_image) #NOTE: this function expects color images!!
%time white_clip.write_videofile(white_output, audio=False)