JunshengFu / driving-lane-departure-warning

Built a real-time lane departure warning system with a monocular camera, using OpenCV.
GNU General Public License v3.0
220 stars 103 forks source link

run error #3

Open zwqaoy opened 7 years ago

zwqaoy commented 7 years ago

cv2.error: /home/ckt/work/tools/opencv/modules/core/src/arithm.cpp:1987: error: (-209) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function arithm_op

seewoo79 commented 7 years ago

I get similar error msg...

Traceback (most recent call last): File "main.py", line 19, in img_aug = process_frame(img) File "/home/seewoo79/Workspace/test/driving-lane-departure-warning/lane.py", line 598, in process_frame detector(binary_sub, ploty, visualization) File "/home/seewoo79/Workspace/test/driving-lane-departure-warning/lane.py", line 550, in detector left_fit, right_fit = full_search(binary_sub, visualization=visualization) File "/home/seewoo79/Workspace/test/driving-lane-departure-warning/lane.py", line 226, in full_search histogram = np.sum(binary_warped[binary_warped.shape[0]/2:,:], axis=0) TypeError: slice indices must be integers or None or have an index method

JunshengFu commented 7 years ago

Are you able to run my demo, e.g. the test image and video I provided?

seewoo79 commented 7 years ago

I run demo after modifing error like this.

there are many same error from indexing with float. so I need to cast all this indexes as int, then it works...

trohit920 commented 6 years ago

@seewoo79 @JunshengFu I am also getting the similar error.

Traceback (most recent call last): File "C:\Users\rohit\Desktop\Python\driving-lane-departure-warning-master\main.py", line 19, in img_aug = process_frame(img) File "C:\Users\rohit\Desktop\Python\driving-lane-departure-warning-master\lane.py", line 615, in process_frame output = create_output_frame(offcenter, pts, imgundist, fps, curvature, curve_direction, binary_sub) File "C:\Users\rohit\Desktop\Python\driving-lane-departure-warning-master\lane.py", line 467, in create_output_frame whole_frame = np.zeros((h2.5,w2.34, 3), dtype=np.uint8) TypeError: 'float' object cannot be interpreted as an integer

Can you share the updated code of lane.py which you get after changing the indexes as int ?

Ayysh commented 6 years ago

I am getting this error..can you please tell me how to fix it. /usr/bin/python3.4 /home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py Traceback (most recent call last): File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py", line 19, in img_aug = process_frame(img) File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 616, in process_frame output = create_output_frame(offcenter, pts, imgundist, fps, curvature, curve_direction, binary_sub) File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 468, in create_output_frame whole_frame = np.zeros((h2.5,w2.34, 3), dtype=np.uint8) TypeError: 'float' object cannot be interpreted as an integer

Process finished with exit code 1

Ayysh commented 6 years ago

@ trohit920. Change the line to whole_frame = np.zeros((h3,w3, 3), dtype=np.uint8).It works!!

lyxlty commented 6 years ago

@JunshengFu whole_frame[220+h:220+2*h, 20:20+w, :] = undist_birdview ValueError: could not broadcast input array from shape (90,160,3) into shape (140,320,3) could you tell me how to solve it ?thanks!

pengwei1024 commented 6 years ago

@lyxlty h/2 or w/2 is float type, need to be converted to int

h2 = int(h/2)
    w2 = int(w/2)
    whole_frame[220 + h2:220 + 2 * h2, 20:20 + w2, :] = undist_birdview
    whole_frame[220 + h2:220 + 2 * h2, 40 + w2:40 + w, 0] = cv2.resize((binary_sub * 255).astype(np.uint8),(0, 0), fx=1 / 2, fy=1 / 2)
    whole_frame[220 + h2:220 + 2 * h2, 40 + w2:40 + w, 1] = cv2.resize((binary_sub * 255).astype(np.uint8),(0, 0), fx=1 / 2, fy=1 / 2)
    whole_frame[220 + h2:220 + 2 * h2, 40 + w2:40 + w, 2] = cv2.resize((binary_sub * 255).astype(np.uint8),(0, 0), fx=1 / 2, fy=1 / 2)
nkh2235 commented 6 years ago

@Ayysh why h3... It's not defined... Thanks.

madhu-korada commented 5 years ago

for video??

SpBhavana commented 4 years ago

I'm getting this error.....can you please tell me how to fix it

Traceback (most recent call last): File "main.py", line 19, in img_aug = process_frame(img) File "C:\Users\Administrator\Desktop\driving-lane-departure-warning-master\lane.py", line 598, in process_frame detector(binary_sub, ploty, visualization) File "C:\Users\Administrator\Desktop\driving-lane-departure-warning-master\lane.py", line 550, in detector left_fit, right_fit = full_search(binary_sub, visualization=visualization) File "C:\Users\Administrator\Desktop\driving-lane-departure-warning-master\lane.py", line 226, in full_search histogram = np.sum(binary_warped[binary_warped.shape[0]/2:,:], axis=0) TypeError: slice indices must be integers or None or have an index method

chocolate-byte commented 4 years ago

but I doubt that the data may not precise any more after int them , can u plz modify it?

joker-wutong commented 2 years ago

I get this error, what should I do to solve it? thanks,

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    from lane import *
  File "/home/nvidia/lane_departure_warn/driving-lane-departure-warning/lane.py", line 85, in <module>
    mtx, dist = load_calibration(calib_file)
  File "/home/nvidia/lane_departure_warn/driving-lane-departure-warning/calibration.py", line 78, in load_calibration
    data= pickle.load(file)
  File "/usr/lib/python2.7/pickle.py", line 1384, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.7/pickle.py", line 864, in load
    dispatch[key](self)
  File "/usr/lib/python2.7/pickle.py", line 892, in load_proto
    raise ValueError, "unsupported pickle protocol: %d" % proto
ValueError: unsupported pickle protocol: 3
DickyNJ commented 1 year ago

我收到类似的错误消息...

回溯(最近一次调用):文件 “main.py”,第 19 行,img_aug = process_frame(img) 文件“/home/seewoo79/Workspace/test/Driving-Lane-Off-warning/lane.py”,第 598 行,在process_frame检测器中(binary_sub,绘图,可视化) 文件“/home/seewoo79/工作区/测试/行车道偏离警告/车道.py”,第 550 行,在检测器left_fit中,right_fit = full_search(binary_sub,可视化=可视化)文件 “/home/seewoo79/Workspace/test/driving-lane-off-warning/lane.py”,第 226 行,full_search直方图 = np.sum(binary_warped[binary_warped.shape[0]/2:,:], axis=0) 类型错误:切片索引必须是整数或 None 或具有索引方法