在使用类,初始化和调用时遇到麻烦

时间:2019-04-28 22:14:39

标签: python-3.x

尝试使用类将用户定义的函数拼接在一起,以在视频上运行代码。

不断得到错误 TypeError:不支持src数据类型= 17

无法理解类的语法

max(1, 2) enumerates to 2

class Adv_lane_det:

def __init__(self,image): Image_CB = color_binary(image) Image_top_down, perspective_M, Inverse_M=corners_unwarp(Image_CB) left_w_co, right_w_co,fit_pol_win_lane = fit_polynomial(Image_top_down) left_c,right_c,offset, image_m, Vehicle_m = cal_curve(Image_top_down.shape,left_w_co,right_w_co) reverse_warp= rev_transform (image, Image_top_down, Inverse_M, left_fit, right_fit) Image_Initial = Print_on_img(reverse_warp, left_c, right_c,offset) def __call__(self, image): Image_CB = color_binary(image) Image_top_down,perspective_M, Inverse_M =corners_unwarp(Image_CB) if fit_pol_prev_lane==0: left_w_co, right_w_co,fit_pol_win_lane == fit_polynomial(Image_top_down) else: left_w_co, right_w_co,fit_pol_prev_lane == search_around_poly(Image_top_down) left_w_co, right_w_co = choose_method(fit_pol_win_lane,fit_pol_prev_lane) left_c,right_c,offset, image_m, Vehicle_m = cal_curve(Image_top_down.shape,left_w_co,right_w_co) reverse_warp= rev_transform (image, Image_top_down, Inverse_M, left_w_co, right_w_co) Image_final = Print_on_img(reverse_warp, left_c, right_c,offset) return image_final

white_output = 'project_video_Solution_SK_new.mp4'

clip1 = VideoFileClip("project_video.mp4") Image_initial = Adv_lane_det()

white_clip = clip1.fl_image(Image_initial) #NOTE: this function expects color images!!

0 个答案:

没有答案