25 #ifndef INCLUDED_OpenCVTypeDispatch_h_GUID_BA2EFF7D_152D_4FA6_6454_B8F3AC30FB3F 26 #define INCLUDED_OpenCVTypeDispatch_h_GUID_BA2EFF7D_152D_4FA6_6454_B8F3AC30FB3F 34 #include <opencv2/core/version.hpp> 35 #if CV_MAJOR_VERSION == 2 || CV_VERSION_EPOCH == 2 36 #include <opencv2/core/core_c.h> 38 #include <opencv2/core/core.hpp> 40 #include <boost/mpl/identity.hpp> 53 template <
typename Functor>
55 using boost::mpl::identity;
56 switch (CV_MAT_DEPTH(openCVType)) {
58 f(identity<uint8_t>());
61 f(identity<int8_t>());
64 f(identity<uint16_t>());
67 f(identity<int16_t>());
70 f(identity<int32_t>());
76 f(identity<double>());
96 return isSigned ? CV_8S : CV_8U;
98 return isSigned ? CV_16S : CV_16U;
107 throw std::runtime_error(
"No OpenCV 32-bit unsigned type!");
112 throw std::runtime_error(
"No OpenCV 64-bit integer types!");
115 throw std::runtime_error(
116 "No OpenCV type matching the requested parameters!");
125 metadata.
type == OSVR_IVT_FLOATING_POINT,
132 #endif // INCLUDED_OpenCVTypeDispatch_h_GUID_BA2EFF7D_152D_4FA6_6454_B8F3AC30FB3F
Definition: NonLinearOptimization.cpp:107
Definition: RunLoopManager.h:42
Runtime data on numeric types.
Definition: NumberTypeManipulation.h:47
int cvTypeFromData(bool isSigned, bool isFloat, size_t depth)
Computes the OpenCV "type" (also known as depth - as in CV_8U) for a given combination of signed...
Definition: OpenCVTypeDispatch.h:93
Header wrapping the C99 standard stdint header.
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
bool opencvTypeDispatch(int openCVType, Functor &f)
Given an OpenCV type depth and a reference to a functor, calls that functor with a single parameter: ...
Definition: OpenCVTypeDispatch.h:54
int computeOpenCVMatType(OSVR_ImagingMetadata const &metadata)
Computes the OpenCV matrix type (as in CV_8UC3) from a metadata struct.
Definition: OpenCVTypeDispatch.h:122
Definition: NumberTypeManipulation.h:152