Bugfix to potential inaccuracy in function:polyfit

1.Modify the default datatype(CV_32F) to CV_64F.
2.Re-write the generation of X matrix,reducing the times of multiplication.
3.Add a bool argument to control output datatype(float or double)
The problem has been reported at http://code.opencv.org/issues/2887