You can load series of images using sprintf
or std::stringstream
Here is how you can do it with sprintf
:
char link[512];
int i=1;
while (i<4)
{
sprintf(link,"C:/images/result/template/%d.jpg",i);
IplImage* templat = cvLoadImage(link, 1);
IplImage* templat2 = cvCreateImage(cvSize(templat->width, templat->height),IPL_DEPTH_8U, 1);
i++
}