Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/gapi/src/api/gmat.cpp
16338 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
// Copyright (C) 2018 Intel Corporation
6
7
8
#include "precomp.hpp"
9
#include <opencv2/gapi/opencv_includes.hpp>
10
#include <opencv2/gapi/own/mat.hpp> //gapi::own::Mat
11
12
#include "opencv2/gapi/gmat.hpp"
13
#include "api/gapi_priv.hpp" // GOrigin
14
15
// cv::GMat public implementation //////////////////////////////////////////////
16
cv::GMat::GMat()
17
: m_priv(new GOrigin(GShape::GMAT, GNode::Param()))
18
{
19
}
20
21
cv::GMat::GMat(const GNode &n, std::size_t out)
22
: m_priv(new GOrigin(GShape::GMAT, n, out))
23
{
24
}
25
26
cv::GOrigin& cv::GMat::priv()
27
{
28
return *m_priv;
29
}
30
31
const cv::GOrigin& cv::GMat::priv() const
32
{
33
return *m_priv;
34
}
35
36
#if !defined(GAPI_STANDALONE)
37
cv::GMatDesc cv::descr_of(const cv::Mat &mat)
38
{
39
return GMatDesc{mat.depth(), mat.channels(), {mat.cols, mat.rows}};
40
}
41
#endif
42
43
cv::GMatDesc cv::gapi::own::descr_of(const cv::gapi::own::Mat &mat)
44
{
45
return GMatDesc{mat.depth(), mat.channels(), {mat.cols, mat.rows}};
46
}
47
48
namespace cv {
49
std::ostream& operator<<(std::ostream& os, const cv::GMatDesc &desc)
50
{
51
switch (desc.depth)
52
{
53
#define TT(X) case CV_##X: os << #X; break;
54
TT(8U);
55
TT(8S);
56
TT(16U);
57
TT(16S);
58
TT(32S);
59
TT(32F);
60
TT(64F);
61
#undef TT
62
default:
63
os << "(user type "
64
<< std::hex << desc.depth << std::dec
65
<< ")";
66
break;
67
}
68
69
os << "C" << desc.chan << " ";
70
os << desc.size.width << "x" << desc.size.height;
71
72
return os;
73
}
74
}
75
76