Circle and Line detection algorithm using OpenCV
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python script to detect lines and circles in an image using Hough Transform algorithms in a video capture.

This script makes use of OpenCV python. The code is compatible with both OpenCV 2 and 3 versions.


  1. Install python 2.7 and add it to your system path.

  2. On Windows systems, open up Advanced System Settings, edit your Path variable and append C:\Python27\Scripts at the end.

  3. Install OpenCV python on your system.

  4. For Windows: 1. Download a precompiled version of OpenCV. 2. Install by double clicking the executable file. 3. Now, copy the cv2.pyd file at opencv\build\python\2.7\cv2.pyd to C:\python27\Scripts\site-packages.

  5. For MacOS: 1. Install homebrew. 2. Install homebrew branch of python using brew install python. 3. Add this to your ~/.bash_profile. export PATH=/usr/local/bin:$PATH to specify the target packages for homebrew. 4. Refresh your bash profile using source ~/.bash_profile. 5. Install numpy with pip install numpy 6. Install opencv with brew install opencv3

  6. For Ubuntu, install with sudo apt-get install python-numpy python-opencv. This should install a stable version of OpenCV-Python 2.4.9.

  7. Test the installation by opening a terminal. Type in python.

  8. In the prompt type, import cv2 and then cv2.__version__.


  1. Run python


Nikhil Venkatesh