同时读入几幅图像
int _tmain(int argc, _TCHAR* argv[])
{
/**************************************
******用文件名打开******
**************************************/
FILE *fp= 0;
string imagepath;
imagepath="C:\\Users\\hmap\\Desktop\\SURE\\SURE_fuse\\DISP\\";
#define DIS_LIST_FILE "DIS_LIST_FILE.txt"
/*DIS_LIST_FILE存放图像的名字;*/
fp=fopen(DIS_LIST_FILE,"r");
//只要打开就判断一下文件是否为空;
/*if (fp ==0)
{
return -1;
}*/
if ((fp=fopen(DIS_LIST_FILE,"r"))==NULL)
{
printf("cannot open file\n");
exit(0);
}
char buff[256] = {0};
while(!feof(fp))
while(fscanf(fp,"%s",buff) > 0)
{
//读取图片;
Mat img=imread(imagepath + buff , CV_LOAD_IMAGE_ANYCOLOR|CV_LOAD_IMAGE_ANYDEPTH);
if (img.empty())
{
break;
}
imshow("ii",img);
getchar();
//waitKey(3000);
memset(buff, 0, sizeof(buff));
}
return 0;
}