1. A method of calibrating a projector comprising: receiving by a processing element a first calibration image of a first calibration pattern comprising a plurality of pattern elements projected onto a projection surface; detecting by the processing element the plurality of pattern elements in the first calibration image by an image analysis algorithm; generating a perspective projection matrix by the processing element by modeling the projector as a pinhole device with a pinhole approximation to provide a first calibration approximation based on the detected pattern elements in the first calibration image and the first calibration pattern; and determining by the processing element a two-dimensional non-linear mapping function to correct inaccuracies in the first calibration approximation resulting from the pinhole approximation by analyzing the first calibration image to compensate for distortion characteristics inherent to the projector, wherein the non-linear mapping function is determined by comparing by the processing element the first calibration image and the perspective projection matrix.