C++ 这个opencv程序用于同时从文件夹加载不同的图像,但它只读取一个图像
此OpenCV程序用于同时从文件夹加载不同的图像。但它只显示了一张图片,请帮我找到这里发生了什么C++ 这个opencv程序用于同时从文件夹加载不同的图像,但它只读取一个图像,c++,opencv,C++,Opencv,此OpenCV程序用于同时从文件夹加载不同的图像。但它只显示了一张图片,请帮我找到这里发生了什么 #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include<cv.h> #include<highgui.h> using namespace std; using namespace cv; int mai
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include<cv.h>
#include<highgui.h>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
struct dirent *dirpent;
DIR *dirp;
IplImage* image;
if(argc!=2)
{
printf("Cant continue with the program\n");
return 0;
}
dirp= opendir(argv[1]);
if(dirp==NULL)
{
cout<<"error"<<endl;
}
while(dirpent=readdir(dirp))
{
char *b=dirpent->d_name;
if(b[0]=='.')
{
}
else
{
image=(IplImage*)cvLoadImage(dirpent->d_name);
cvNamedWindow("output");
cvShowImage("output",image);
cvWaitKey(0);
cvReleaseImage(&image);
cvDestroyWindow("output");
}
}
closedir(dirp);
return 0;
}
#包括
#包括
#包括
#包括
#包括
使用名称空间std;
使用名称空间cv;
int main(int argc,char*argv[])
{
结构方向*方向;
DIR*dirp;
IplImage*图像;
如果(argc!=2)
{
printf(“无法继续执行程序\n”);
返回0;
}
dirp=opendir(argv[1]);
if(dirp==NULL)
{
当
-范围时,请尝试将以下行移出范围(之后):
cvReleaseImage(&image);
cvDestroyWindow("output");
并将以下行移到while
-scope之前,因为您不需要每次都创建窗口
cvNamedWindow("output");
同时?你是说一个接一个地装?