CVB++ 15.0
norm.hpp
1#pragma once
2
3#if defined _WIN32
4
5# include "../_cexports/c_foundation.h"
6
7# include "../global.hpp"
8# include "../image.hpp"
9# include "../exception.hpp"
10# include "../rect.hpp"
11
12namespace Cvb
13{
14 CVB_BEGIN_INLINE_NS
15
16 namespace Foundation
17 {
18
20
24 namespace Norm
25 {
26
35
37
45 inline double NormL1(const ImagePlane &plane, ValueNormalization normalize, Rect<int> aoi)
46 {
47 double norm;
48 CVB_CALL_CAPI_CHECKED(ImageNormL1(plane.Parent().Handle(), plane.Plane(), aoi.Left(), aoi.Top(), aoi.Right(),
49 aoi.Bottom(), normalize == ValueNormalization::Normalized, norm));
50 return norm;
51 }
52
54
61 inline double NormL1(const ImagePlane &plane, ValueNormalization normalize)
62 {
63 return NormL1(plane, normalize, plane.Parent().Bounds());
64 }
65
67
75 inline double NormL2(const ImagePlane &plane, ValueNormalization normalize, Rect<int> aoi)
76 {
77 double norm;
78 CVB_CALL_CAPI_CHECKED(ImageNormL2(plane.Parent().Handle(), plane.Plane(), aoi.Left(), aoi.Top(), aoi.Right(),
79 aoi.Bottom(), normalize == ValueNormalization::Normalized, norm));
80 return norm;
81 }
82
84
91 inline double NormL2(const ImagePlane &plane, ValueNormalization normalize)
92 {
93 return NormL2(plane, normalize, plane.Parent().Bounds());
94 }
95
97
105 inline double NormLInf(const ImagePlane &plane, ValueNormalization normalize, Rect<int> aoi)
106 {
107 double norm;
108 CVB_CALL_CAPI_CHECKED(ImageNormLInf(plane.Parent().Handle(), plane.Plane(), aoi.Left(), aoi.Top(), aoi.Right(),
109 aoi.Bottom(), normalize == ValueNormalization::Normalized, norm));
110 return norm;
111 }
112
114
121 inline double NormLInf(const ImagePlane &plane, ValueNormalization normalize)
122 {
123 return NormLInf(plane, normalize, plane.Parent().Bounds());
124 }
125
126 } /* namespace Norm */
127
129
130 using Norm::NormL1;
131 using Norm::NormL2;
132 using Norm::NormLInf;
133
134 } /* namespace Foundation */
135 CVB_END_INLINE_NS
136} /* namespace Cvb */
137
138#endif
Rect< int > Bounds() const noexcept
Bounding rectangle of the image in pixels.
Definition decl_image.hpp:438
void * Handle() const noexcept
Classic API image handle.
Definition decl_image.hpp:237
Image plane information container.
Definition decl_image_plane.hpp:29
int Plane() const noexcept
Plane index in the image, to which this plane refers to.
Definition decl_image_plane.hpp:147
const Image & Parent() const noexcept
Image to which this plane descriptor refers to.
Definition detail_image_plane.hpp:87
Rectangle object.
Definition rect.hpp:24
cvbres_t ImageNormL1(IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double &Value)
cvbres_t ImageNormL2(IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double &Value)
cvbres_t ImageNormLInf(IMG ImgIn, cvbdim_t Index, cvbdim_t left, cvbdim_t top, cvbdim_t right, cvbdim_t bottom, cvbbool_t Normalize, double &Value)
Namespace for collection of functions for calculating different norms over the gray values of an imag...
Definition norm.hpp:25
double NormLInf(const ImagePlane &plane, ValueNormalization normalize, Rect< int > aoi)
Calculate and return the L infinity norm (maximum norm) over the pixels inside the plane.
Definition norm.hpp:105
ValueNormalization
Available normalization modes for norm calculations.
Definition norm.hpp:29
@ Normalized
Report norms normalized.
Definition norm.hpp:33
@ Unnormalized
Report norms unnormalized.
Definition norm.hpp:31
double NormL2(const ImagePlane &plane, ValueNormalization normalize, Rect< int > aoi)
Calculate and return the L2 norm (euclidean norm) over the pixels inside the plane.
Definition norm.hpp:75
double NormL1(const ImagePlane &plane, ValueNormalization normalize, Rect< int > aoi)
Calculate and return the L1 norm (sum of absolute values) over all the pixels inside the plane.
Definition norm.hpp:45
Namespace for the Foundation package.
Definition decl_metric_aqs12_calibration_piece.hpp:11
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17