Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
fb326a35
O
Opencv
项目概览
Greenplum
/
Opencv
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
fb326a35
编写于
4月 26, 2019
作者:
R
Ruslan Garnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added a reproducer
上级
d0032b07
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
155 addition
and
11 deletion
+155
-11
modules/gapi/test/gapi_fluid_resize_test.cpp
modules/gapi/test/gapi_fluid_resize_test.cpp
+61
-0
modules/gapi/test/gapi_fluid_test_kernels.cpp
modules/gapi/test/gapi_fluid_test_kernels.cpp
+76
-11
modules/gapi/test/gapi_fluid_test_kernels.hpp
modules/gapi/test/gapi_fluid_test_kernels.hpp
+18
-0
未找到文件。
modules/gapi/test/gapi_fluid_resize_test.cpp
浏览文件 @
fb326a35
...
...
@@ -790,4 +790,65 @@ INSTANTIATE_TEST_CASE_P(Fluid, NV12PlusResizeTest,
cv
::
Size
{
32
,
64
},
cv
::
Rect
{
0
,
48
,
32
,
16
})
));
struct
Preproc4lpiTest
:
public
TestWithParam
<
std
::
tuple
<
cv
::
Size
,
cv
::
Size
,
cv
::
Rect
>>
{};
TEST_P
(
Preproc4lpiTest
,
Test
)
{
using
namespace
gapi_test_kernels
;
cv
::
Size
in_sz
,
out_sz
;
cv
::
Rect
roi
;
std
::
tie
(
in_sz
,
out_sz
,
roi
)
=
GetParam
();
int
interp
=
cv
::
INTER_LINEAR
;
cv
::
Mat
in_mat
=
cv
::
Mat
(
in_sz
,
CV_8UC3
);
cv
::
randn
(
in_mat
,
cv
::
Scalar
::
all
(
127.0
f
),
cv
::
Scalar
::
all
(
40.
f
));
cv
::
Mat
out_mat
,
out_mat_ocv
;
cv
::
GMat
in
;
auto
splitted
=
split3_4lpi
(
in
);
cv
::
GMat
resized
[
3
]
=
{
cv
::
gapi
::
resize
(
std
::
get
<
0
>
(
splitted
),
out_sz
,
0
,
0
,
interp
)
,
cv
::
gapi
::
resize
(
std
::
get
<
1
>
(
splitted
),
out_sz
,
0
,
0
,
interp
)
,
cv
::
gapi
::
resize
(
std
::
get
<
2
>
(
splitted
),
out_sz
,
0
,
0
,
interp
)
};
auto
out
=
merge3_4lpi
(
resized
[
0
],
resized
[
1
],
resized
[
2
]);
cv
::
GComputation
c
(
cv
::
GIn
(
in
),
cv
::
GOut
(
out
));
auto
pkg
=
cv
::
gapi
::
combine
(
cv
::
gapi
::
core
::
fluid
::
kernels
(),
fluidResizeTestPackage
(
interp
,
in_sz
,
out_sz
,
4
),
cv
::
unite_policy
::
REPLACE
);
c
.
apply
(
cv
::
gin
(
in_mat
),
cv
::
gout
(
out_mat
)
,
cv
::
compile_args
(
pkg
,
cv
::
GFluidOutputRois
{{
to_own
(
roi
)}}));
cv
::
resize
(
in_mat
,
out_mat_ocv
,
out_sz
,
0
,
0
,
interp
);
EXPECT_EQ
(
0
,
cv
::
countNonZero
(
out_mat
(
roi
)
!=
out_mat_ocv
(
roi
)));
}
INSTANTIATE_TEST_CASE_P
(
Fluid
,
Preproc4lpiTest
,
Values
(
std
::
make_tuple
(
cv
::
Size
{
8
,
8
},
cv
::
Size
{
4
,
4
},
cv
::
Rect
{
0
,
0
,
4
,
4
})
,
std
::
make_tuple
(
cv
::
Size
{
8
,
8
},
cv
::
Size
{
4
,
4
},
cv
::
Rect
{
0
,
0
,
4
,
1
})
,
std
::
make_tuple
(
cv
::
Size
{
8
,
8
},
cv
::
Size
{
4
,
4
},
cv
::
Rect
{
0
,
1
,
4
,
2
})
,
std
::
make_tuple
(
cv
::
Size
{
8
,
8
},
cv
::
Size
{
4
,
4
},
cv
::
Rect
{
0
,
2
,
4
,
2
})
,
std
::
make_tuple
(
cv
::
Size
{
24
,
24
},
cv
::
Size
{
12
,
12
},
cv
::
Rect
{
0
,
0
,
12
,
3
})
,
std
::
make_tuple
(
cv
::
Size
{
24
,
24
},
cv
::
Size
{
12
,
12
},
cv
::
Rect
{
0
,
3
,
12
,
3
})
,
std
::
make_tuple
(
cv
::
Size
{
64
,
64
},
cv
::
Size
{
49
,
49
},
cv
::
Rect
{
0
,
0
,
49
,
49
})
,
std
::
make_tuple
(
cv
::
Size
{
64
,
64
},
cv
::
Size
{
49
,
49
},
cv
::
Rect
{
0
,
0
,
49
,
12
})
,
std
::
make_tuple
(
cv
::
Size
{
64
,
64
},
cv
::
Size
{
49
,
49
},
cv
::
Rect
{
0
,
11
,
49
,
15
})
,
std
::
make_tuple
(
cv
::
Size
{
64
,
64
},
cv
::
Size
{
49
,
49
},
cv
::
Rect
{
0
,
39
,
49
,
10
})
));
}
// namespace opencv_test
modules/gapi/test/gapi_fluid_test_kernels.cpp
浏览文件 @
fb326a35
...
...
@@ -359,14 +359,12 @@ GAPI_FLUID_KERNEL(FPlusRow0, TPlusRow0, true)
}
};
GAPI_FLUID_KERNEL
(
FTestSplit3
,
cv
::
gapi
::
core
::
GSplit3
,
false
)
static
void
split3Row
(
const
cv
::
gapi
::
fluid
::
View
&
in
,
cv
::
gapi
::
fluid
::
Buffer
&
o1
,
cv
::
gapi
::
fluid
::
Buffer
&
o2
,
cv
::
gapi
::
fluid
::
Buffer
&
o3
)
{
static
const
int
Window
=
1
;
static
void
run
(
const
cv
::
gapi
::
fluid
::
View
&
in
,
cv
::
gapi
::
fluid
::
Buffer
&
o1
,
cv
::
gapi
::
fluid
::
Buffer
&
o2
,
cv
::
gapi
::
fluid
::
Buffer
&
o3
)
for
(
int
l
=
0
;
l
<
o1
.
lpi
();
l
++
)
{
// std::cout << "Split3 {{{\n";
// std::cout << " a - "; in.debug(std::cout);
...
...
@@ -375,10 +373,10 @@ GAPI_FLUID_KERNEL(FTestSplit3, cv::gapi::core::GSplit3, false)
// std::cout << " 3 - "; o3.debug(std::cout);
// std::cout << "}}} " << std::endl;;
const
uint8_t
*
in_rgb
=
in
.
InLine
<
uint8_t
>
(
0
);
uint8_t
*
out_r
=
o1
.
OutLine
<
uint8_t
>
();
uint8_t
*
out_g
=
o2
.
OutLine
<
uint8_t
>
();
uint8_t
*
out_b
=
o3
.
OutLine
<
uint8_t
>
();
const
uint8_t
*
in_rgb
=
in
.
InLine
<
uint8_t
>
(
l
);
uint8_t
*
out_r
=
o1
.
OutLine
<
uint8_t
>
(
l
);
uint8_t
*
out_g
=
o2
.
OutLine
<
uint8_t
>
(
l
);
uint8_t
*
out_b
=
o3
.
OutLine
<
uint8_t
>
(
l
);
for
(
int
i
=
0
,
w
=
in
.
length
();
i
<
w
;
i
++
)
{
...
...
@@ -387,8 +385,40 @@ GAPI_FLUID_KERNEL(FTestSplit3, cv::gapi::core::GSplit3, false)
out_b
[
i
]
=
in_rgb
[
3
*
i
+
2
];
}
}
}
GAPI_FLUID_KERNEL
(
FTestSplit3
,
cv
::
gapi
::
core
::
GSplit3
,
false
)
{
static
const
int
Window
=
1
;
static
void
run
(
const
cv
::
gapi
::
fluid
::
View
&
in
,
cv
::
gapi
::
fluid
::
Buffer
&
o1
,
cv
::
gapi
::
fluid
::
Buffer
&
o2
,
cv
::
gapi
::
fluid
::
Buffer
&
o3
)
{
split3Row
(
in
,
o1
,
o2
,
o3
);
}
};
GAPI_FLUID_KERNEL
(
FTestSplit3_4lpi
,
TSplit3_4lpi
,
false
)
{
static
const
int
Window
=
1
;
static
const
int
LPI
=
4
;
static
void
run
(
const
cv
::
gapi
::
fluid
::
View
&
in
,
cv
::
gapi
::
fluid
::
Buffer
&
o1
,
cv
::
gapi
::
fluid
::
Buffer
&
o2
,
cv
::
gapi
::
fluid
::
Buffer
&
o3
)
{
split3Row
(
in
,
o1
,
o2
,
o3
);
}
};
std
::
tuple
<
GMat
,
GMat
,
GMat
>
split3_4lpi
(
const
GMat
&
src
)
{
return
TSplit3_4lpi
::
on
(
src
);
}
GAPI_FLUID_KERNEL
(
FSum2MatsAndScalar
,
TSum2MatsAndScalar
,
false
)
{
static
const
int
Window
=
1
;
...
...
@@ -486,6 +516,39 @@ GAPI_FLUID_KERNEL(FNV12toRGB, cv::gapi::imgproc::GNV12toRGB, false)
}
};
GAPI_FLUID_KERNEL
(
FMerge3_4lpi
,
TMerge3_4lpi
,
false
)
{
static
const
int
Window
=
1
;
static
const
int
LPI
=
4
;
static
void
run
(
const
cv
::
gapi
::
fluid
::
View
&
src1
,
const
cv
::
gapi
::
fluid
::
View
&
src2
,
const
cv
::
gapi
::
fluid
::
View
&
src3
,
cv
::
gapi
::
fluid
::
Buffer
&
dst
)
{
for
(
int
l
=
0
;
l
<
dst
.
lpi
();
l
++
)
{
const
auto
*
in1
=
src1
.
InLine
<
uchar
>
(
l
);
const
auto
*
in2
=
src2
.
InLine
<
uchar
>
(
l
);
const
auto
*
in3
=
src3
.
InLine
<
uchar
>
(
l
);
auto
*
out
=
dst
.
OutLine
<
uchar
>
(
l
);
for
(
int
w
=
0
;
w
<
dst
.
length
();
w
++
)
{
out
[
3
*
w
]
=
in1
[
w
];
out
[
3
*
w
+
1
]
=
in2
[
w
];
out
[
3
*
w
+
2
]
=
in3
[
w
];
}
}
}
};
GMat
merge3_4lpi
(
const
GMat
&
src1
,
const
GMat
&
src2
,
const
GMat
&
src3
)
{
return
TMerge3_4lpi
::
on
(
src1
,
src2
,
src3
);
}
cv
::
gapi
::
GKernelPackage
fluidTestPackage
=
cv
::
gapi
::
kernels
<
FAddSimple
,
FAddCSimple
...
...
@@ -498,10 +561,12 @@ cv::gapi::GKernelPackage fluidTestPackage = cv::gapi::kernels
,
FBlur5x5_2lpi
,
FIdentity
,
FId7x7
,
FMerge3_4lpi
,
FNV12toRGB
,
FPlusRow0
,
FSum2MatsAndScalar
,
FTestSplit3
,
FTestSplit3_4lpi
>
();
}
// namespace gapi_test_kernels
}
// namespace cv
modules/gapi/test/gapi_fluid_test_kernels.hpp
浏览文件 @
fb326a35
...
...
@@ -14,6 +14,7 @@ namespace cv
{
namespace
gapi_test_kernels
{
using
cv
::
gapi
::
core
::
GMat3
;
G_TYPED_KERNEL
(
TAddSimple
,
<
GMat
(
GMat
,
GMat
)
>
,
"test.fluid.add_simple"
)
{
static
cv
::
GMatDesc
outMeta
(
cv
::
GMatDesc
a
,
cv
::
GMatDesc
)
{
...
...
@@ -84,6 +85,12 @@ G_TYPED_KERNEL(TId7x7, <GMat(GMat)>, "test.fluid.identity7x7") {
}
};
G_TYPED_KERNEL
(
TMerge3_4lpi
,
<
GMat
(
GMat
,
GMat
,
GMat
)
>
,
"test.fluid.merge3_4lpi"
)
{
static
GMatDesc
outMeta
(
GMatDesc
in
,
GMatDesc
,
GMatDesc
)
{
return
in
.
withType
(
in
.
depth
,
3
);
}
};
G_TYPED_KERNEL
(
TPlusRow0
,
<
GMat
(
GMat
)
>
,
"test.fluid.plus_row0"
)
{
static
cv
::
GMatDesc
outMeta
(
cv
::
GMatDesc
a
)
{
return
a
;
...
...
@@ -97,6 +104,17 @@ G_TYPED_KERNEL(TSum2MatsAndScalar, <GMat(GMat,GScalar,GMat)>, "test.fluid.sum_2_
}
};
G_TYPED_KERNEL_M
(
TSplit3_4lpi
,
<
GMat3
(
GMat
)
>
,
"test.fluid.split3_4lpi"
)
{
static
std
::
tuple
<
GMatDesc
,
GMatDesc
,
GMatDesc
>
outMeta
(
GMatDesc
in
)
{
const
auto
out_depth
=
in
.
depth
;
const
auto
out_desc
=
in
.
withType
(
out_depth
,
1
);
return
std
::
make_tuple
(
out_desc
,
out_desc
,
out_desc
);
}
};
GMat
merge3_4lpi
(
const
GMat
&
src1
,
const
GMat
&
src2
,
const
GMat
&
src3
);
std
::
tuple
<
GMat
,
GMat
,
GMat
>
split3_4lpi
(
const
GMat
&
src
);
extern
cv
::
gapi
::
GKernelPackage
fluidTestPackage
;
}
// namespace gapi_test_kernels
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录