36#include <visp3/core/vpConfig.h>
44#if defined(VISP_HAVE_CATCH2)
45#define CATCH_CONFIG_ENABLE_BENCHMARKING
46#define CATCH_CONFIG_RUNNER
49#include <visp3/core/vpImageTools.h>
50#include <visp3/core/vpIoTools.h>
51#include <visp3/io/vpImageIo.h>
53TEST_CASE(
"Benchmark vpImageTools::imageAdd()",
"[benchmark]")
60 common_tools::fill(I2);
63 SECTION(
"Without saturation")
65 const bool saturation =
false;
67 BENCHMARK(
"Benchmark naive imageAdd() code without saturation")
69 common_tools::imageAddRef(I, I2, Iadd, saturation);
73 BENCHMARK(
"Benchmark ViSP imageAdd() code without saturation")
79 SECTION(
"With saturation")
81 const bool saturation =
true;
83 BENCHMARK(
"Benchmark naive imageAdd() code with saturation")
85 common_tools::imageAddRef(I, I2, Iadd, saturation);
89 BENCHMARK(
"Benchmark ViSP imageAdd() code with saturation")
97TEST_CASE(
"Benchmark vpImageTools::imageSubtract()",
"[benchmark]")
104 common_tools::fill(I2);
107 SECTION(
"Without saturation")
109 const bool saturation =
false;
111 BENCHMARK(
"Benchmark naive imageSub() code without saturation")
113 common_tools::imageSubtractRef(I, I2, Isub, saturation);
117 BENCHMARK(
"Benchmark ViSP imageSub() code without saturation")
123 SECTION(
"With saturation")
125 const bool saturation =
true;
127 BENCHMARK(
"Benchmark naive imageSub() code with saturation")
129 common_tools::imageSubtractRef(I, I2, Isub, saturation);
133 BENCHMARK(
"Benchmark ViSP imageSub() code with saturation")
141int main(
int argc,
char *argv[])
143 Catch::Session session;
145 bool runBenchmark =
false;
147 using namespace Catch::clara;
148 auto cli = session.cli()
157 session.applyCommandLine(argc, argv);
160 int numFailed = session.run();
171int main() {
return EXIT_SUCCESS; }
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
Definition of the vpImage class member functions.
unsigned int getWidth() const
unsigned int getHeight() const