Commit d264907f authored by Maria Dimashova's avatar Maria Dimashova

uprated detector test

parent dd72f2ec
...@@ -535,6 +535,7 @@ protected: ...@@ -535,6 +535,7 @@ protected:
virtual int processResults( int datasetIdx, int caseIdx ) = 0; virtual int processResults( int datasetIdx, int caseIdx ) = 0;
void writeAllPlotData() const; void writeAllPlotData() const;
virtual void writePlotData( int datasetIdx ) const {}; virtual void writePlotData( int datasetIdx ) const {};
virtual void writeAveragePlotData() const {};
string algName; string algName;
bool isWriteParams, isWriteResults, isWriteGraphicsData; bool isWriteParams, isWriteResults, isWriteGraphicsData;
...@@ -731,6 +732,7 @@ void BaseQualityTest::writeAllPlotData() const ...@@ -731,6 +732,7 @@ void BaseQualityTest::writeAllPlotData() const
{ {
writePlotData( di ); writePlotData( di );
} }
writeAveragePlotData();
} }
void BaseQualityTest::run ( int ) void BaseQualityTest::run ( int )
...@@ -817,6 +819,7 @@ protected: ...@@ -817,6 +819,7 @@ protected:
virtual void writeDefaultRunParams( FileStorage &fs ) const; virtual void writeDefaultRunParams( FileStorage &fs ) const;
virtual void writePlotData( int di ) const; virtual void writePlotData( int di ) const;
virtual void writeAveragePlotData() const;
void openToWriteKeypointsFile( FileStorage& fs, int datasetIdx ); void openToWriteKeypointsFile( FileStorage& fs, int datasetIdx );
...@@ -958,7 +961,6 @@ void DetectorQualityTest::writePlotData(int di ) const ...@@ -958,7 +961,6 @@ void DetectorQualityTest::writePlotData(int di ) const
stringstream rFilename, cFilename; stringstream rFilename, cFilename;
rFilename << getPlotPath() << algName << "_" << DATASET_NAMES[di] << "_repeatability.csv"; rFilename << getPlotPath() << algName << "_" << DATASET_NAMES[di] << "_repeatability.csv";
cFilename << getPlotPath() << algName << "_" << DATASET_NAMES[di] << "_correspondenceCount.csv"; cFilename << getPlotPath() << algName << "_" << DATASET_NAMES[di] << "_correspondenceCount.csv";
ofstream rfile(rFilename.str().c_str()), cfile(cFilename.str().c_str()); ofstream rfile(rFilename.str().c_str()), cfile(cFilename.str().c_str());
for( int ci = 0; ci < TEST_CASE_COUNT; ci++ ) for( int ci = 0; ci < TEST_CASE_COUNT; ci++ )
{ {
...@@ -967,6 +969,27 @@ void DetectorQualityTest::writePlotData(int di ) const ...@@ -967,6 +969,27 @@ void DetectorQualityTest::writePlotData(int di ) const
} }
} }
void DetectorQualityTest::writeAveragePlotData() const
{
stringstream rFilename, cFilename;
rFilename << getPlotPath() << algName << "_average_repeatability.csv";
cFilename << getPlotPath() << algName << "_average_correspondenceCount.csv";
ofstream rfile(rFilename.str().c_str()), cfile(cFilename.str().c_str());
float avRep = 0, avCorCount = 0;
for( int di = 0; di < DATASETS_COUNT; di++ )
{
for( int ci = 0; ci < TEST_CASE_COUNT; ci++ )
{
avRep += calcQuality[di][ci].repeatability;
avCorCount += calcQuality[di][ci].correspondenceCount;
}
}
avRep /= DATASETS_COUNT*TEST_CASE_COUNT;
avCorCount /= DATASETS_COUNT*TEST_CASE_COUNT;
rfile << algName << ", " << avRep << endl;
cfile << algName << ", " << cvRound(avCorCount) << endl;
}
void DetectorQualityTest::openToWriteKeypointsFile( FileStorage& fs, int datasetIdx ) void DetectorQualityTest::openToWriteKeypointsFile( FileStorage& fs, int datasetIdx )
{ {
string filename = string(ts->get_data_path()) + KEYPOINTS_DIR + algName + "_"+ string filename = string(ts->get_data_path()) + KEYPOINTS_DIR + algName + "_"+
......
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