Test images addition / subtraction.
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_CATCH2)
#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <visp3/core/vpImageTools.h>
#include <visp3/core/vpIoTools.h>
#include <visp3/io/vpImageIo.h>
#include "common.hpp"
TEST_CASE("Test vpImageTools::imageAdd()", "[image_add]") {
"Klimt/Klimt.pgm");
SECTION("I + Inull = I")
{
CHECK((Iadd == I));
}
SECTION("I + I without saturation")
{
const bool saturation = false;
common_tools::imageAddRef(I, I, Iref, saturation);
CHECK((Iadd == Iref));
}
SECTION("I + I with saturation")
{
const bool saturation = true;
common_tools::imageAddRef(I, I, Iref, saturation);
CHECK((Iadd == Iref));
}
}
TEST_CASE("Test vpImageTools::imageDifference()", "[image_difference]") {
"Klimt/Klimt.pgm");
SECTION("I - Inull = I")
{
CHECK((Isub == I));
}
SECTION("I - I2 without saturation")
{
const bool saturation = false;
common_tools::fill(I2);
common_tools::imageSubtractRef(I, I2, Iref, saturation);
CHECK((Isub == Iref));
}
SECTION("I - I2 with saturation ")
{
const bool saturation = true;
common_tools::fill(I2);
common_tools::imageSubtractRef(I, I2, Iref, saturation);
CHECK((Isub == Iref));
}
}
int main(int argc, char *argv[])
{
Catch::Session session;
session.applyCommandLine(argc, argv);
int numFailed = session.run();
return numFailed;
}
#else
int main()
{
return 0;
}
#endif