hi there, I'm new in openCV and want to using of cvMatchTemplate but result of this method is not desirable my program is: IplImage *t = cvLoadImage("template.jpg",1); IplImage *i = cvLoadImage("source.jpg",1); IplImage *res = cvCreateImage(cvSize(i->width - t->width+1,i->height - t->height +1),IPL_DEPTH_32F, 1); cvZero(res); cvMatchTemplate(i, t, res, CV_TM_CCORR_NORMED); CvPoint minloc, maxloc; double minval, maxval; cvMinMaxLoc(res,&minval,&maxval,&minloc,&maxloc,NULL); cvRectangle(i, cvPoint(maxloc.x, maxloc.y), cvPoint(maxloc.x + 50, maxloc.y + 50), cvScalar(250,250,250), 2, 0, 0); cvShowImage("Matched area",i); but after running it result image is: and my source and template images are: (in result image a bigger rectangle is matched with template...!!!). help me to use of template macthing in openCV, special thanks to you.