-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClusteringPreprocess.cpp
More file actions
51 lines (42 loc) · 1.15 KB
/
Copy pathClusteringPreprocess.cpp
File metadata and controls
51 lines (42 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "ClusteringPreprocess.h"
ClusteringPreprocess::ClusteringPreprocess()
{
}
ClusteringPreprocess::~ClusteringPreprocess()
{
}
void ClusteringPreprocess::setFiles(int imgFolder)
{
//open the folder of Sample Digits
string path = "Sample Digits Test/" + to_string(imgFolder);
tinydir_dir test_number_dir;
tinydir_open(&test_number_dir, path.c_str());
//iterate inside folder
while (test_number_dir.has_next)
{
//get the image file
tinydir_file testImageFile;
tinydir_readfile(&test_number_dir, &testImageFile);
string testImageFileName = testImageFile.name;
if (testImageFileName != "." && testImageFileName != "..")
{
// prepend full training_files directory
testImageFileName.insert(0, path + "/");
// store training filename and label
testFileNames.push_back(testImageFileName);
testLabels.push_back(0);
//testLabels.push_back(currentNumberLabel);
}
//go into next directory folder
tinydir_next(&test_number_dir);
}
tinydir_close(&test_number_dir);
}
vector<string> ClusteringPreprocess::getTestFileNames()
{
return testFileNames;
}
vector<int> ClusteringPreprocess::getTestMatrixLabels()
{
return testLabels;
}