5
#ifndef OPENCV_CORE_CHECK_HPP
6
#define OPENCV_CORE_CHECK_HPP
8
#include <opencv2/core/base.hpp>
23CV_EXPORTS
const
char* depthToString_(
int
depth);
26CV_EXPORTS
const
cv::String typeToString_(
int
type);
49
#ifndef CV__CHECK_FILENAME
50
# define CV__CHECK_FILENAME __FILE__
53
#ifndef CV__CHECK_FUNCTION
55
# define CV__CHECK_FUNCTION __FUNCSIG__
56
# elif defined __GNUC__
57
# define CV__CHECK_FUNCTION __PRETTY_FUNCTION__
59
# define CV__CHECK_FUNCTION "<unknown>"
63
#define CV__CHECK_LOCATION_VARNAME(id) CVAUX_CONCAT(CVAUX_CONCAT(__cv_check_, id), __LINE__)
64
#define CV__DEFINE_CHECK_CONTEXT(id, message, testOp, p1_str, p2_str) \
65
static const cv::detail::CheckContext CV__CHECK_LOCATION_VARNAME(id) = \
66
{ CV__CHECK_FUNCTION, CV__CHECK_FILENAME, __LINE__, testOp, ""
message, "" p1_str, "" p2_str }
68CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
int
v1,
const
int
v2,
const
CheckContext& ctx);
69CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
size_t
v1,
const
size_t
v2,
const
CheckContext& ctx);
70CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
float
v1,
const
float
v2,
const
CheckContext& ctx);
71CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
double
v1,
const
double
v2,
const
CheckContext& ctx);
72CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
Size_<int> v1,
const
Size_<int> v2,
const
CheckContext& ctx);
73CV_EXPORTS
void
CV_NORETURN check_failed_MatDepth(
const
int
v1,
const
int
v2,
const
CheckContext& ctx);
74CV_EXPORTS
void
CV_NORETURN check_failed_MatType(
const
int
v1,
const
int
v2,
const
CheckContext& ctx);
75CV_EXPORTS
void
CV_NORETURN check_failed_MatChannels(
const
int
v1,
const
int
v2,
const
CheckContext& ctx);
77CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
int
v,
const
CheckContext& ctx);
78CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
size_t
v,
const
CheckContext& ctx);
79CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
float
v,
const
CheckContext& ctx);
80CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
double
v,
const
CheckContext& ctx);
81CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
Size_<int> v,
const
CheckContext& ctx);
82CV_EXPORTS
void
CV_NORETURN check_failed_auto(
const
std::string& v1,
const
CheckContext& ctx);
83CV_EXPORTS
void
CV_NORETURN check_failed_MatDepth(
const
int
v,
const
CheckContext& ctx);
84CV_EXPORTS
void
CV_NORETURN check_failed_MatType(
const
int
v,
const
CheckContext& ctx);
85CV_EXPORTS
void
CV_NORETURN check_failed_MatChannels(
const
int
v,
const
CheckContext& ctx);
88
#define CV__TEST_EQ(v1, v2) ((v1) == (v2))
89
#define CV__TEST_NE(v1, v2) ((v1) != (v2))
90
#define CV__TEST_LE(v1, v2) ((v1) <= (v2))
91
#define CV__TEST_LT(v1, v2) ((v1) < (v2))
92
#define CV__TEST_GE(v1, v2) ((v1) >= (v2))
93
#define CV__TEST_GT(v1, v2) ((v1) > (v2))
95
#define CV__CHECK(id, op, type, v1, v2, v1_str, v2_str, msg_str) do { \
96
if(CV__TEST_##op((v1), (v2))) ; else { \
97
CV__DEFINE_CHECK_CONTEXT(id, msg_str, cv::detail::TEST_ ## op, v1_str, v2_str); \
98
cv::detail::check_failed_ ## type((v1), (v2), CV__CHECK_LOCATION_VARNAME(id)); \
102
#define CV__CHECK_CUSTOM_TEST(id, type, v, test_expr, v_str, test_expr_str, msg_str) do { \
103
if(!!(test_expr)) ; else { \
104
CV__DEFINE_CHECK_CONTEXT(id, msg_str, cv::detail::TEST_CUSTOM, v_str, test_expr_str); \
105
cv::detail::check_failed_ ## type((v), CV__CHECK_LOCATION_VARNAME(id)); \
114
#define CV_CheckEQ(v1, v2, msg) CV__CHECK(_, EQ, auto, v1, v2, #v1, #v2, msg)
115
#define CV_CheckNE(v1, v2, msg) CV__CHECK(_, NE, auto, v1, v2, #v1, #v2, msg)
116
#define CV_CheckLE(v1, v2, msg) CV__CHECK(_, LE, auto, v1, v2, #v1, #v2, msg)
117
#define CV_CheckLT(v1, v2, msg) CV__CHECK(_, LT, auto, v1, v2, #v1, #v2, msg)
118
#define CV_CheckGE(v1, v2, msg) CV__CHECK(_, GE, auto, v1, v2, #v1, #v2, msg)
119
#define CV_CheckGT(v1, v2, msg) CV__CHECK(_, GT, auto, v1, v2, #v1, #v2, msg)
122
#define CV_CheckTypeEQ(t1, t2, msg) CV__CHECK(_, EQ, MatType, t1, t2, #t1, #t2, msg)
124
#define CV_CheckDepthEQ(d1, d2, msg) CV__CHECK(_, EQ, MatDepth, d1, d2, #d1, #d2, msg)
126
#define CV_CheckChannelsEQ(c1, c2, msg) CV__CHECK(_, EQ, MatChannels, c1, c2, #c1, #c2, msg)
129
#define CV_CheckType(t, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, MatType, t, (test_expr), #t, #test_expr, msg)
132
#define CV_CheckDepth(t, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, MatDepth, t, (test_expr), #t, #test_expr, msg)
135
#define CV_Check(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg)
141
#define CV_DbgCheck(v, test_expr, msg) CV__CHECK_CUSTOM_TEST(_, auto, v, (test_expr), #v, #test_expr, msg)
142
#define CV_DbgCheckEQ(v1, v2, msg) CV__CHECK(_, EQ, auto, v1, v2, #v1, #v2, msg)
143
#define CV_DbgCheckNE(v1, v2, msg) CV__CHECK(_, NE, auto, v1, v2, #v1, #v2, msg)
144
#define CV_DbgCheckLE(v1, v2, msg) CV__CHECK(_, LE, auto, v1, v2, #v1, #v2, msg)
145
#define CV_DbgCheckLT(v1, v2, msg) CV__CHECK(_, LT, auto, v1, v2, #v1, #v2, msg)
146
#define CV_DbgCheckGE(v1, v2, msg) CV__CHECK(_, GE, auto, v1, v2, #v1, #v2, msg)
147
#define CV_DbgCheckGT(v1, v2, msg) CV__CHECK(_, GT, auto, v1, v2, #v1, #v2, msg)
149
#define CV_DbgCheck(v, test_expr, msg) do { } while (0)
150
#define CV_DbgCheckEQ(v1, v2, msg) do { } while (0)
151
#define CV_DbgCheckNE(v1, v2, msg) do { } while (0)
152
#define CV_DbgCheckLE(v1, v2, msg) do { } while (0)
153
#define CV_DbgCheckLT(v1, v2, msg) do { } while (0)
154
#define CV_DbgCheckGE(v1, v2, msg) do { } while (0)
155
#define CV_DbgCheckGT(v1, v2, msg) do { } while (0)
CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws a line segment connecting two points.
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75
CV_EXPORTS const String typeToString(int type)
CV_EXPORTS const char * depthToString(int depth)