forked from recodehive/machine-learning-repos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request recodehive#828 from aviralgarg05/main-2
Vehicle Lane Detection Using Machine Learning and OpenCV
- Loading branch information
Showing
12 changed files
with
284 additions
and
2,682 deletions.
There are no files selected for viewing
368 changes: 0 additions & 368 deletions
368
Loan Repayment Prediction/Loan Prediction Datasets/test.csv
This file was deleted.
Oops, something went wrong.
615 changes: 0 additions & 615 deletions
615
Loan Repayment Prediction/Loan Prediction Datasets/train.csv
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
Vehicle Lane Detection Using Machine Learning and OpenCV/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Lane-Line-Detection | ||
|
||
|
||
## Description | ||
|
||
Lane-Line-Detection is a project aimed at detecting lane lines in video streams or images using computer vision techniques. This project leverages OpenCV and Python to identify and highlight lane markings, which is a crucial component for autonomous driving systems. | ||
|
||
## Table of Contents | ||
|
||
- [Usage](#usage) | ||
- [Contributing](#contributing) | ||
- [License](#license) | ||
- [Acknowledgments](#acknowledgments) | ||
- [Contact](#contact) | ||
|
||
|
||
|
||
### Prerequisites | ||
|
||
Ensure you have the following installed: | ||
- Python 3.x | ||
- pip | ||
|
||
### Steps | ||
|
||
1. Clone the repository: | ||
```bash | ||
git clone https://github.com/your_username/Lane-Line-Detection.git | ||
cd Lane-Line-Detection | ||
``` | ||
|
||
2. Install the required packages | ||
|
||
## Usage | ||
|
||
### Running the Lane Line Detection | ||
|
||
1. To detect lane lines in a video: | ||
```bash | ||
python lane_detection.py --video_path path/to/your/video.mp4 | ||
``` | ||
|
||
2. To detect lane lines in an image: | ||
```bash | ||
python lane_detection.py --image_path path/to/your/image.jpg | ||
``` | ||
|
||
|
||
## Contributing | ||
|
||
We welcome contributions! Please follow these steps to contribute: | ||
|
||
1. Fork the repository. | ||
2. Create a new branch (`git checkout -b feature-branch`). | ||
3. Make your changes. | ||
4. Commit your changes (`git commit -am 'Add new feature'`). | ||
5. Push to the branch (`git push origin feature-branch`). | ||
6. Create a new Pull Request. | ||
|
||
Please ensure your code adheres to the project's coding standards and includes tests. | ||
## License | ||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||
Binary file added
BIN
+2.38 KB
Vehicle Lane Detection Using Machine Learning and OpenCV/binaryimage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38.8 MB
Vehicle Lane Detection Using Machine Learning and OpenCV/finalresult.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
73 changes: 73 additions & 0 deletions
73
Vehicle Lane Detection Using Machine Learning and OpenCV/gui.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import tkinter as tk | ||
from tkinter import * | ||
import cv2 | ||
from PIL import Image, ImageTk | ||
import os | ||
import numpy as np | ||
|
||
|
||
global last_frame1 #creating global variable | ||
last_frame1 = np.zeros((480, 640, 3), dtype=np.uint8) | ||
global last_frame2 #creating global variable | ||
last_frame2 = np.zeros((480, 640, 3), dtype=np.uint8) | ||
global cap1 | ||
global cap2 | ||
cap1 = cv2.VideoCapture("./test2.mp4") | ||
cap2 = cv2.VideoCapture("./test2.mp4") | ||
|
||
def show_vid(): | ||
if not cap1.isOpened(): | ||
print("cant open the camera1") | ||
flag1, frame1 = cap1.read() | ||
frame1 = cv2.resize(frame1,(600,500)) | ||
if flag1 is None: | ||
print ("Major error!") | ||
elif flag1: | ||
global last_frame1 | ||
last_frame1 = frame1.copy() | ||
pic = cv2.cvtColor(last_frame1, cv2.COLOR_BGR2RGB) | ||
img = Image.fromarray(pic) | ||
imgtk = ImageTk.PhotoImage(image=img) | ||
lmain.imgtk = imgtk | ||
lmain.configure(image=imgtk) | ||
lmain.after(10, show_vid) | ||
|
||
|
||
def show_vid2(): | ||
if not cap2.isOpened(): | ||
print("cant open the camera2") | ||
flag2, frame2 = cap2.read() | ||
frame2 = cv2.resize(frame2,(600,500)) | ||
if flag2 is None: | ||
print ("Major error2!") | ||
elif flag2: | ||
global last_frame2 | ||
last_frame2 = frame2.copy() | ||
pic2 = cv2.cvtColor(last_frame2, cv2.COLOR_BGR2RGB) | ||
img2 = Image.fromarray(pic2) | ||
img2tk = ImageTk.PhotoImage(image=img2) | ||
lmain2.img2tk = img2tk | ||
lmain2.configure(image=img2tk) | ||
lmain2.after(10, show_vid2) | ||
|
||
if __name__ == '__main__': | ||
root=tk.Tk() | ||
heading = Label(root,image=img, text="Lane-Line Detection") | ||
# heading.configure(background='#CDCDCD',foreground='#364156') | ||
heading.pack() | ||
heading2=Label(root,text="Lane-Line Detection",pady=20, font=('arial',45,'bold')) | ||
heading2.configure(foreground='#364156') | ||
heading2.pack() | ||
lmain = tk.Label(master=root) | ||
lmain2 = tk.Label(master=root) | ||
|
||
lmain.pack(side = LEFT) | ||
lmain2.pack(side = RIGHT) | ||
root.title("Lane-line detection") | ||
root.geometry("1250x900+100+10") | ||
|
||
exitbutton = Button(root, text='Quit',fg="red",command= root.destroy).pack(side = BOTTOM,) | ||
show_vid() | ||
show_vid2() | ||
root.mainloop() | ||
cap.release() |
Binary file added
BIN
+2.98 KB
Vehicle Lane Detection Using Machine Learning and OpenCV/instancesegmentimage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.