Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/core/src/bindings_utils.cpp
16337 views
1
// This file is part of OpenCV project.
2
// It is subject to the license terms in the LICENSE file found in the top-level directory
3
// of this distribution and at http://opencv.org/license.html.
4
5
#include "precomp.hpp"
6
#include "opencv2/core/bindings_utils.hpp"
7
#include <sstream>
8
9
namespace cv { namespace utils {
10
11
String dumpInputArray(InputArray argument)
12
{
13
if (&argument == &noArray())
14
return "InputArray: noArray()";
15
std::ostringstream ss;
16
ss << "InputArray:";
17
try {
18
do {
19
ss << (argument.empty() ? " empty()=true" : " empty()=false");
20
ss << cv::format(" kind=0x%08llx", (long long int)argument.kind());
21
ss << cv::format(" flags=0x%08llx", (long long int)argument.getFlags());
22
if (argument.getObj() == NULL)
23
{
24
ss << " obj=NULL";
25
break; // done
26
}
27
ss << cv::format(" total(-1)=%lld", (long long int)argument.total(-1));
28
ss << cv::format(" dims(-1)=%d", argument.dims(-1));
29
Size size = argument.size(-1);
30
ss << cv::format(" size(-1)=%dx%d", size.width, size.height);
31
ss << " type(-1)=" << cv::typeToString(argument.type(-1));
32
} while (0);
33
}
34
catch (...)
35
{
36
ss << " ERROR: exception occured, dump is non-complete"; // need to properly support different kinds
37
}
38
return ss.str();
39
}
40
41
CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument)
42
{
43
if (&argument == &noArray())
44
return "InputArrayOfArrays: noArray()";
45
std::ostringstream ss;
46
ss << "InputArrayOfArrays:";
47
try {
48
do {
49
ss << (argument.empty() ? " empty()=true" : " empty()=false");
50
ss << cv::format(" kind=0x%08llx", (long long int)argument.kind());
51
ss << cv::format(" flags=0x%08llx", (long long int)argument.getFlags());
52
if (argument.getObj() == NULL)
53
{
54
ss << " obj=NULL";
55
break; // done
56
}
57
ss << cv::format(" total(-1)=%lld", (long long int)argument.total(-1));
58
ss << cv::format(" dims(-1)=%d", argument.dims(-1));
59
Size size = argument.size(-1);
60
ss << cv::format(" size(-1)=%dx%d", size.width, size.height);
61
if (argument.total(-1) > 0)
62
{
63
ss << " type(0)=" << cv::typeToString(argument.type(0));
64
ss << cv::format(" dims(0)=%d", argument.dims(0));
65
size = argument.size(0);
66
ss << cv::format(" size(0)=%dx%d", size.width, size.height);
67
ss << " type(0)=" << cv::typeToString(argument.type(0));
68
}
69
} while (0);
70
}
71
catch (...)
72
{
73
ss << " ERROR: exception occured, dump is non-complete"; // need to properly support different kinds
74
}
75
return ss.str();
76
}
77
78
CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument)
79
{
80
if (&argument == &noArray())
81
return "InputOutputArray: noArray()";
82
std::ostringstream ss;
83
ss << "InputOutputArray:";
84
try {
85
do {
86
ss << (argument.empty() ? " empty()=true" : " empty()=false");
87
ss << cv::format(" kind=0x%08llx", (long long int)argument.kind());
88
ss << cv::format(" flags=0x%08llx", (long long int)argument.getFlags());
89
if (argument.getObj() == NULL)
90
{
91
ss << " obj=NULL";
92
break; // done
93
}
94
ss << cv::format(" total(-1)=%lld", (long long int)argument.total(-1));
95
ss << cv::format(" dims(-1)=%d", argument.dims(-1));
96
Size size = argument.size(-1);
97
ss << cv::format(" size(-1)=%dx%d", size.width, size.height);
98
ss << " type(-1)=" << cv::typeToString(argument.type(-1));
99
} while (0);
100
}
101
catch (...)
102
{
103
ss << " ERROR: exception occured, dump is non-complete"; // need to properly support different kinds
104
}
105
return ss.str();
106
}
107
108
CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argument)
109
{
110
if (&argument == &noArray())
111
return "InputOutputArrayOfArrays: noArray()";
112
std::ostringstream ss;
113
ss << "InputOutputArrayOfArrays:";
114
try {
115
do {
116
ss << (argument.empty() ? " empty()=true" : " empty()=false");
117
ss << cv::format(" kind=0x%08llx", (long long int)argument.kind());
118
ss << cv::format(" flags=0x%08llx", (long long int)argument.getFlags());
119
if (argument.getObj() == NULL)
120
{
121
ss << " obj=NULL";
122
break; // done
123
}
124
ss << cv::format(" total(-1)=%lld", (long long int)argument.total(-1));
125
ss << cv::format(" dims(-1)=%d", argument.dims(-1));
126
Size size = argument.size(-1);
127
ss << cv::format(" size(-1)=%dx%d", size.width, size.height);
128
if (argument.total(-1) > 0)
129
{
130
ss << " type(0)=" << cv::typeToString(argument.type(0));
131
ss << cv::format(" dims(0)=%d", argument.dims(0));
132
size = argument.size(0);
133
ss << cv::format(" size(0)=%dx%d", size.width, size.height);
134
ss << " type(0)=" << cv::typeToString(argument.type(0));
135
}
136
} while (0);
137
}
138
catch (...)
139
{
140
ss << " ERROR: exception occured, dump is non-complete"; // need to properly support different kinds
141
}
142
return ss.str();
143
}
144
145
}} // namespace
146
147