mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #18292 from smirnov-alexey:as/osd_serialization
[G-API]: Support render primitives serialization * Add GOpaque and GArray serialization support * Address review comments * Remove holds() method * Add serialization mechanism for render primitives * Fix standalone mode * Fix wchar_t error on win64 * Fix assert on windows * Address review comments * Fix GArray and GOpaque reset() method to store proper kind * Reset wchar before deserializing it * Fix wchar_t cross-platform issue * Address review comments * Fix wchar_t serialization and tests * Remove FText serialization
This commit is contained in:
@@ -252,6 +252,62 @@ I::IStream& operator>> (I::IStream& is, cv::Mat& m) {
|
||||
return is;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Text &t) {
|
||||
return os << t.bottom_left_origin << t.color << t.ff << t.fs << t.lt << t.org << t.text << t.thick;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Text &t) {
|
||||
return is >> t.bottom_left_origin >> t.color >> t.ff >> t.fs >> t.lt >> t.org >> t.text >> t.thick;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream&, const cv::gapi::wip::draw::FText &) {
|
||||
GAPI_Assert(false && "Serialization: Unsupported << for FText");
|
||||
}
|
||||
I::IStream& operator>> (I::IStream&, cv::gapi::wip::draw::FText &) {
|
||||
GAPI_Assert(false && "Serialization: Unsupported >> for FText");
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Circle &c) {
|
||||
return os << c.center << c.color << c.lt << c.radius << c.shift << c.thick;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Circle &c) {
|
||||
return is >> c.center >> c.color >> c.lt >> c.radius >> c.shift >> c.thick;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Rect &r) {
|
||||
return os << r.color << r.lt << r.rect << r.shift << r.thick;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Rect &r) {
|
||||
return is >> r.color >> r.lt >> r.rect >> r.shift >> r.thick;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Image &i) {
|
||||
return os << i.org << i.alpha << i.img;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Image &i) {
|
||||
return is >> i.org >> i.alpha >> i.img;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Mosaic &m) {
|
||||
return os << m.cellSz << m.decim << m.mos;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Mosaic &m) {
|
||||
return is >> m.cellSz >> m.decim >> m.mos;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Poly &p) {
|
||||
return os << p.color << p.lt << p.points << p.shift << p.thick;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Poly &p) {
|
||||
return is >> p.color >> p.lt >> p.points >> p.shift >> p.thick;
|
||||
}
|
||||
|
||||
I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Line &l) {
|
||||
return os << l.color << l.lt << l.pt1 << l.pt2 << l.shift << l.thick;
|
||||
}
|
||||
I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Line &l) {
|
||||
return is >> l.color >> l.lt >> l.pt1 >> l.pt2 >> l.shift >> l.thick;
|
||||
}
|
||||
|
||||
// G-API types /////////////////////////////////////////////////////////////////
|
||||
|
||||
// Stubs (empty types)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <ade/util/iota_range.hpp> // used in the vector<</>>
|
||||
|
||||
#include "compiler/gmodel.hpp"
|
||||
#include "opencv2/gapi/render/render_types.hpp"
|
||||
|
||||
#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
|
||||
#pragma warning(disable: 4702)
|
||||
@@ -89,7 +90,29 @@ GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::Scalar &s);
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::Mat &m);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::Mat &m);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Text &t);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Text &t);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream&, const cv::gapi::wip::draw::FText &);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream&, cv::gapi::wip::draw::FText &);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Circle &c);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Circle &c);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Rect &r);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Rect &r);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Image &i);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Image &i);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Mosaic &m);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Mosaic &m);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Poly &p);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Poly &p);
|
||||
|
||||
GAPI_EXPORTS I::OStream& operator<< (I::OStream& os, const cv::gapi::wip::draw::Line &l);
|
||||
GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gapi::wip::draw::Line &l);
|
||||
|
||||
// G-API types /////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user