34 #include <visp3/core/vpConfig.h>
42 #if defined(VISP_HAVE_CATCH2)
45 #include <catch_amalgamated.hpp>
46 #include <visp3/core/vpImageTools.h>
47 #include <visp3/core/vpIoTools.h>
48 #include <visp3/io/vpImageIo.h>
50 #ifdef ENABLE_VISP_NAMESPACE
53 TEST_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")
97 TEST_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")
141 int main(
int argc,
char *argv[])
143 Catch::Session session;
145 bool runBenchmark =
false;
146 auto cli = session.cli()
147 | Catch::Clara::Opt(runBenchmark)[
"--benchmark"](
"run benchmark?");
150 session.applyCommandLine(argc, argv);
153 int numFailed = session.run();
161 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