基于视觉的曲线车道线检测完整代码,采用滑动窗口
import cv2import numpy as npfrom matplotlib import pyplot as pltimg = cv2.imread('test_images/shudu.jpeg', 0)laplacian = cv2.Laplacian(img, cv2.CV_64F)sobelx = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=3)sobely = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksize=3)plt.subplot(2, 2, 1), plt.imshow(img, cmap='gray')plt.title('Original'), plt.xticks([]), plt.yticks([])plt.subplot(2, 2, 2), plt.imshow(laplacian, cmap='gray')plt.title('Laplacian'), plt.xticks([]), plt.yticks([])plt.subplot(2, 2, 3), plt.imshow(sobelx, cmap='gray')plt.title('Sobel X'), plt.xticks([]), plt.yticks([])plt.subplot(2, 2, 4), plt.imshow(sobely, cmap='gray')plt.title('Sobel Y'), plt.xticks([]), plt.yticks([])plt.show()
评论