junshengfu / driving-lane-departure-warning Goto Github PK
View Code? Open in Web Editor NEWBuilt a real-time lane departure warning system with a monocular camera, using OpenCV.
License: GNU General Public License v3.0
Built a real-time lane departure warning system with a monocular camera, using OpenCV.
License: GNU General Public License v3.0
Hi,
I am trying to run your project with my own data, I did perform the calibration but I have troubles with the output, I found out that changing the points to perform the perspective transformation changes the output but so far I have not succeed to get a right output like with your examples.
Can you tell me how did you chose that points (x,y,X,Y) so I can also do the same for my data???
I am getting this error..can you please tell me how to fix it with exact code.
/usr/bin/python3.4 /home/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py
Traceback (most recent call last):
File "/home/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py", line 19, in
img_aug = process_frame(img)
File "/home/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/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
I am looking for the .yml file?
for the Anaconda environment
Traceback (most recent call last):
File "main.py", line 37, in
clip1 = VideoFileClip('examples/project_video.mp4')
File "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/VideoFileClip.py", line 81, in init
fps_source=fps_source)
File "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 32, in init
fps_source)
File "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/ffmpeg_reader.py", line 256, in ffmpeg_parse_infos
proc = sp.Popen(cmd, **popen_params)
File "/usr/lib/python3.4/subprocess.py", line 859, in init
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error
I'm running this code on raspberry pi3 opencv3.1 and python3, when i run with video input getting above error and with test image working fine. ffmpeg library and other required library installed.
@JunshengFu This code will not work when there is a change of lanes because during the perspective transform you are giving the lane boundaries as input(src,dst) but when there is a change in lanes it still uses the old values which will give huge errors. Is there any solution for this?
Thankyou
when i run the main.py,it appears the following error,please help me solve the problem:
File "E:\ADAS-Code\driving-lane-departure-warning-master\driving-lane-departure-warning-master\lane.py", line 489, in create_output_frame
whole_frame[40:40+h, 20:20+w, :] = undist_ori
ValueError: could not broadcast input array from shape (180,320,3) into shape (140,300,3)
I'm using your code for my camera's output in a simulator but I noticed that the calculated offset from the middle line is wrong. Have I messed something? I checked one of the camera's image and it seems that the algorithm does not recognize the lanes, correctly. In the picture, the car virtually is in the middle of the lanes and lane's distance is 3.3 meter and it is a straight road.
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
Can I get some other input video which i can use to check my model with another test video? Please make sure the camera calibration is the same as in the video already provided
Excuse me, How to visualization binary_warped?
i switch full_search(binary_warped, visualization=false) to full_search(binary_warped, visualization=True)
but nothing happened
When I am doing the polyfit(lefty, leftx, 2), lefty is empty, then I got the error. How to exclude the empty array? I have tried some methods, but it didn't work.
Traceback (most recent call last):
File "C:\Users\kaman\OneDrive\Desktop\btech_project\main.py", line 36, in
clip = clip1.fl_image(process_frame) #NOTE: it should be in BGR format
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\video\VideoClip.py", line 490, in fl_image
return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\Clip.py", line 136, in fl
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File "", line 2, in set_make_frame
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\decorators.py", line 14, in outplace
f(newclip, *a, **k)
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\video\VideoClip.py", line 644, in set_make_frame
self.size = self.get_frame(0).shape[:2][::-1]
File "", line 2, in get_frame
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\Clip.py", line 93, in get_frame
return self.make_frame(t)
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\Clip.py", line 136, in
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\moviepy\video\VideoClip.py", line 490, in
return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
File "C:\Users\kaman\OneDrive\Desktop\btech_project\lane.py", line 597, in process_frame
detector(binary_sub, ploty, visualization)
File "C:\Users\kaman\OneDrive\Desktop\btech_project\lane.py", line 549, in detector
left_fit, right_fit = full_search(binary_sub, visualization=visualization)
File "C:\Users\kaman\OneDrive\Desktop\btech_project\lane.py", line 295, in full_search
right_fit = np.polyfit(righty, rightx, 2)
File "<array_function internals>", line 5, in polyfit
File "C:\Users\kaman\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\numpy\lib\polynomial.py", line 630, in polyfit
raise TypeError("expected non-empty vector for x")
TypeError: expected non-empty vector for x
Traceback (most recent call last):
File "C:\lane_direction\main.py", line 34, in
clip = clip1.fl_image(process_frame) #NOTE: it should be in BGR format
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\video\VideoClip.py", line 506, in fl_image
return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\Clip.py", line 137, in fl
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File "", line 2, in set_make_frame
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\decorators.py", line 14, in outplace
f(newclip, *a, **k)
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\video\VideoClip.py", line 661, in set_make_frame
self.size = self.get_frame(0).shape[:2][::-1]
File "", line 2, in get_frame
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\Clip.py", line 94, in get_frame
return self.make_frame(t)
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\Clip.py", line 137, in
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\moviepy\video\VideoClip.py", line 506, in
return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
File "C:\lane_direction\lane.py", line 592, in process_frame
detector(binary_sub, ploty, visualization)
File "C:\lane_direction\lane.py", line 544, in detector
left_fit, right_fit = full_search(binary_sub, visualization=visualization)
File "C:\lane_direction\lane.py", line 286, in full_search
left_fit = np.polyfit(lefty, leftx, 2)
File "C:\Users\araparthi\AppData\Local\Programs\Python\Python35\lib\site-packages\numpy\lib\polynomial.py", line 555, in polyfit
raise TypeError("expected non-empty vector for x")
TypeError: expected non-empty vector for x
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.