You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def find_lane_pixels(binary_warped):
# Debug: Check the shape and type of binary_warped
print(f"binary_warped shape: {binary_warped.shape}, type: {binary_warped.dtype}")
here is my code that gives me an error.
def find_lane_pixels(binary_warped):
# Debug: Check the shape and type of binary_warped
print(f"binary_warped shape: {binary_warped.shape}, type: {binary_warped.dtype}")
def fit_polynomial_first_lane(binary_warped):
leftx, lefty, rightx, righty, out_img = find_lane_pixels(binary_warped)
left_fit = np.polyfit(lefty, leftx, 2)
right_fit = np.polyfit(righty, rightx, 2)
ploty = np.linspace(0, binary_warped.shape[0]-1, binary_warped.shape[0])
try:
left_fitx = left_fit[0] * ploty2 + left_fit[1] * ploty + left_fit[2]
right_fitx = right_fit[0] * ploty2 + right_fit[1] * ploty + right_fit[2]
except TypeError:
print('The function failed to fit a line!')
left_fitx = 1 * ploty2 + 1 * ploty
right_fitx = 1 * ploty2 + 1 * ploty
binary_warped pixel range: 0 to 255
binary_warped shape: (720, 1280, 3), type: uint8
out_img shape: (720, 1280, 9), type: uint8
error Traceback (most recent call last)
in <cell line: 129>()
146
147 # Find lane pixels and fit polynomial
--> 148 left_fit, right_fit, out_img = fit_polynomial_first_lane(binary_warped)
149
150 # Plot the results
1 frames
in find_lane_pixels(binary_warped)
66 win_xright_high = min(binary_warped.shape[1], win_xright_high)
67
---> 68 cv2.rectangle(out_img, (win_xleft_low, win_y_low), (win_xleft_high, win_y_high), (0, 255, 0), 2)
69 cv2.rectangle(out_img, (win_xright_low, win_y_low), (win_xright_high, win_y_high), (0, 255, 0), 2)
70
error: OpenCV(4.8.0) /io/opencv/modules/core/src/copy.cpp:71: error: (-215:Assertion failed) cn <= 4 in function 'scalarToRawData'
The text was updated successfully, but these errors were encountered: