arithmetic.h
Go to the documentation of this file.
1 /*
2 * ECVL - European Computer Vision Library
3 * Version: 0.3.4
4 * copyright (c) 2021, Università degli Studi di Modena e Reggio Emilia (UNIMORE), AImageLab
5 * Authors:
6 * Costantino Grana (costantino.grana@unimore.it)
7 * Federico Bolelli (federico.bolelli@unimore.it)
8 * Michele Cancilla (michele.cancilla@unimore.it)
9 * Laura Canalini (laura.canalini@unimore.it)
10 * Stefano Allegretti (stefano.allegretti@unimore.it)
11 * All rights reserved.
12 */
13 
14 #ifndef ECVL_ARITHMETIC_H_
15 #define ECVL_ARITHMETIC_H_
16 
17 #include <type_traits>
18 
20 #include "ecvl/core/image.h"
23 
24 namespace ecvl
25 {
26 
27 // TODO add appropriate checks on the size of the images, color spaces and so on ...
28 #define BINARY_ARITHMETIC_OPERATION_IMAGE_IMAGE(Function) \
29 inline void Function(const Image& src1, const Image& src2, Image& dst, DataType dst_type = DataType::none, bool saturate = true) \
30 { \
31  src1.hal_->Function(src1, src2, dst, dst_type, saturate); \
32 } \
33 
34 #define BINARY_ARITHMETIC_OPERATION_IMAGE_SCALAR(Function) \
35 template<typename ST2> \
36 void Function(const Image& src1, const ST2& src2, Image& dst, DataType dst_type = DataType::none, bool saturate = true) \
37 { \
38  src1.hal_->Function(src1, src2, dst, dst_type, saturate); \
39 } \
40 
41 #define BINARY_ARITHMETIC_OPERATION_SCALAR_IMAGE(Function) \
42 template<typename ST1> \
43 void Function(const ST1& src1, const Image& src2, Image& dst, DataType dst_type = DataType::none, bool saturate = true) \
44 { \
45  src2.hal_->Function(src1, src2, dst, dst_type, saturate); \
46 } \
47 
48 
70 
71 
93 
94 
117 
121 
125 
129 
130 
146 inline void Neg(const Image& src, Image& dst, DataType dst_type = DataType::none, bool saturate = true) { \
147  src.hal_->Neg(src, dst, dst_type, saturate);
148 }
149 
150 } // namespace ecvl
151 
152 #endif // !ECVL_ARITHMETIC_H_
Image class.
Definition: image.h:72
void Mul(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
Definition: arithmetic.h:122
#define BINARY_ARITHMETIC_OPERATION_IMAGE_IMAGE(Function)
Definition: arithmetic.h:28
DataType
DataType is an enum class which defines data types allowed for images.
Definition: datatype.h:43
#define BINARY_ARITHMETIC_OPERATION_SCALAR_IMAGE(Function)
Definition: arithmetic.h:41
void Add(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
Adds two source Images storing the result into a destination Image.
Definition: arithmetic.h:69
void Sub(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
Definition: arithmetic.h:118
#define BINARY_ARITHMETIC_OPERATION_IMAGE_SCALAR(Function)
Definition: arithmetic.h:34
void Neg(const Image &src, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
Negation of an Image.
Definition: arithmetic.h:146
void Div(const Image &src1, const Image &src2, Image &dst, DataType dst_type=DataType::none, bool saturate=true)
Definition: arithmetic.h:126