MATLAB: Calculating bivariate polynomial coefficients in Matlab!

bivariate polynomialcamera distortion modelleast squares

Hello all,
I have the following bivariate polynomial system:
Xa= ax1 + ax2*X + ax3*Y + ax4*X^2 + ax5*Y^2 + ax6*XY
and
Ya= ay1 + ay2*X + ay3*Y + ay4*X^2 + ay5*Y^2 + ay6*XY
This system acts as a distortion model in pixel coordinate to real world coordinate camera system. I know the pixel coordinates and the actual distances of the calibration pattern from the camera and I need to extract the coefficients (ax1 … ax6) (ay1 … ay6) of the bivariate polynomial system using least squares. Since I have not find any ready made function for bivariate polynomial fitting, could you please have any ideas on how to do that?
Thank you in advance!

Best Answer

download polyfitn from the file exchange.