Skip to content

Commit

Permalink
Merge pull request recodehive#828 from aviralgarg05/main-2
Browse files Browse the repository at this point in the history
Vehicle Lane Detection Using Machine Learning and OpenCV
  • Loading branch information
sanjay-kv committed Jul 23, 2024
2 parents 2654110 + d092ede commit a0818c5
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 2,682 deletions.
368 changes: 0 additions & 368 deletions Loan Repayment Prediction/Loan Prediction Datasets/test.csv

This file was deleted.

615 changes: 0 additions & 615 deletions Loan Repayment Prediction/Loan Prediction Datasets/train.csv

This file was deleted.

1,586 changes: 0 additions & 1,586 deletions Loan Repayment Prediction/Loan Prediction.ipynb

This file was deleted.

113 changes: 0 additions & 113 deletions Loan Repayment Prediction/README.md

This file was deleted.

65 changes: 65 additions & 0 deletions Vehicle Lane Detection Using Machine Learning and OpenCV/README.md
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 Vehicle Lane Detection Using Machine Learning and OpenCV/gui.py
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()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a0818c5

Please sign in to comment.