Commit 78a968cc authored by Vladimir's avatar Vladimir

Fix #1

parent f5ce6d76
...@@ -45,12 +45,12 @@ using namespace std; ...@@ -45,12 +45,12 @@ using namespace std;
namespace cv namespace cv
{ {
namespace datasets namespace datasets
{ {
class TRACK_votImpl : public TRACK_vot class TRACK_votImpl : public TRACK_vot
{ {
public: public:
//Constructor //Constructor
TRACK_votImpl() TRACK_votImpl()
{ {
...@@ -74,38 +74,38 @@ public: ...@@ -74,38 +74,38 @@ public:
virtual vector <Point2d> getGT(); virtual vector <Point2d> getGT();
private: private:
void loadDataset(const string &path); void loadDataset(const string &path);
string numberToString(int number); string numberToString(int number);
}; };
void TRACK_votImpl::load(const string &path) void TRACK_votImpl::load(const string &path)
{ {
loadDataset(path); loadDataset(path);
} }
string TRACK_votImpl::numberToString(int number) string TRACK_votImpl::numberToString(int number)
{ {
string out; string out;
char numberStr[9]; char numberStr[9];
sprintf(numberStr, "%u", number); sprintf(numberStr, "%u", number);
for (unsigned int i=0; i<8-strlen(numberStr); ++i) for (unsigned int i = 0; i < 8 - strlen(numberStr); ++i)
{ {
out += "0"; out += "0";
} }
out += numberStr; out += numberStr;
return out; return out;
} }
inline bool fileExists(const std::string& name) inline bool fileExists(const std::string& name)
{ {
struct stat buffer; struct stat buffer;
return (stat(name.c_str(), &buffer) == 0); return (stat(name.c_str(), &buffer) == 0);
} }
void TRACK_votImpl::loadDataset(const string &rootPath) void TRACK_votImpl::loadDataset(const string &rootPath)
{ {
ifstream namesList(rootPath + "/list.txt"); ifstream namesList(rootPath + "/list.txt");
//ifstream lengthsList(rootPath + "/lengths.txt"); //ifstream lengthsList(rootPath + "/lengths.txt");
vector <int> datasetsLengths; vector <int> datasetsLengths;
...@@ -164,7 +164,7 @@ void TRACK_votImpl::loadDataset(const string &rootPath) ...@@ -164,7 +164,7 @@ void TRACK_votImpl::loadDataset(const string &rootPath)
} while (true); } while (true);
datasetsLengths.push_back(currFrameID-1); datasetsLengths.push_back(currFrameID - 1);
data.push_back(objects); data.push_back(objects);
} }
} }
...@@ -175,15 +175,15 @@ void TRACK_votImpl::loadDataset(const string &rootPath) ...@@ -175,15 +175,15 @@ void TRACK_votImpl::loadDataset(const string &rootPath)
namesList.close(); namesList.close();
return; return;
} }
int TRACK_votImpl::getDatasetsNum() int TRACK_votImpl::getDatasetsNum()
{ {
return data.size(); return data.size();
} }
int TRACK_votImpl::getDatasetLength(int id) int TRACK_votImpl::getDatasetLength(int id)
{ {
if (id > 0 && id <= (int)data.size()) if (id > 0 && id <= (int)data.size())
return data[id - 1].size(); return data[id - 1].size();
else else
...@@ -191,10 +191,10 @@ int TRACK_votImpl::getDatasetLength(int id) ...@@ -191,10 +191,10 @@ int TRACK_votImpl::getDatasetLength(int id)
cout << "Dataset ID is out of range...\n " << "Allowed IDs are: 1~" << (int)data.size() << endl; cout << "Dataset ID is out of range...\n " << "Allowed IDs are: 1~" << (int)data.size() << endl;
return -1; return -1;
} }
} }
bool TRACK_votImpl::initDataset(int id) bool TRACK_votImpl::initDataset(int id)
{ {
if (id > 0 && id <= (int)data.size()) if (id > 0 && id <= (int)data.size())
{ {
activeDatasetID = id; activeDatasetID = id;
...@@ -205,26 +205,25 @@ bool TRACK_votImpl::initDataset(int id) ...@@ -205,26 +205,25 @@ bool TRACK_votImpl::initDataset(int id)
cout << "Dataset ID is out of range...\n " << "Allowed IDs are: 1~" << (int)data.size() << endl; cout << "Dataset ID is out of range...\n " << "Allowed IDs are: 1~" << (int)data.size() << endl;
return false; return false;
} }
} }
bool TRACK_votImpl::getNextFrame(Mat &frame) bool TRACK_votImpl::getNextFrame(Mat &frame)
{ {
frame = imread(data[activeDatasetID - 1][frameCounter]->imagePath); frame = imread(data[activeDatasetID - 1][frameCounter]->imagePath);
frameCounter++; frameCounter++;
return !frame.empty(); return !frame.empty();
} }
Ptr<TRACK_vot> TRACK_vot::create() Ptr<TRACK_vot> TRACK_vot::create()
{ {
return Ptr<TRACK_votImpl>(new TRACK_votImpl); return Ptr<TRACK_votImpl>(new TRACK_votImpl);
} }
vector <Point2d> TRACK_votImpl::getGT() vector <Point2d> TRACK_votImpl::getGT()
{ {
Ptr <TRACK_votObj> currObj = data[activeDatasetID - 1][frameCounter - 1]; Ptr <TRACK_votObj> currObj = data[activeDatasetID - 1][frameCounter - 1];
return currObj->gtbb; return currObj->gtbb;
} }
}
} }
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment