36 #include <visp3/core/vpConfig.h> 44 #if defined(VISP_HAVE_CATCH2) 45 #define CATCH_CONFIG_ENABLE_BENCHMARKING 46 #define CATCH_CONFIG_RUNNER 48 #include <visp3/core/vpImageTools.h> 49 #include <visp3/core/vpIoTools.h> 50 #include <visp3/io/vpImageIo.h> 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") {
68 common_tools::imageAddRef(I, I2, Iadd, saturation);
72 BENCHMARK(
"Benchmark ViSP imageAdd() code without saturation") {
77 SECTION(
"With saturation")
79 const bool saturation =
true;
81 BENCHMARK(
"Benchmark naive imageAdd() code with saturation") {
82 common_tools::imageAddRef(I, I2, Iadd, saturation);
86 BENCHMARK(
"Benchmark ViSP imageAdd() code with saturation") {
93 TEST_CASE(
"Benchmark vpImageTools::imageSubtract()",
"[benchmark]") {
100 common_tools::fill(I2);
103 SECTION(
"Without saturation")
105 const bool saturation =
false;
107 BENCHMARK(
"Benchmark naive imageSub() code without saturation") {
108 common_tools::imageSubtractRef(I, I2, Isub, saturation);
112 BENCHMARK(
"Benchmark ViSP imageSub() code without saturation") {
117 SECTION(
"With saturation")
119 const bool saturation =
true;
121 BENCHMARK(
"Benchmark naive imageSub() code with saturation") {
122 common_tools::imageSubtractRef(I, I2, Isub, saturation);
126 BENCHMARK(
"Benchmark ViSP imageSub() code with saturation") {
133 int main(
int argc,
char *argv[])
135 Catch::Session session;
137 bool runBenchmark =
false;
139 using namespace Catch::clara;
140 auto cli = session.cli()
149 session.applyCommandLine(argc, argv);
152 int numFailed = session.run();
unsigned int getWidth() const
static void read(vpImage< unsigned char > &I, const std::string &filename)
unsigned int getHeight() const