18 #ifndef PIC_METRICS_RELATIVE_ERROR_HPP 19 #define PIC_METRICS_RELATIVE_ERROR_HPP 23 #include "../base.hpp" 24 #include "../image.hpp" 26 #include "../metrics/base.hpp" 40 if(ori == NULL || cmp == NULL) {
52 int size = ori->
size();
58 if(!bLargeDifferences) {
59 largeDifferences = FLT_MAX;
62 for(
int i = 0; i < size; i++) {
66 double delta = fabs(o_val - c_val);
68 if(delta <= largeDifferences) {
72 relErr += delta / o_val;
78 return relErr / double(count);
int size() const
size computes the number of values.
Definition: image.hpp:481
float * data
data is the main buffer where pixel values are stored.
Definition: image.hpp:91
bool isSimilarType(const Image *img)
isSimilarType checks if the current image is similar to img; i.e. if they have the same width...
float changeDomain(float x, METRICS_DOMAIN type=MD_LIN)
changeDomain
Definition: base.hpp:38
#define PIC_INLINE
Definition: base.hpp:33
PIC_INLINE double RelativeError(Image *ori, Image *cmp, bool bLargeDifferences=false, METRICS_DOMAIN type=MD_LIN)
RelativeError computes the relative error between two images.
Definition: relative_error.hpp:38
The Image class stores an image as buffer of float.
Definition: image.hpp:60
Definition: bilateral_separation.hpp:25
const double C_SINGULARITY
Definition: base.hpp:26
bool isValid()
isValid checks if the current image is valid, which means if they have an allocated buffer or not...
METRICS_DOMAIN
Definition: base.hpp:30
const float C_LARGE_DIFFERENCESf
Definition: base.hpp:28