Test images addition / subtraction.
#include <visp3/core/vpConfig.h>
#if defined(VISP_HAVE_CATCH2)
#include "common.hpp"
#include <catch_amalgamated.hpp>
#include <visp3/core/vpImageTools.h>
#include <visp3/core/vpIoTools.h>
#include <visp3/io/vpImageIo.h>
#ifdef ENABLE_VISP_NAMESPACE
#endif
TEST_CASE("Test vpImageTools::imageAdd()", "[image_add]")
{
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]")
{
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 EXIT_SUCCESS; }
#endif
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
unsigned int getWidth() const
unsigned int getHeight() const