c 语言小技巧之二 自动创建目录
来源:互联网 发布:tnt网络瘫痪 编辑:程序博客网 时间:2024/05/17 03:45
int main()
{
bool first = true;
double average = 0.0;
fstream fout;
fout.open("log2017904.txt", ios::app | ios::out);
int noface = 0;
char imgpath[260];
char imgpath2[260];
string imagefolder_path = "E:\\face_data\\CASIA-WebFace";
// vector<string> files;
// getFiles("E:\\face_data\\CASIA-WebFace", files);
int label = 0;
fstream fin;
fin.open("E:\\face_data\\cleaned list-casia.txt", ios::in || ios::app);
string stemp;
while (!fin.eof())
{
fin >> stemp >>label;
cout << "stemp " << stemp << endl;
sprintf(imgpath, "%s/%s", imagefolder_path.c_str(), stemp.c_str());
Mat img = imread(imgpath);
imshow("img", img);
cvWaitKey(3);
int last = stemp.find_last_of(".");
int begin1 = stemp.find_last_of("\\");
int begin2 = stemp.find_last_of("/");
int begin = max(begin1, begin2);
string sub_path = stemp.substr(0, begin);
string name_image = stemp.substr(begin + 1, last - begin - 1);
cout << "name " << name_image << endl;
int facecount = FD_Detect(FD_handle, img.data, img.cols, img.rows, rect);
if (facecount > 0)
{
char dir[260];
sprintf(dir, "5K_new_20170901//%s", sub_path.c_str());
if (_access(dir, 0) == -1)
{
_mkdir(dir);
/*for (int i = 0; i < 2; i++)
{
sprintf(dir, "5K_new_20170901//%d", i);
_mkdir(dir);
}*/
}
//sprintf(imgpath2, "5K_new_20170901\\%s\\%s.jpg", name.c_str(), name_image.c_str())
sprintf(imgpath2, "5K_new_20170901\\%s",stemp.c_str());
cout << "imgpath2" << imgpath2 << endl;
FF_FeaExtract(FF_handle, img.data, img.cols, img.rows, feature, rect[0], imgpath2);
}
else
{
noface++;
fout << "no facecount" << endl;
}
}
system("pause");
// fout << imgpath << endl;
FD_Destroy(FD_handle);
delete[] rect;
return 1;
}
- c 语言小技巧之二 自动创建目录
- c语言小技巧-之多线程创建
- c 语言小技巧
- C语言小技巧
- c语言小技巧
- c 语言小技巧
- C语言小技巧
- c语言技巧二
- c语言创建多级目录
- VC小技巧--创建多级目录
- c语言编程小技巧:c语言小技巧:枚举
- C语言小技巧之怎么找到需要的部分
- C语言中的小技巧
- C语言编程小技巧
- C语言使用小技巧
- C语言应用小技巧
- Delphi编程实用小技巧(二)——自动创建按钮和菜单项
- C语言的那些小秘密之指针(二)
- lombok在idea上部署
- 图像识别算法
- Handler+Looper
- Android 调用系统邮箱
- windows和linux之间通过scp进行文件复制
- c 语言小技巧之二 自动创建目录
- awk之原文编辑(类似 sed -i 功能)
- 成为Java GC专家(5)—Java性能调优原则
- 链表排序 -lintcode
- JavaScript Tween算法及缓动效果
- Linux常用命令
- HDU1248 寒冰王座(母函数)
- javascript内置对象常用属性和方法(笔记二)
- Android ANR