mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:37:48 +02:00
Added worst tile value to test.
This commit is contained in:
parent
6cc510a5a9
commit
c8648c7016
8 changed files with 36 additions and 14 deletions
|
@ -43,6 +43,8 @@ void ImageComparer::compareImages(const QImage& resultImage, const QImage& expec
|
||||||
|
|
||||||
int windowCounter{ 0 };
|
int windowCounter{ 0 };
|
||||||
double ssim{ 0.0 };
|
double ssim{ 0.0 };
|
||||||
|
double worstTileValue{ 1.0 };
|
||||||
|
|
||||||
double min { 1.0 };
|
double min { 1.0 };
|
||||||
double max { -1.0 };
|
double max { -1.0 };
|
||||||
|
|
||||||
|
@ -108,6 +110,10 @@ void ImageComparer::compareImages(const QImage& resultImage, const QImage& expec
|
||||||
if (value < min) min = value;
|
if (value < min) min = value;
|
||||||
if (value > max) max = value;
|
if (value > max) max = value;
|
||||||
|
|
||||||
|
if (value < worstTileValue) {
|
||||||
|
worstTileValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
++windowCounter;
|
++windowCounter;
|
||||||
|
|
||||||
y += WIN_SIZE;
|
y += WIN_SIZE;
|
||||||
|
@ -122,12 +128,17 @@ void ImageComparer::compareImages(const QImage& resultImage, const QImage& expec
|
||||||
_ssimResults.min = min;
|
_ssimResults.min = min;
|
||||||
_ssimResults.max = max;
|
_ssimResults.max = max;
|
||||||
_ssimResults.ssim = ssim / windowCounter;
|
_ssimResults.ssim = ssim / windowCounter;
|
||||||
|
_ssimResults.worstTileValue = worstTileValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
double ImageComparer::getSSIMValue() {
|
double ImageComparer::getSSIMValue() {
|
||||||
return _ssimResults.ssim;
|
return _ssimResults.ssim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double ImageComparer::getWorstTileValue() {
|
||||||
|
return _ssimResults.worstTileValue;
|
||||||
|
}
|
||||||
|
|
||||||
SSIMResults ImageComparer::getSSIMResults() {
|
SSIMResults ImageComparer::getSSIMResults() {
|
||||||
return _ssimResults;
|
return _ssimResults;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@
|
||||||
class ImageComparer {
|
class ImageComparer {
|
||||||
public:
|
public:
|
||||||
void compareImages(const QImage& resultImage, const QImage& expectedImage);
|
void compareImages(const QImage& resultImage, const QImage& expectedImage);
|
||||||
|
|
||||||
double getSSIMValue();
|
double getSSIMValue();
|
||||||
|
double getWorstTileValue();
|
||||||
|
|
||||||
SSIMResults getSSIMResults();
|
SSIMResults getSSIMResults();
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ QPixmap MismatchWindow::computeDiffPixmap(const QImage& expectedImage, const QIm
|
||||||
}
|
}
|
||||||
|
|
||||||
void MismatchWindow::setTestResult(const TestResult& testResult) {
|
void MismatchWindow::setTestResult(const TestResult& testResult) {
|
||||||
errorLabel->setText("Similarity: " + QString::number(testResult._error));
|
errorLabel->setText("Similarity: " + QString::number(testResult._errorGlobal) + " (worst tile: " + QString::number(testResult._errorLocal) + ")");
|
||||||
|
|
||||||
imagePath->setText("Path to test: " + testResult._pathname);
|
imagePath->setText("Path to test: " + testResult._pathname);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ Nitpick::Nitpick(QWidget* parent) : QMainWindow(parent) {
|
||||||
|
|
||||||
_ui.plainTextEdit->setReadOnly(true);
|
_ui.plainTextEdit->setReadOnly(true);
|
||||||
|
|
||||||
setWindowTitle("Nitpick - v3.1.2");
|
setWindowTitle("Nitpick - v3.1.3");
|
||||||
|
|
||||||
clientProfiles << "VR-High" << "Desktop-High" << "Desktop-Low" << "Mobile-Touch" << "VR-Standalone";
|
clientProfiles << "VR-High" << "Desktop-High" << "Desktop-Low" << "Mobile-Touch" << "VR-Standalone";
|
||||||
_ui.clientProfileComboBox->insertItems(0, clientProfiles);
|
_ui.clientProfileComboBox->insertItems(0, clientProfiles);
|
||||||
|
|
|
@ -83,6 +83,7 @@ int TestCreator::compareImageLists() {
|
||||||
QImage expectedImage(_expectedImagesFullFilenames[i]);
|
QImage expectedImage(_expectedImagesFullFilenames[i]);
|
||||||
|
|
||||||
double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical
|
double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical
|
||||||
|
double worstTileValue; // in [-1.0 .. 1.0], where 1.0 means images are identical
|
||||||
|
|
||||||
bool isInteractiveMode = (!_isRunningFromCommandLine && _checkBoxInteractiveMode->isChecked() && !_isRunningInAutomaticTestRun);
|
bool isInteractiveMode = (!_isRunningFromCommandLine && _checkBoxInteractiveMode->isChecked() && !_isRunningInAutomaticTestRun);
|
||||||
|
|
||||||
|
@ -93,10 +94,12 @@ int TestCreator::compareImageLists() {
|
||||||
} else {
|
} else {
|
||||||
_imageComparer.compareImages(resultImage, expectedImage);
|
_imageComparer.compareImages(resultImage, expectedImage);
|
||||||
similarityIndex = _imageComparer.getSSIMValue();
|
similarityIndex = _imageComparer.getSSIMValue();
|
||||||
|
worstTileValue = _imageComparer.getWorstTileValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResult testResult = TestResult{
|
TestResult testResult = TestResult{
|
||||||
(float)similarityIndex,
|
similarityIndex,
|
||||||
|
worstTileValue,
|
||||||
_expectedImagesFullFilenames[i].left(_expectedImagesFullFilenames[i].lastIndexOf("/") + 1), // path to the test (including trailing /)
|
_expectedImagesFullFilenames[i].left(_expectedImagesFullFilenames[i].lastIndexOf("/") + 1), // path to the test (including trailing /)
|
||||||
QFileInfo(_expectedImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of expected image
|
QFileInfo(_expectedImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of expected image
|
||||||
QFileInfo(_resultImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of result image
|
QFileInfo(_resultImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of result image
|
||||||
|
@ -105,10 +108,9 @@ int TestCreator::compareImageLists() {
|
||||||
|
|
||||||
_mismatchWindow.setTestResult(testResult);
|
_mismatchWindow.setTestResult(testResult);
|
||||||
|
|
||||||
if (similarityIndex < THRESHOLD) {
|
if (similarityIndex < THRESHOLD_GLOBAL || worstTileValue < THRESHOLD_LOCAL) {
|
||||||
++numberOfFailures;
|
|
||||||
|
|
||||||
if (!isInteractiveMode) {
|
if (!isInteractiveMode) {
|
||||||
|
++numberOfFailures;
|
||||||
appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true);
|
appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true);
|
||||||
} else {
|
} else {
|
||||||
_mismatchWindow.exec();
|
_mismatchWindow.exec();
|
||||||
|
@ -117,6 +119,7 @@ int TestCreator::compareImageLists() {
|
||||||
case USER_RESPONSE_PASS:
|
case USER_RESPONSE_PASS:
|
||||||
break;
|
break;
|
||||||
case USE_RESPONSE_FAIL:
|
case USE_RESPONSE_FAIL:
|
||||||
|
++numberOfFailures;
|
||||||
appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true);
|
appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true);
|
||||||
break;
|
break;
|
||||||
case USER_RESPONSE_ABORT:
|
case USER_RESPONSE_ABORT:
|
||||||
|
@ -198,7 +201,8 @@ void TestCreator::appendTestResultsToFile(const TestResult& testResult, const QP
|
||||||
stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << endl; // remove trailing '/'
|
stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << endl; // remove trailing '/'
|
||||||
stream << "Expected image was " << testResult._expectedImageFilename << endl;
|
stream << "Expected image was " << testResult._expectedImageFilename << endl;
|
||||||
stream << "Actual image was " << testResult._actualImageFilename << endl;
|
stream << "Actual image was " << testResult._actualImageFilename << endl;
|
||||||
stream << "Similarity index was " << testResult._error << endl;
|
stream << "Similarity index was " << testResult._errorGlobal << endl;
|
||||||
|
stream << "Worst tile was " << testResult._errorLocal << endl;
|
||||||
|
|
||||||
descriptionFile.close();
|
descriptionFile.close();
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,8 @@ private:
|
||||||
const QString TEST_RESULTS_FOLDER { "TestResults" };
|
const QString TEST_RESULTS_FOLDER { "TestResults" };
|
||||||
const QString TEST_RESULTS_FILENAME { "TestResults.txt" };
|
const QString TEST_RESULTS_FILENAME { "TestResults.txt" };
|
||||||
|
|
||||||
const double THRESHOLD{ 0.9999 };
|
const double THRESHOLD_GLOBAL{ 0.9999 };
|
||||||
|
const double THRESHOLD_LOCAL { 0.7770 };
|
||||||
|
|
||||||
QDir _imageDirectory;
|
QDir _imageDirectory;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,9 @@ public:
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
std::vector<double> results;
|
std::vector<double> results;
|
||||||
|
|
||||||
double ssim;
|
double ssim;
|
||||||
|
double worstTileValue;
|
||||||
|
|
||||||
// Used for scaling
|
// Used for scaling
|
||||||
double min;
|
double min;
|
||||||
|
@ -27,15 +29,17 @@ public:
|
||||||
|
|
||||||
class TestResult {
|
class TestResult {
|
||||||
public:
|
public:
|
||||||
TestResult(float error, const QString& pathname, const QString& expectedImageFilename, const QString& actualImageFilename, const SSIMResults& ssimResults) :
|
TestResult(double errorGlobal, double errorLocal, const QString& pathname, const QString& expectedImageFilename, const QString& actualImageFilename, const SSIMResults& ssimResults) :
|
||||||
_error(error),
|
_errorGlobal(errorGlobal),
|
||||||
|
_errorLocal(errorLocal),
|
||||||
_pathname(pathname),
|
_pathname(pathname),
|
||||||
_expectedImageFilename(expectedImageFilename),
|
_expectedImageFilename(expectedImageFilename),
|
||||||
_actualImageFilename(actualImageFilename),
|
_actualImageFilename(actualImageFilename),
|
||||||
_ssimResults(ssimResults)
|
_ssimResults(ssimResults)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
double _error;
|
double _errorGlobal;
|
||||||
|
double _errorLocal;
|
||||||
|
|
||||||
QString _pathname;
|
QString _pathname;
|
||||||
QString _expectedImageFilename;
|
QString _expectedImageFilename;
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<widget class="QLabel" name="diffImage">
|
<widget class="QLabel" name="diffImage">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>540</x>
|
<x>900</x>
|
||||||
<y>480</y>
|
<y>480</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>450</height>
|
<height>450</height>
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>60</x>
|
<x>60</x>
|
||||||
<y>630</y>
|
<y>630</y>
|
||||||
<width>480</width>
|
<width>540</width>
|
||||||
<height>28</height>
|
<height>28</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Abort current test</string>
|
<string>Abort evaluation</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="errorLabel">
|
<widget class="QLabel" name="errorLabel">
|
||||||
|
|
Loading…
Reference in a new issue