本文整理汇总了C++中Directory::GetListFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ Directory::GetListFiles方法的具体用法?C++ Directory::GetListFiles怎么用?C++ Directory::GetListFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Directory
的用法示例。
在下文中一共展示了Directory::GetListFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
VOID CALLBACK TimerProc2(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
{
vector<string> fileNames = dir.GetListFiles(dir_path, "*.*", false);
vector<string> fileNames1 = dir.GetListFiles(dir_path1, "*.*", false);
if(i<fileNames.size())
{
string fileName = fileNames[i];
string fileName1=fileNames1[i];
string fileFullName = dir_path + fileName;
string fileFullName1=dir_path1+fileName1;
_Global_Obj_Ptr->img1=imread(fileFullName);
_Global_Obj_Ptr->img2=imread(fileFullName1);
_Global_Obj_Ptr->OnBnClickedEnhance();
_Global_Obj_Ptr->OnBnClickedRegistry();
_Global_Obj_Ptr->OnBnClickedHisfusion();
string fileFullName2=dir_path2+fileName;
imwrite(fileFullName2,_Global_Obj_Ptr->imgfusion);
i++;
}
else
{
i=0;
}
}
示例2:
VOID CALLBACK TimerProc29(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
{
vector<string> fileNames = dir.GetListFiles(dir_path, "*.*", false);
vector<string> fileNames1 = dir.GetListFiles(dir_path1, "*.*", false);
// _Global_Obj_Ptr->ImageName=dir.GetListFiles(dir_path2,"*.*",false);
if(i<fileNames.size())
{
string fileName = fileNames[i];
string fileName1=fileNames1[i];
string fileFullName = dir_path + fileName;
string fileFullName1=dir_path1+fileName1;
_Global_Obj_Ptr->img1=imread(fileFullName);
_Global_Obj_Ptr->img2=imread(fileFullName1);
_Global_Obj_Ptr->OnBnClickedLaplace();
_Global_Obj_Ptr->OnBnClickedTarget();
string fileFullName2=dir_path2+fileName;
imwrite(fileFullName2,_Global_Obj_Ptr->imgfusion);
_Global_Obj_Ptr->ImagePath[i]=fileFullName2.c_str();
i++;
}
else
{
i=0;
}
}
示例3: loadImages
void loadImages(string dirName,vector<Mat>& images,string sep)
{
Directory directory;
vector<string> fileNames=directory.GetListFiles(dirName);
for (vector<string>::iterator i=fileNames.begin(); i!=fileNames.end(); i++) {
if(endWith(toUpperCase(*i),".JPG")||endWith(toUpperCase(*i),".PNG"))
images.push_back(imread(dirName+sep+*i));
}
}
示例4: main
int main(){
string dir_path = "D:\\研究生阶段工作\\201402 CNN\\CNN分割结果的优化问题\\20140417之后的优化工作\\20140513 跑实验\\data\\NEWresize.test.img\\";
string out_path = "D:\\研究生阶段工作\\201402 CNN\\CNN分割结果的优化问题\\20140417之后的优化工作\\20140513 跑实验\\20140519 截取四分之一grabcut\\NEWresize grabcut output\\";
Directory dir;
vector<string> fileNames = dir.GetListFiles(dir_path, "*.jpg", false );
for(int i=0; i < fileNames.size(); i++) {
string fileName = fileNames[i];
string fid = fileName.substr(0, fileName.length()-4);
string fileFullName = dir_path + fileName;
Mat im;
im = imread(fileFullName);
//imshow("lena", im);
Mat mask, bgdmodel, fgdmodel;
Mat res(im.size(), CV_8UC1, Scalar(0));//存放输出的图片
//res.create(im.size(), CV_8UC1, Scalar(0));//与上面的语句等价
//Grabcut的rect,设置为图中央的一个大小为原图1/4的矩形。
int width = im.size().width;
int height = im.size().height;
int x1 = width/4;
int y1 = height/4;
int x2 = width/4*3;
int y2 = height/4*3;
Rect rect(Point(x1, y1), Point(x2, y2));
//GrabCut的mask,这里不起作用,因为grabcut参数设置为GC_INIT_WITH_RECT
mask.create(im.size(), CV_8UC1);
mask.setTo(GC_BGD);
(mask(rect)).setTo(Scalar(GC_PR_FGD));
//用GC_INIT_WITH_RECT时候,Rect中间是GC_PR_FGD,矩形外面是GC_BGD
grabCut(im, mask, rect, bgdmodel, fgdmodel, 1, GC_INIT_WITH_RECT);
res.setTo(255, mask&1);
imwrite(out_path+fid+"_result1.jpg", res);
//注意到copyTo函数的自适应性,res本来是单通道的,copyTo之后变成了和im一样的3通道
im.copyTo(res, mask&1);
imwrite(out_path+fid+"_result2.jpg", res);
imshow("res", res);
//waitKey(0);
}
return 0;
}
示例5: main
int main() {
/*IplImage *img = cvLoadImage("32.jpg");
// 输出汉字
CvxText text("C:\\Windows\\Fonts\\simsun.ttc"); // "zenhei.ttf"为黑体常规
const char *msg = "航";
float p = 1;
text.setFont(NULL, NULL, NULL, &p); // 透明处理
text.putText(img, msg, cvPoint(3.5, 29), CV_RGB(0,0,0));
// 定义窗口,并显示影象
cvShowImage("test", img );
//system("md .\\result1");
cvSaveImage(".//result1//han.jpg", img);
cvWaitKey(-1);
cvReleaseImage(&img);*/
/*Directory dir;
string exten = "*";//"Image*";//"*"
string save_path="D://文字识别//train//";
string save_dir="md D:\\文字识别\\train\\";
bool addPath = false;//false
string dir_path = "E://编程练习//20150515//20150515//ziti";
vector<string> foldernames = dir.GetListFiles(dir_path,exten, addPath);
for (int i = 0; i < foldernames.size(); i++)
cout<<foldernames[i]<<endl;*/
Directory dir;
string exten = "*";//"Image*";//"*"
string save_path="D://文字识别//train64//";
string save_dir="md D:\\文字识别\\train64\\";
bool addPath = false;//false
string dir_path = "D://文字识别//train_3755";
vector<string> foldernames = dir.GetListFolders(dir_path,exten, addPath);
for (int i = 0; i < foldernames.size(); i++)
foldernames[i]=foldernames[i].substr(0, foldernames[i].find_first_of("."));
IplImage *img = cvLoadImage("64.jpg");
IplImage* img2;
string ziti_path = "E://编程练习//20150515//20150515//ziti";
vector<string> ziti_names = dir.GetListFiles(ziti_path,exten, addPath);
string ziti_root="C:\\Windows\\Fonts\\";
stringstream ss;
for(int j=1;j<ziti_names.size();j++){
//if(j==14) continue;
string ziti=ziti_root+ziti_names[j];
cout<<j<<" "<<ziti_names[j]<<" 字体打印中"<<endl;
CvxText text(ziti.c_str());
for (int i = 0; i < foldernames.size(); i++) {
img2 = cvCreateImage(cvGetSize(img),img->depth,img->nChannels);
//将图片1复制到图片2
cvCopy(img,img2,NULL);
const char *msg = foldernames[i].c_str();
//string cmd=save_dir+foldernames[i];
//system(cmd.c_str());
float p = 1.0;
text.setFont(NULL, NULL, NULL, &p); // 透明处理
text.putText(img2, msg, cvPoint(7, 58), CV_RGB(0,0,0));
ss<<j;
string path=save_path+foldernames[i]+"//"+ss.str()+"_"+foldernames[i]+".jpg";
ss.str("");
cvSaveImage(path.c_str(), img2);
}
}
//cout<<foldernames[i]<<endl;
cvWaitKey(-1);
cvReleaseImage(&img);
cvReleaseImage(&img2);
return 0;
}