Curve fitting technique is widely used in image processing, reverse engineering and other fields. The method of B-spline curve fitting commonly used in engineering has the advantages of locality, continuity, but the fitting curve not through the data points and fitting precision is relatively low；the curve obtained by curve interpolation algorithm through the data points, but is lack of locality, and needs to supplement the endpoint conditions. In order to improve the B-spline curve fitting method that can not meet the requirement of the precision, curve interpolation algorithm is not easy to locally change real- time, and an algorithm based on the B-spline curve fitting is put forward. The algorithm is combined with the advantages of B-spline curve fitting and curve interpolation, by adding the data points it makes curve through all of the original data points, and ensures the curve with locality. Verified by examples, the algorithm principle is correct, the technique is feasible, and has higher fitting precision.