Source code for algebraic (non-iterative) ellipse fitting using positional and tangential constraints ================================================================================ ellipse_fit_with_gradients.c Given as input a sequence of points in the form [x_i, y_i], and their gradients [gx_i, gy_i], this file outputs the parameters of the ellipse [cx, cy, a, b, orientation] that approximates the input data; (cx,cy) denotes the centre of the ellipse, (a,b) the major and minor axes, and orientation is the angle between the major axis and Ox. The function expects also a buffer that is used internally to compute the coefficients of a linear system. This code requires lapack library. The version 3.3.1 was used. test_ellipse_fit_with_gradients.c This code reads some test data from a text file, and calls the ellipse fitting function, allocating and deallocating the buffer needed by this function. The text file has the form: pts_size x0 y0 gx0 gy0 x1 y1 gx1 gy1 ... The first line contains the number of points, and each of the next lines contains the Cartesian coordinates and gradient of each point. The code prints in console the parameters of the ellipse. To compile the test code type 'make'. Make sure you have lapack library installed. To run, type ./test_fit file_name.txt ================================================================================ Additional files: draw_ellipse.m Matlab function to draw an ellipse [cx,cy,a,b,orientation]. sample_data.txt, sample_data_arc1.txt, sample_data_arc2.txt Examples of input files to run the ellipse fitting test; the first one contains points sampled along the entire contour of an ellipse, and the other two contain points sampled on incomplete contours. sample.pgm Image from which the points contained in the sample text files above were extracted. ================================================================================ For details about this ellipse fitting technique, see A Parameterless Line Segment and Elliptical Arc Detector with Enhanced Ellipse Fitting, V. Patraucean, P. Gurdjos, R. Grompone von Gioi, ECCV2012. If you use this code in your work, please cite the above paper. ================================================================================ Contact: Viorica Patraucean University of Cambridge, Department of Engineering vp344@cam.ac.uk
viorik/EllipseFittingGradient
Non-iterative ellipse fitting using positional and tangential constraints
CAGPL-3.0