Home

Awesome

Detect Cars

This project is a master's thesis that consisted of an investigation in the detection of cars and highway lines using Python and the OpenCV API. The code is free to be used and modified by anybody who wishes to do so.

##UTPL ###Professor:

###Students:

System Requirements

Installation

  1. First, one should install the following libraries:

Installation on OS X

Apple uses a prior version of Python that does not support the latest Python libraries. One work around is to install Python with Homebrew:

$ brew install python

Replacing Apple's system Python with an unsupported version may break things. Therefore we linked Homebrew's Python into the system path without replacing the system Python:

$ ln -s /usr/local/Cellar/python/2.x.y/bin/python /bin/hbpython

Where 2.x.y is the version number of your Python.

Running

From a command line in the folder of the repository:

$ python detect.py [-v path/to/video] [-c path/to/cascade.xml]

Videos should be *.mov on Mac OSX and *.avi on Windows.

###On UNIX... You may add a shebang (#!) line to the top of detect.py with the path to the appropriate Python. Example:

#! /bin/python (#! /bin/hbpython in the case of Mac) at the top of detect.py

####Make the script executable $ chmod +x detect.py

####To Run: $ ./detect.py [-v path/to/video] [-c path/to/cascade.xml]

If no video is specified, OpenCV attempts to open the Webcam, see line number 73: camera = cv2.VideoCapture(1) in detect.py

###Examples: Windows: C:\path\to\repository> python detect.py -v data/Loja.avi

UNIX and UNIX-Like: $ python detect.py -v data/Loja.mov or $ ./detect.py -v data/Loja.mov

Mac OSX: $ hbpython detect.py -v data/Loja.mov or $ ./detect.py -v data/Loja.mov

###Other Arguments Default values can be found in config.py, but can be temporarily overwritten with the following arguments:

Depreciated Arguments

Region of Interest is calculated based on the size of the video (full width, bottom half of the height). Therefore arguments which define the ROI are depreciated.