OSVR-Core
0.6-1962-g59773924
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
OpenCVVersion.h
Go to the documentation of this file.
1
12
// Copyright 2016 Sensics, Inc.
13
//
14
// Licensed under the Apache License, Version 2.0 (the "License");
15
// you may not use this file except in compliance with the License.
16
// You may obtain a copy of the License at
17
//
18
// http://www.apache.org/licenses/LICENSE-2.0
19
//
20
// Unless required by applicable law or agreed to in writing, software
21
// distributed under the License is distributed on an "AS IS" BASIS,
22
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
// See the License for the specific language governing permissions and
24
// limitations under the License.
25
26
#ifndef INCLUDED_OpenCVVersion_h_GUID_503D3091_E553_4AA0_435D_7CCAF2791E32
27
#define INCLUDED_OpenCVVersion_h_GUID_503D3091_E553_4AA0_435D_7CCAF2791E32
28
29
// Internal Includes
30
// - none
31
32
// Library/third-party includes
33
#include <opencv2/core/core.hpp>
34
35
// Standard includes
36
// - none
37
38
// Check for OpenCV 2 - using the "EPOCH" defines - to avoid getting confused
39
// later.
40
#if defined(CV_VERSION_EPOCH) && CV_VERSION_EPOCH == 2
41
#define OSVR_OPENCV_VER 2
42
#define OSVR_OPENCV_2
43
#endif
44
45
// Check for OpenCV 3.x
46
#if !defined(OSVR_OPENCV_VER) && defined(CV_MAJOR_VERSION) && \
47
CV_MAJOR_VERSION == 3
48
#define OSVR_OPENCV_VER 3
49
#define OSVR_OPENCV_3
50
#define OSVR_OPENCV_3PLUS
51
#endif
52
53
// Check for future versions
54
#if !defined(OSVR_OPENCV_VER) && defined(CV_MAJOR_VERSION) && \
55
CV_MAJOR_VERSION > 3
56
#define OSVR_OPENCV_VER CV_MAJOR_VERSION
57
#define OSVR_OPENCV_POST3
58
#define OSVR_OPENCV_3PLUS
59
#endif
60
61
// Check for OpenCV 2 that didn't get caught by the CV_VERSION_EPOCH check.
62
#if !defined(OSVR_OPENCV_VER) && defined(CV_MAJOR_VERSION) && \
63
CV_MAJOR_VERSION == 2
64
#define OSVR_OPENCV_VER 2
65
#define OSVR_OPENCV_2
66
#endif
67
68
// If, for some reason, CV_MAJOR_VERSION isn't defined, nor the
69
// CV_VERSION_EPOCH, we can assume at least for now that we have
70
// version 2.x
71
#if !defined(OSVR_OPENCV_VER)
72
#define OSVR_OPENCV_VER 2
73
#define OSVR_OPENCV_2
74
#define OSVR_OPENCV_VER_GUESSED
75
#endif
76
77
#ifdef OSVR_OPENCV_2
78
79
// Second component of the version number
80
#if defined(CV_MINOR_VERSION)
81
#define OSVR_OPENCV_VER_COMPONENT_2 CV_MINOR_VERSION
82
#elif defined(CV_VERSION_MAJOR)
83
#define OSVR_OPENCV_VER_COMPONENT_2 CV_VERSION_MAJOR
84
#else
85
// assume 0 if unknown
86
#define OSVR_OPENCV_VER_COMPONENT_2 0
87
#endif
88
89
// Third component of the version number
90
#if defined(CV_SUBMINOR_VERSION)
91
#define OSVR_OPENCV_VER_COMPONENT_3 CV_SUBMINOR_VERSION
92
#elif defined(CV_VERSION_MINOR)
93
#define OSVR_OPENCV_VER_COMPONENT_3 CV_VERSION_MINOR
94
#else
95
// assume 0 if unknown
96
#define OSVR_OPENCV_VER_COMPONENT_2 0
97
#endif
98
99
#else // OpenCV 3 and up - easier case
100
101
#define OSVR_OPENCV_VER_COMPONENT_2 CV_MINOR_VERSION
102
103
#ifdef CV_VERSION_REVISION
104
#define OSVR_OPENCV_VER_COMPONENT_3 CV_VERSION_REVISION
105
#else
106
#define OSVR_OPENCV_VER_COMPONENT_3 CV_SUBMINOR_VERSION
107
#endif
108
109
#endif
110
113
#define OSVR_OPENCV_AT_LEAST_VERSION(X, Y, Z) \
114
((OSVR_OPENCV_VER > X) || \
115
(OSVR_OPENCV_VER == X && OSVR_OPENCV_VER_COMPONENT_2 > Y) || \
116
(OSVR_OPENCV_VER == X && OSVR_OPENCV_VER_COMPONENT_2 == Y && \
117
OSVR_OPENCV_VER_COMPONENT_3 >= Z))
118
119
#endif // INCLUDED_OpenCVVersion_h_GUID_503D3091_E553_4AA0_435D_7CCAF2791E32
osvr
Util
OpenCVVersion.h
Generated on Tue May 16 2017 15:22:40 for OSVR-Core by
Doxygen
1.8.8