DAY 7
0
AI & Data

1.程式實作描述
2.可能缺點
3.建議可能的改進

# 說明

## 1.程式實作描述

``````def process_image(image):
# NOTE: The output you return should be a color image (3 channel) for processing video below
# TODO: put your pipeline here,
# you should return the final output (image where lines are drawn on lanes)
gray_image = grayscale(image)
gaus_blur = gaussian_blur(gray_image, 3)
edges = canny(gaus_blur, 50,150)
imshape = image.shape

vertices = np.array([[(0,imshape[0]),(450, 320), (500, 320), (imshape[1],imshape[0])]], dtype=np.int32)
masked = region_of_interest(edges, vertices)

rho = 2            #distance resolution in pixels of the Hough grid
theta = np.pi/180  #angular resolution in radians of the Hough grid
threshold = 5      #minimum number of votes (intersections in Hough grid cell)
min_line_len = 10  #minimum number of pixels making up a line
max_line_gap = 20  #maximum gap in pixels between connectable line segments
line_image = hough_lines(masked, rho, theta, threshold, min_line_len, max_line_gap)

result = weighted_img(line_image, image)
return result
``````
1. 圖檔灰階處理產出
``````gray_image = grayscale(image)
``````

2.高斯平滑處理

``````gray_image = grayscale(image)
``````

3.利用canny檢測邊緣

``````edges = canny(gaus_blur, 50,150)
``````

4.於圖檔繪上興趣節點

``````masked = region_of_interest(edges, vertices)
``````

5.圖檔進行霍夫轉換產出

``````line_image = hough_lines(masked, rho, theta, threshold, min_line_len, max_line_gap)
``````