Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run error #3

Open
zwqaoy opened this issue Aug 31, 2017 · 14 comments
Open

run error #3

zwqaoy opened this issue Aug 31, 2017 · 14 comments

Comments

@zwqaoy
Copy link

zwqaoy commented Aug 31, 2017

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
Copy link

seewoo79 commented Sep 4, 2017

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
Copy link
Owner

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

@seewoo79
Copy link

seewoo79 commented Sep 4, 2017

I run demo after modifing error like this.

  • before
    histogram = np.sum(binary_warped[binary_warped.shape[0]/2:,:], axis=0)
    *after
    histogram = np.sum(binary_warped[ int(binary_warped.shape[0]/2):,:], axis=0)

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

@trohit920
Copy link

trohit920 commented Nov 1, 2017

@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, img_undist_, 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
Copy link

Ayysh commented Nov 2, 2017

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, img_undist_, 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
Copy link

Ayysh commented Nov 5, 2017

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

@lyxlty
Copy link

lyxlty commented Apr 1, 2018

@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
Copy link

@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
Copy link

nkh2235 commented Jul 8, 2018

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

@madhu-korada
Copy link

for video??

@SpBhavana
Copy link

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
Copy link

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

@joker-wutong
Copy link

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
Copy link

DickyNJ commented Mar 28, 2023

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

回溯(最近一次调用):文件 “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 或具有索引方法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests