diff --git a/lane.py b/lane.py index 8859880..a1bdd65 100644 --- a/lane.py +++ b/lane.py @@ -223,7 +223,7 @@ def warper(img, M): ## fit the lane line def full_search(binary_warped, visualization=False): - histogram = np.sum(binary_warped[binary_warped.shape[0]/2:,:], axis=0) + histogram = np.sum(binary_warped[binary_warped.shape[0]//2:,:], axis=0) # Create an output image to draw on and visualize the result out_img = np.dstack((binary_warped, binary_warped, binary_warped))*255 out_img = out_img.astype('uint8') @@ -484,10 +484,10 @@ def create_output_frame(offcenter, pts, undist_ori, fps, curvature, curve_direct ############## generate the combined output frame only for visualization purpose ################ whole_frame[40:40+h, 20:20+w, :] = undist_ori whole_frame[40:40+h, 60+w:60+2*w, :] = output - whole_frame[220+h/2:220+2*h/2, 20:20+w/2, :] = undist_birdview - whole_frame[220+h/2:220+2*h/2, 40+w/2:40+w, 0] = cv2.resize((binary_sub*255).astype(np.uint8), (0,0), fx=1/2, fy=1/2) - whole_frame[220+h/2:220+2*h/2, 40+w/2:40+w, 1] = cv2.resize((binary_sub*255).astype(np.uint8), (0,0), fx=1/2, fy=1/2) - whole_frame[220+h/2:220+2*h/2, 40+w/2:40+w, 2] = cv2.resize((binary_sub*255).astype(np.uint8), (0,0), fx=1/2, fy=1/2) + whole_frame[220+h//2:220+2*h//2, 20:20+w//2, :] = undist_birdview + whole_frame[220+h//2:220+2*h//2, 40+w//2:40+w, 0] = cv2.resize((binary_sub*255).astype(np.uint8), (0,0), fx=1/2, fy=1/2) + whole_frame[220+h//2:220+2*h//2, 40+w//2:40+w, 1] = cv2.resize((binary_sub*255).astype(np.uint8), (0,0), fx=1/2, fy=1/2) + whole_frame[220+h//2:220+2*h//2, 40+w//2:40+w, 2] = cv2.resize((binary_sub*255).astype(np.uint8), (0,0), fx=1/2, fy=1/2) font = cv2.FONT_HERSHEY_SIMPLEX if offcenter >= 0: