YChuan1115 / Circle-Fitting-Hyper-Fit

(C++) An developed Vision-based Circle Fitting Algorithm, called "Hyper Fit" - fits accurate circles to both complete and largely incomplete circular arcs/objects, in livestream 2D- images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a revised circle fitting algorithm of the original "Hyper fit" algorithm, by Nikolai Chernov
(http://people.cas.uab.edu/~mosya/cl/CPPcircle.html)

It is an algebraic fit, based on the journal article:
[1] A. Al-Sharadqah and N. Chernov, "Error analysis for circle fitting algorithms", 
Electronic Journal of Statistics, Vol. 3, pages 886-911, (2009)

THIS HYPER FIT ALGORITHM IS CONSIDERED TO BE ONE OF THE BEST (PERHAPS THE BEST) CIRCLE FITTING ALGORITHM, IN TERMS OF ACCURACY. IT IS ALSO RELATIVELY FAST.

The original algorithm fits a set of known data points (in 2D) to a circle. 
* As a contribution to the original algorithm, functions have been added to allow circle fitting on complete and incomplete circular objects, in live-stream 2D-images.

THE REVISED ALGORITHM HAS THE FOLLOWING IMPLEMENTATION BLOCKS:
(1) Image acquisition-> (2) Data points (Xi,Yi) extraction, using Canny edge detection-> (3) Gathering of data points-> (4) Fitting data points to a circle, using the circle fitting algorithm-> (5) Printing the fit circle´s arc, and radius value, onto captured frames

The algorithm is explained with comments in the "Source.cpp" file

In the repository, there is a videofile named "Circle Fitting (True radius 2 meter).webm", 
showing an example where the circle fitting algorithm has been applied on a largely incomplete circular arc.
In the video file, the short arc length (17 cm) corresponds to approximately 5 degree of a complete circle´s circumference. 
With the used camera setup, a 5 mpx camera, the algorithm fits a circle to the arc with an accuracy of approximately 99.5%, which is impressive.

* As can be noted and concluded is that the Hyper fit algorithm can be implemented to fit accurate circles to largely incomplete circular arcs.

HOW TO USE THE CODE:
VISUAL STUDIO:
  We have used visual studio 2013 and OpenCV version 2.4.13, download at (http://opencv.org/downloads.html)
  install OpenCV following steps below, it shows how to configure OpenCV 2.4.13 with visual studio 2010 (same for later versions)
  1. You need to configure OpenCV with visual studio, example: https://www.youtube.com/watch?v=KoJTIs-h-0g
  2. Create a new project in visual studio, add all the files (Cpp and Headerfiles) from our repository to the project 
  3. Link OpenCV libraries and additional dependencies (DLL:s) to the project, following the youtube-tutorial from step 1. 
  4. Compile and Run the application

Ofcourse, the project can be compiled with many other IDE´s or compilers, just make sure to link OpenCV libraries and other additional dependencies to the project files.

About

(C++) An developed Vision-based Circle Fitting Algorithm, called "Hyper Fit" - fits accurate circles to both complete and largely incomplete circular arcs/objects, in livestream 2D- images


Languages

Language:C++ 100.0%