45 #ifndef OPENCV_CORE_SATURATE_HPP
46 #define OPENCV_CORE_SATURATE_HPP
48 #include "opencv2/core/cvdef.h"
50 #include "opencv2/core/fast_math.hpp"
87 template<
typename _Tp>
static inline _Tp
saturate_cast(
short v) {
return _Tp(v); }
89 template<
typename _Tp>
static inline _Tp
saturate_cast(
unsigned v) {
return _Tp(v); }
91 template<
typename _Tp>
static inline _Tp
saturate_cast(
int v) {
return _Tp(v); }
93 template<
typename _Tp>
static inline _Tp
saturate_cast(
float v) {
return _Tp(v); }
95 template<
typename _Tp>
static inline _Tp
saturate_cast(
double v) {
return _Tp(v); }
131 template<>
inline short saturate_cast<short>(
int v) {
return (
short)((unsigned)(v - SHRT_MIN) <= (unsigned)USHRT_MAX ? v : v > 0 ? SHRT_MAX : SHRT_MIN); }
161 template<
typename _Tp>
static inline _Tp
saturate_cast(hfloat v) {
return saturate_cast<_Tp>((
float)v); }
signed char schar
Definition: interface.h:48
unsigned char uchar
Definition: interface.h:51
int64_t int64
Definition: interface.h:61
unsigned short ushort
Definition: interface.h:52
uint64_t uint64
Definition: interface.h:62
int saturate_cast< int >(unsigned v)
Definition: saturate.hpp:138
uchar saturate_cast< uchar >(schar v)
Definition: saturate.hpp:101
uint64 saturate_cast< uint64 >(schar v)
Definition: saturate.hpp:153
int64 saturate_cast< int64 >(uint64 v)
Definition: saturate.hpp:158
CV_INLINE int cvRound(double value)
Rounds floating-point number to the nearest integer.
Definition: fast_math.hpp:200
short saturate_cast< short >(ushort v)
Definition: saturate.hpp:130
ushort saturate_cast< ushort >(schar v)
Definition: saturate.hpp:121
hfloat saturate_cast< hfloat >(uchar v)
Definition: saturate.hpp:165
unsigned saturate_cast< unsigned >(schar v)
Definition: saturate.hpp:144
static _Tp saturate_cast(uchar v)
Template function for accurate conversion from one primitive type to another.
Definition: saturate.hpp:81
schar saturate_cast< schar >(uchar v)
Definition: saturate.hpp:111
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441