I am using opencv 2.1. In my code I have a few images stored as Mat objects initialized like this:
Mat img1 = imread(\"img/stuff.pgm\", CV_LOAD_IMAGE_GRAYSCA
putText(result, "Differencing the two images.", cvPoint(30,30),
FONT_HERSHEY_COMPLEX_SMALL, 0.8, cvScalar(200,200,250), 1, CV_AA);
In the above line "result" should be a cvArr* or an IplImage*. but from the code provided here, I guess you are passing a cv::Mat object. So, you either need to convert it using cvarrToMat() or pass &result instead of result.
Hope it helps