Exemple #1
0
void SearchFolder(char* folder, FEATURE* feature, CvSeq* scores, void (*f)(char*, FEATURE*, CvSeq*)){
	char dir_path[FLEN];
	DIR *dbDir = NULL;
	struct dirent *file = NULL;
	struct stat buf;

	dbDir = opendir(folder);
	if(!dbDir) {
		fprintf(stderr, "ERROR\n");
	}
	while( (file = readdir(dbDir)) != NULL ){
        memset(&buf, 0, sizeof(struct stat));

        strcpy(dir_path, folder);
		strcat(dir_path,"/");
		strcat(dir_path, file->d_name);
		lstat(dir_path, &buf);
        if(	strcmp(file->d_name, ".")!=0 &&
			strcmp(file->d_name, "..")!=0 &&
			S_ISDIR(buf.st_mode)){ //folder
        	//printf("searching a folder: %s\n", dir_path);
        	SearchFolder(dir_path, feature, scores, f);

        }else if(S_ISREG(buf.st_mode)){  //regular file
            if (IsImageFile(file->d_name)){//For each Image File
            	//printf("comparing to an image: %s\n", dir_path);
            	(*f)(dir_path, feature, scores);
            }
        }
	}
	closedir(dbDir);
}
Exemple #2
0
bool FileInfo::IsImageFile()const
{
	return IsImageFile(mFileType);
}