A new enhancement of RANSAC, the locally optimized RANSAC (LO-RANSAC), is introduced. It has been observed that, to find an optimal solution (with a given probability), the number of samples drawn in RANSAC is significantly higher than predicted from the mathematical model. This is due to the incorrect assumption, that a model with parameters computed from an outlier-free sample is consistent with all inliers. The assumption rarely holds in practice. The locally optimized RANSAC makes no new assumptions about the data, on the contrary - it makes the above-mentioned assumption valid by applying local optimization to the solution estimated from the random sample. The performance of the improved RANSAC is evaluated in a number of epipolar geometry and homography estimation experiments. Compared with standard RANSAC, the speed-up achieved is two to three fold and the quality of the solution (measured by the number of inliers) is increased by 10-20%. The number of samples drawn is in goo...