Converting UIImage to cv::Mat

I have a UIImage which is a pic captured from an iPhone Camera now I want the UIImage to be converted to cv::Mat (OpenCV). I am using the following lines of code to accomplish this : -(cv::Mat)CVM...