OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
macros.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_CORE_MACROS_HPP
2 #define OPENPOSE_CORE_MACROS_HPP
3 
4 #include <chrono> // std::chrono:: functionaligy, e.g., std::chrono::milliseconds
5 #include <memory> // std::shared_ptr
6 #include <ostream>
7 #include <string>
8 #include <thread> // std::this_thread
9 #include <vector>
10 #include <opencv2/core/core.hpp> // cv::Mat, check OpenCV version
11 
12 // OpenPose name and version
16 // #define COMMERCIAL_LICENSE
17 
18 #ifndef _WIN32
19  #define OP_API
20 #elif defined OP_EXPORTS
21  #define OP_API __declspec(dllexport)
22 #else
23  #define OP_API __declspec(dllimport)
24 #endif
25 
26 // Disable some Windows Warnings
27 #ifdef _WIN32
28  #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
29  #pragma warning( disable: 4275 ) // non dll-interface structXXX used as base
30 #endif
31 
32 #define UNUSED(unusedVariable) (void)(unusedVariable)
33 
34 #define DELETE_COPY(className) \
35  className(const className&) = delete; \
36  className& operator=(const className&) = delete
37 
38 // Instantiate a class with all the basic types
39 #define COMPILE_TEMPLATE_BASIC_TYPES_CLASS(className) COMPILE_TEMPLATE_BASIC_TYPES(className, class)
40 #define COMPILE_TEMPLATE_BASIC_TYPES_STRUCT(className) COMPILE_TEMPLATE_BASIC_TYPES(className, struct)
41 #define COMPILE_TEMPLATE_BASIC_TYPES(className, classType) \
42  template classType OP_API className<char>; \
43  template classType OP_API className<signed char>; \
44  template classType OP_API className<short>; \
45  template classType OP_API className<int>; \
46  template classType OP_API className<long>; \
47  template classType OP_API className<long long>; \
48  template classType OP_API className<unsigned char>; \
49  template classType OP_API className<unsigned short>; \
50  template classType OP_API className<unsigned int>; \
51  template classType OP_API className<unsigned long>; \
52  template classType OP_API className<unsigned long long>; \
53  template classType OP_API className<float>; \
54  template classType OP_API className<double>; \
55  template classType OP_API className<long double>
56 
61 #define OVERLOAD_C_OUT(className) \
62  template<typename T> std::ostream &operator<<(std::ostream& ostream, const op::className<T>& obj) \
63  { \
64  ostream << obj.toString(); \
65  return ostream; \
66  }
67 
68 // Instantiate a class with float and double specifications
69 #define COMPILE_TEMPLATE_FLOATING_TYPES_CLASS(className) COMPILE_TEMPLATE_FLOATING_TYPES(className, class)
70 #define COMPILE_TEMPLATE_FLOATING_TYPES_STRUCT(className) COMPILE_TEMPLATE_FLOATING_TYPES(className, struct)
71 #define COMPILE_TEMPLATE_FLOATING_TYPES(className, classType) \
72  char gInstantiationGuard##className; \
73  template classType OP_API className<float>; \
74  template classType OP_API className<double>
75 
76 // PIMPL does not work if function arguments need the 3rd-party class. Alternative:
77 // stackoverflow.com/questions/13978775/how-to-avoid-include-dependency-to-external-library?answertab=active#tab-top
78 struct dim3;
79 namespace caffe
80 {
81  template <typename T> class Blob;
82 }
83 namespace boost
84 {
85  template <typename T> class shared_ptr; // E.g., boost::shared_ptr<caffe::Blob<float>>
86 }
87 
88 // Compabitility for OpenCV 4.0 while preserving 2.4.X and 3.X compatibility
89 // Note:
90 // - CV_VERSION: 2.4.9.1 | 4.0.0-beta
91 // - CV_MAJOR_VERSION: 2 | 4
92 // - CV_MINOR_VERSION: 4 | 0
93 // - CV_SUBMINOR_VERSION: 9 | 0
94 // - CV_VERSION_EPOCH: 2 | Not defined
95 #if (defined(CV_MAJOR_VERSION) && CV_MAJOR_VERSION > 3)
96  #define OPEN_CV_IS_4_OR_HIGHER
97 #endif
98 #ifdef OPEN_CV_IS_4_OR_HIGHER
99  #define CV_BGR2GRAY cv::COLOR_BGR2GRAY
100  #define CV_CALIB_CB_ADAPTIVE_THRESH cv::CALIB_CB_ADAPTIVE_THRESH
101  #define CV_CALIB_CB_NORMALIZE_IMAGE cv::CALIB_CB_NORMALIZE_IMAGE
102  #define CV_CALIB_CB_FILTER_QUADS cv::CALIB_CB_FILTER_QUADS
103  #define CV_CAP_PROP_FPS cv::CAP_PROP_FPS
104  #define CV_CAP_PROP_FRAME_COUNT cv::CAP_PROP_FRAME_COUNT
105  #define CV_CAP_PROP_FRAME_HEIGHT cv::CAP_PROP_FRAME_HEIGHT
106  #define CV_CAP_PROP_FRAME_WIDTH cv::CAP_PROP_FRAME_WIDTH
107  #define CV_CAP_PROP_POS_FRAMES cv::CAP_PROP_POS_FRAMES
108  #define CV_FOURCC cv::VideoWriter::fourcc
109  #define CV_GRAY2BGR cv::COLOR_GRAY2BGR
110  #define CV_HAAR_SCALE_IMAGE cv::CASCADE_SCALE_IMAGE
111  #define CV_IMWRITE_JPEG_QUALITY cv::IMWRITE_JPEG_QUALITY
112  #define CV_IMWRITE_PNG_COMPRESSION cv::IMWRITE_PNG_COMPRESSION
113  #define CV_INTER_CUBIC cv::INTER_CUBIC
114  #define CV_INTER_LINEAR cv::INTER_LINEAR
115  #define CV_L2 cv::NORM_L2
116  #define CV_LOAD_IMAGE_ANYDEPTH cv::IMREAD_ANYDEPTH
117  #define CV_LOAD_IMAGE_COLOR cv::IMREAD_COLOR
118  #define CV_LOAD_IMAGE_GRAYSCALE cv::IMREAD_GRAYSCALE
119  #define CV_TERMCRIT_EPS cv::TermCriteria::Type::EPS
120  #define CV_TERMCRIT_ITER cv::TermCriteria::Type::MAX_ITER
121  #define CV_WARP_INVERSE_MAP cv::WARP_INVERSE_MAP
122  #define CV_WINDOW_FULLSCREEN cv::WINDOW_FULLSCREEN
123  #define CV_WINDOW_KEEPRATIO cv::WINDOW_KEEPRATIO
124  #define CV_WINDOW_NORMAL cv::WINDOW_NORMAL
125  #define CV_WINDOW_OPENGL cv::WINDOW_OPENGL
126  #define CV_WND_PROP_FULLSCREEN cv::WND_PROP_FULLSCREEN
127 #endif
128 
129 #endif // OPENPOSE_CORE_MACROS_HPP
const std::string OPEN_POSE_VERSION_STRING
Definition: macros.hpp:14
const std::string OPEN_POSE_NAME_AND_VERSION
Definition: macros.hpp:15
Definition: macros.hpp:85
const std::string OPEN_POSE_NAME_STRING
Definition: macros.hpp:13
Definition: macros.hpp:81
std::string string
Definition: cl2.hpp:574