34 #include <visp3/core/vpConfig.h>
42 #if defined(VISP_HAVE_CATCH2)
43 #define CATCH_CONFIG_ENABLE_BENCHMARKING
44 #define CATCH_CONFIG_RUNNER
47 #include <visp3/core/vpImageTools.h>
48 #include <visp3/core/vpIoTools.h>
49 #include <visp3/io/vpImageIo.h>
51 #ifdef ENABLE_VISP_NAMESPACE
54 TEST_CASE(
"Benchmark vpImageTools::imageAdd()",
"[benchmark]")
61 common_tools::fill(I2);
64 SECTION(
"Without saturation")
66 const bool saturation =
false;
68 BENCHMARK(
"Benchmark naive imageAdd() code without saturation")
70 common_tools::imageAddRef(I, I2, Iadd, saturation);
74 BENCHMARK(
"Benchmark ViSP imageAdd() code without saturation")
80 SECTION(
"With saturation")
82 const bool saturation =
true;
84 BENCHMARK(
"Benchmark naive imageAdd() code with saturation")
86 common_tools::imageAddRef(I, I2, Iadd, saturation);
90 BENCHMARK(
"Benchmark ViSP imageAdd() code with saturation")
98 TEST_CASE(
"Benchmark vpImageTools::imageSubtract()",
"[benchmark]")
105 common_tools::fill(I2);
108 SECTION(
"Without saturation")
110 const bool saturation =
false;
112 BENCHMARK(
"Benchmark naive imageSub() code without saturation")
114 common_tools::imageSubtractRef(I, I2, Isub, saturation);
118 BENCHMARK(
"Benchmark ViSP imageSub() code without saturation")
124 SECTION(
"With saturation")
126 const bool saturation =
true;
128 BENCHMARK(
"Benchmark naive imageSub() code with saturation")
130 common_tools::imageSubtractRef(I, I2, Isub, saturation);
134 BENCHMARK(
"Benchmark ViSP imageSub() code with saturation")
142 int main(
int argc,
char *argv[])
144 Catch::Session session;
146 bool runBenchmark =
false;
148 using namespace Catch::clara;
149 auto cli = session.cli()
158 session.applyCommandLine(argc, argv);
161 int numFailed = session.run();
172 int main() {
return EXIT_SUCCESS; }
static void read(vpImage< unsigned char > &I, const std::string &filename, int backend=IO_DEFAULT_BACKEND)
unsigned int getWidth() const
unsigned int getHeight() const