这段代码在 while 循环中,我期望看到图像上没有线条,因为线条应用于img_roi而不是应用于img_clone但在输出图像中,我得到的是带有线条的图像。另外,我想检测车道,如果有人可以提供帮助,那就太好了。谢谢你。ret, img_color = vid.read()num_rows, num_cols = img_color.shape[:2]rotation_matrix = cv2.getRotationMatrix2D((num_cols/2, num_rows/2), 270, 0.56) #3img_rotated = cv2.warpAffine(img_color, rotation_matrix, (num_cols, num_rows))height, width = img_rotated.shape[:2]img_resize = cv2.resize(img_rotated,(int(0.8*width), int(0.8*height)), interpolation = cv2.INTER_CUBIC) #2img_roi = img_resize[10:842,530:1000]img_clone = img_resize[10:842,530:1000]img_gray = cv2.cvtColor(img_roi,cv2.COLOR_BGR2GRAY) #1img_canny = cv2.Canny(img_gray,330,350, apertureSize = 3) #4lines = cv2.HoughLinesP(img_canny, 1, np.pi/180, 60, maxLineGap = 240)for line in lines: x1,y1,x2,y2 = line[0] cv2.line(img_roi, (x1,y1), (x2,y2), (0,255,0), 3)cv2.imshow('frame',img_clone)cv2.imwrite('image.jpg', img_clone)
添加回答
举报
0/150
提交
取消