'**SUMMARY**
This helper function for warp performs an affine rotation using the supplied matrix.
The matrix can be a either an openCV mat or an np.ndarray type.
The matrix should be a 3x3
**PARAMETERS**
* *rotMatrix* - Numpy Array or CvMat
**RETURNS**
The rotated image. Note that the rotation is done in place, i.e. the image is not enlarged to fit the transofmation.
**EXAMPLE**
>>> img = Image("lenna")
>>> points = ((50,0),(img.width+50,0),(img.width,img.height),(0,img.height))
>>> src = ((30, 30), (img.width-10, 70), (img.width-1-40, img.height-1+30),(20,img.height+10))
>>> result = cv.CreateMat(3,3,cv.CV_32FC1)
>>> cv.GetPerspectiveTransform(src,points,result)
>>> img.transformPerspective(result).show()
**SEE ALSO**
:py:meth:`shear`
:py:meth:`warp`
:py:meth:`transformPerspective`
:py:meth:`rotate`
http://en.wikipedia.org/wiki/Transformation_matrix'

def transformPerspective(self, rotMatrix):

    try:
        import cv2
        if (type(rotMatrix) != np.ndarray):
            rotMatrix = np.array(rotMatrix)
        retVal = cv2.warpPerspective(src=np.array(self.getMatrix()), dsize=(self.width, self.height), M=rotMatrix, flags=cv2.INTER_CUBIC)
        return Image(retVal, colorSpace=self._colorSpace, cv2image=True)
    except:
        retVal = self.getEmpty()
        if (type(rotMatrix) == np.ndarray):
            rotMatrix = npArray2cvMat(rotMatrix)
        cv.WarpPerspective(self.getBitmap(), retVal, rotMatrix)
        return Image(retVal, colorSpace=self._colorSpace)
