Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
1261f250
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1261f250
编写于
9月 24, 2021
作者:
A
Alexander Alekhin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #20747 from rgarnov:rg/desync_rmats_and_media
上级
499d8adb
3673b454
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
90 addition
and
7 deletion
+90
-7
modules/gapi/include/opencv2/gapi/gstreaming.hpp
modules/gapi/include/opencv2/gapi/gstreaming.hpp
+11
-1
modules/gapi/include/opencv2/gapi/streaming/desync.hpp
modules/gapi/include/opencv2/gapi/streaming/desync.hpp
+3
-2
modules/gapi/src/api/kernels_streaming.cpp
modules/gapi/src/api/kernels_streaming.cpp
+6
-1
modules/gapi/src/executor/gstreamingexecutor.cpp
modules/gapi/src/executor/gstreamingexecutor.cpp
+3
-2
modules/gapi/test/streaming/gapi_streaming_tests.cpp
modules/gapi/test/streaming/gapi_streaming_tests.cpp
+67
-1
未找到文件。
modules/gapi/include/opencv2/gapi/gstreaming.hpp
浏览文件 @
1261f250
...
...
@@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2018 Intel Corporation
// Copyright (C) 2018
-2021
Intel Corporation
#ifndef OPENCV_GAPI_GSTREAMING_COMPILED_HPP
...
...
@@ -65,6 +65,7 @@ using OptionalOpaqueRef = OptRef<cv::detail::OpaqueRef>;
using
GOptRunArgP
=
util
::
variant
<
optional
<
cv
::
Mat
>*
,
optional
<
cv
::
RMat
>*
,
optional
<
cv
::
MediaFrame
>*
,
optional
<
cv
::
Scalar
>*
,
cv
::
detail
::
OptionalVectorRef
,
cv
::
detail
::
OptionalOpaqueRef
...
...
@@ -74,6 +75,7 @@ using GOptRunArgsP = std::vector<GOptRunArgP>;
using
GOptRunArg
=
util
::
variant
<
optional
<
cv
::
Mat
>
,
optional
<
cv
::
RMat
>
,
optional
<
cv
::
MediaFrame
>
,
optional
<
cv
::
Scalar
>
,
optional
<
cv
::
detail
::
VectorRef
>
,
optional
<
cv
::
detail
::
OpaqueRef
>
...
...
@@ -95,6 +97,14 @@ template<> inline GOptRunArgP wrap_opt_arg(optional<cv::Mat> &m) {
return
GOptRunArgP
{
&
m
};
}
template
<
>
inline
GOptRunArgP
wrap_opt_arg
(
optional
<
cv
::
RMat
>
&
m
)
{
return
GOptRunArgP
{
&
m
};
}
template
<
>
inline
GOptRunArgP
wrap_opt_arg
(
optional
<
cv
::
MediaFrame
>
&
f
)
{
return
GOptRunArgP
{
&
f
};
}
template
<
>
inline
GOptRunArgP
wrap_opt_arg
(
optional
<
cv
::
Scalar
>
&
s
)
{
return
GOptRunArgP
{
&
s
};
}
...
...
modules/gapi/include/opencv2/gapi/streaming/desync.hpp
浏览文件 @
1261f250
...
...
@@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020
-2021
Intel Corporation
#ifndef OPENCV_GAPI_GSTREAMING_DESYNC_HPP
...
...
@@ -73,9 +73,10 @@ G desync(const G &g) {
* which produces an array of cv::util::optional<> objects.
*
* @note This feature is highly experimental now and is currently
* limited to a single GMat argument only.
* limited to a single GMat
/GFrame
argument only.
*/
GAPI_EXPORTS
GMat
desync
(
const
GMat
&
g
);
GAPI_EXPORTS
GFrame
desync
(
const
GFrame
&
f
);
}
// namespace streaming
}
// namespace gapi
...
...
modules/gapi/src/api/kernels_streaming.cpp
浏览文件 @
1261f250
...
...
@@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2020 Intel Corporation
// Copyright (C) 2020
-2021
Intel Corporation
#include "precomp.hpp"
...
...
@@ -75,6 +75,11 @@ cv::GMat cv::gapi::streaming::desync(const cv::GMat &g) {
// object will feed both branches of the streaming executable.
}
// All notes from the above desync(GMat) are also applicable here
cv
::
GFrame
cv
::
gapi
::
streaming
::
desync
(
const
cv
::
GFrame
&
f
)
{
return
cv
::
gapi
::
copy
(
detail
::
desync
(
f
));
}
cv
::
GMat
cv
::
gapi
::
streaming
::
BGR
(
const
cv
::
GFrame
&
in
)
{
return
cv
::
gapi
::
streaming
::
GBGR
::
on
(
in
);
}
...
...
modules/gapi/src/executor/gstreamingexecutor.cpp
浏览文件 @
1261f250
...
...
@@ -186,8 +186,9 @@ void sync_data(cv::gimpl::stream::Result &r, cv::GOptRunArgsP &outputs)
// FIXME: this conversion should be unified
switch
(
out_obj
.
index
())
{
HANDLE_CASE
(
cv
::
Scalar
);
break
;
HANDLE_CASE
(
cv
::
RMat
);
break
;
HANDLE_CASE
(
cv
::
Scalar
);
break
;
HANDLE_CASE
(
cv
::
RMat
);
break
;
HANDLE_CASE
(
cv
::
MediaFrame
);
break
;
case
T
::
index_of
<
O
<
cv
::
Mat
>*>
():
{
// Mat: special handling.
...
...
modules/gapi/test/streaming/gapi_streaming_tests.cpp
浏览文件 @
1261f250
...
...
@@ -2,7 +2,7 @@
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2019-202
0
Intel Corporation
// Copyright (C) 2019-202
1
Intel Corporation
#include "../test_precomp.hpp"
...
...
@@ -2284,4 +2284,70 @@ TEST(OneVPL_Source, Init)
EXPECT_TRUE
(
stream_data_provider
->
empty
());
}
#endif
TEST
(
GAPI_Streaming
,
TestDesyncRMat
)
{
cv
::
GMat
in
;
auto
blurred
=
cv
::
gapi
::
blur
(
in
,
cv
::
Size
{
3
,
3
});
auto
desynced
=
cv
::
gapi
::
streaming
::
desync
(
blurred
);
auto
out
=
in
-
blurred
;
auto
pipe
=
cv
::
GComputation
(
cv
::
GIn
(
in
),
cv
::
GOut
(
desynced
,
out
)).
compileStreaming
();
cv
::
Size
sz
(
32
,
32
);
cv
::
Mat
in_mat
(
sz
,
CV_8UC3
);
cv
::
randu
(
in_mat
,
cv
::
Scalar
::
all
(
0
),
cv
::
Scalar
(
255
));
pipe
.
setSource
(
cv
::
gin
(
in_mat
));
pipe
.
start
();
cv
::
optional
<
cv
::
RMat
>
out_desync
;
cv
::
optional
<
cv
::
RMat
>
out_rmat
;
while
(
true
)
{
// Initially it throwed "bad variant access" since there was
// no RMat handling in wrap_opt_arg
EXPECT_NO_THROW
(
pipe
.
pull
(
cv
::
gout
(
out_desync
,
out_rmat
)));
if
(
out_rmat
)
break
;
}
}
G_API_OP
(
GTestBlur
,
<
GFrame
(
GFrame
)
>
,
"test.blur"
)
{
static
GFrameDesc
outMeta
(
GFrameDesc
d
)
{
return
d
;
}
};
GAPI_OCV_KERNEL
(
GOcvTestBlur
,
GTestBlur
)
{
static
void
run
(
const
cv
::
MediaFrame
&
in
,
cv
::
MediaFrame
&
out
)
{
auto
d
=
in
.
desc
();
GAPI_Assert
(
d
.
fmt
==
cv
::
MediaFormat
::
BGR
);
auto
view
=
in
.
access
(
cv
::
MediaFrame
::
Access
::
R
);
cv
::
Mat
mat
(
d
.
size
,
CV_8UC3
,
view
.
ptr
[
0
]);
cv
::
Mat
blurred
;
cv
::
blur
(
mat
,
blurred
,
cv
::
Size
{
3
,
3
});
out
=
cv
::
MediaFrame
::
Create
<
TestMediaBGR
>
(
blurred
);
}
};
TEST
(
GAPI_Streaming
,
TestDesyncMediaFrame
)
{
initTestDataPath
();
cv
::
GFrame
in
;
auto
blurred
=
GTestBlur
::
on
(
in
);
auto
desynced
=
cv
::
gapi
::
streaming
::
desync
(
blurred
);
auto
out
=
GTestBlur
::
on
(
blurred
);
auto
pipe
=
cv
::
GComputation
(
cv
::
GIn
(
in
),
cv
::
GOut
(
desynced
,
out
))
.
compileStreaming
(
cv
::
compile_args
(
cv
::
gapi
::
kernels
<
GOcvTestBlur
>
()));
std
::
string
filepath
=
findDataFile
(
"cv/video/768x576.avi"
);
try
{
pipe
.
setSource
<
BGRSource
>
(
filepath
);
}
catch
(...)
{
throw
SkipTestException
(
"Video file can not be opened"
);
}
pipe
.
start
();
cv
::
optional
<
cv
::
MediaFrame
>
out_desync
;
cv
::
optional
<
cv
::
MediaFrame
>
out_frame
;
while
(
true
)
{
// Initially it throwed "bad variant access" since there was
// no MediaFrame handling in wrap_opt_arg
EXPECT_NO_THROW
(
pipe
.
pull
(
cv
::
gout
(
out_desync
,
out_frame
)));
if
(
out_frame
)
break
;
}
}
}
// namespace opencv_test
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录