提交 e1b56e37 编写于 作者: A Alexander Alekhin

Merge pull request #18476 from dmatveev:dm/gapi_text_detection

......@@ -508,19 +508,23 @@ namespace core {
return in.withType(in.depth, in.chan).withSize(dsize);
}
};
} // namespace core
G_TYPED_KERNEL(GSize, <GOpaque<Size>(GMat)>, "org.opencv.core.size") {
static GOpaqueDesc outMeta(const GMatDesc&) {
return empty_gopaque_desc();
}
};
namespace streaming {
G_TYPED_KERNEL(GSizeR, <GOpaque<Size>(GOpaque<Rect>)>, "org.opencv.core.sizeR") {
static GOpaqueDesc outMeta(const GOpaqueDesc&) {
return empty_gopaque_desc();
}
};
}
// Operations for Streaming (declared in this header for convenience)
G_TYPED_KERNEL(GSize, <GOpaque<Size>(GMat)>, "org.opencv.streaming.size") {
static GOpaqueDesc outMeta(const GMatDesc&) {
return empty_gopaque_desc();
}
};
G_TYPED_KERNEL(GSizeR, <GOpaque<Size>(GOpaque<Rect>)>, "org.opencv.streaming.sizeR") {
static GOpaqueDesc outMeta(const GOpaqueDesc&) {
return empty_gopaque_desc();
}
};
} // namespace streaming
//! @addtogroup gapi_math
//! @{
......@@ -1753,9 +1757,10 @@ GAPI_EXPORTS GMat warpAffine(const GMat& src, const Mat& M, const Size& dsize, i
int borderMode = cv::BORDER_CONSTANT, const Scalar& borderValue = Scalar());
//! @} gapi_transform
namespace streaming {
/** @brief Gets dimensions from Mat.
@note Function textual ID is "org.opencv.core.size"
@note Function textual ID is "org.opencv.streaming.size"
@param src Input tensor
@return Size (tensor dimensions).
......@@ -1765,12 +1770,13 @@ GAPI_EXPORTS GOpaque<Size> size(const GMat& src);
/** @overload
Gets dimensions from rectangle.
@note Function textual ID is "org.opencv.core.sizeR"
@note Function textual ID is "org.opencv.streaming.sizeR"
@param r Input rectangle.
@return Size (rectangle dimensions).
*/
GAPI_EXPORTS GOpaque<Size> size(const GOpaque<Rect>& r);
} //namespace streaming
} //namespace gapi
} //namespace cv
......
......@@ -111,6 +111,22 @@ public:
*/
GAPI_WRAP void setSource(const gapi::wip::IStreamSource::Ptr& s);
/**
* @brief Constructs and specifies an input video stream for a
* single-input computation pipeline with the given parameters.
*
* Throws if pipeline is already running. Use stop() and then
* setSource() to run the graph on a new video stream.
*
* @overload
* @param args arguments used to contruct and initialize a stream
* source.
*/
template<typename T, typename... Args>
void setSource(Args&&... args) {
setSource(cv::gapi::wip::make_src<T>(std::forward<Args>(args)...));
}
/**
* @brief Start the pipeline execution.
*
......
......@@ -122,4 +122,16 @@ GAPI_EXPORTS std::tuple<GArray<Rect>, GArray<int>> parseYolo(const GMat& in,
} // namespace gapi
} // namespace cv
// Reimport parseSSD & parseYolo under their initial namespace
namespace cv {
namespace gapi {
namespace streaming {
using cv::gapi::parseSSD;
using cv::gapi::parseYolo;
} // namespace streaming
} // namespace gapi
} // namespace cv
#endif // OPENCV_GAPI_PARSERS_HPP
......@@ -2124,7 +2124,7 @@ PERF_TEST_P_(SizePerfTest, TestPerformance)
// G-API code //////////////////////////////////////////////////////////////
cv::GMat in;
auto out = cv::gapi::size(in);
auto out = cv::gapi::streaming::size(in);
cv::GComputation c(cv::GIn(in), cv::GOut(out));
cv::Size out_sz;
......@@ -2156,7 +2156,7 @@ PERF_TEST_P_(SizeRPerfTest, TestPerformance)
// G-API code //////////////////////////////////////////////////////////////
cv::GOpaque<cv::Rect> op_rect;
auto out = cv::gapi::size(op_rect);
auto out = cv::gapi::streaming::size(op_rect);
cv::GComputation c(cv::GIn(op_rect), cv::GOut(out));
cv::Size out_sz;
......
此差异已折叠。
......@@ -388,14 +388,14 @@ GMat warpAffine(const GMat& src, const Mat& M, const Size& dsize, int flags,
return core::GWarpAffine::on(src, M, dsize, flags, borderMode, borderValue);
}
GOpaque<Size> size(const GMat& src)
GOpaque<Size> streaming::size(const GMat& src)
{
return core::GSize::on(src);
return streaming::GSize::on(src);
}
GOpaque<Size> size(const GOpaque<Rect>& r)
GOpaque<Size> streaming::size(const GOpaque<Rect>& r)
{
return core::GSizeR::on(r);
return streaming::GSizeR::on(r);
}
} //namespace gapi
......
......@@ -625,7 +625,7 @@ GAPI_OCV_KERNEL(GCPUParseYolo, cv::gapi::nn::parsers::GParseYolo)
}
};
GAPI_OCV_KERNEL(GCPUSize, cv::gapi::core::GSize)
GAPI_OCV_KERNEL(GCPUSize, cv::gapi::streaming::GSize)
{
static void run(const cv::Mat& in, cv::Size& out)
{
......@@ -634,7 +634,7 @@ GAPI_OCV_KERNEL(GCPUSize, cv::gapi::core::GSize)
}
};
GAPI_OCV_KERNEL(GCPUSizeR, cv::gapi::core::GSizeR)
GAPI_OCV_KERNEL(GCPUSizeR, cv::gapi::streaming::GSizeR)
{
static void run(const cv::Rect& in, cv::Size& out)
{
......
......@@ -1691,7 +1691,7 @@ TEST_P(SizeTest, ParseTest)
cv::GMat in;
cv::Size out_sz;
auto out = cv::gapi::size(in);
auto out = cv::gapi::streaming::size(in);
cv::GComputation c(cv::GIn(in), cv::GOut(out));
c.apply(cv::gin(in_mat1), cv::gout(out_sz), getCompileArgs());
......@@ -1704,7 +1704,7 @@ TEST_P(SizeRTest, ParseTest)
cv::Size out_sz;
cv::GOpaque<cv::Rect> op_rect;
auto out = cv::gapi::size(op_rect);
auto out = cv::gapi::streaming::size(op_rect);
cv::GComputation c(cv::GIn(op_rect), cv::GOut(out));
c.apply(cv::gin(rect), cv::gout(out_sz), getCompileArgs());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册