Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
86488ac1
Commit
86488ac1
authored
Apr 09, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11130 from allnes:gst_test_pipeline
parents
b76ce0e0
c0d6f3d2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
test_gstreamer.cpp
modules/videoio/test/test_gstreamer.cpp
+74
-0
No files found.
modules/videoio/test/test_gstreamer.cpp
0 → 100644
View file @
86488ac1
// This file is part of OpenCV project.
// 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.
#include "test_precomp.hpp"
#ifdef HAVE_GSTREAMER
namespace
opencv_test
{
typedef
tuple
<
string
,
Size
,
Size
,
int
>
Param
;
typedef
testing
::
TestWithParam
<
Param
>
Videoio_Gstreamer_Test
;
TEST_P
(
Videoio_Gstreamer_Test
,
test_object_structure
)
{
string
format
=
get
<
0
>
(
GetParam
());
Size
frame_size
=
get
<
1
>
(
GetParam
());
Size
mat_size
=
get
<
2
>
(
GetParam
());
int
convertToRGB
=
get
<
3
>
(
GetParam
());
int
count_frames
=
10
;
std
::
ostringstream
pipeline
;
pipeline
<<
"videotestsrc pattern=ball num-buffers="
<<
count_frames
<<
" ! "
<<
format
;
pipeline
<<
", framerate=1/1, width="
<<
frame_size
.
width
<<
", height="
<<
frame_size
.
height
<<
" ! appsink"
;
VideoCapture
cap
(
pipeline
.
str
(),
CAP_GSTREAMER
);
ASSERT_TRUE
(
cap
.
isOpened
());
Mat
buffer
,
decode_frame
,
gray_frame
,
rgb_frame
;
for
(
int
i
=
0
;
i
<
count_frames
;
++
i
)
{
cap
>>
buffer
;
decode_frame
=
(
format
==
"jpegenc ! image/jpeg"
)
?
imdecode
(
buffer
,
IMREAD_UNCHANGED
)
:
buffer
;
EXPECT_EQ
(
mat_size
,
decode_frame
.
size
());
cvtColor
(
decode_frame
,
rgb_frame
,
convertToRGB
);
cvtColor
(
rgb_frame
,
gray_frame
,
COLOR_RGB2GRAY
);
vector
<
Vec3f
>
circles
;
HoughCircles
(
gray_frame
,
circles
,
HOUGH_GRADIENT
,
1
,
gray_frame
.
rows
/
16
,
100
,
30
,
1
,
30
);
if
(
circles
.
size
()
==
1
)
{
EXPECT_NEAR
(
18.5
,
circles
[
0
][
2
],
1.0
);
}
else
{
ADD_FAILURE
()
<<
"Found "
<<
circles
.
size
()
<<
" on frame "
<<
i
;
}
}
{
Mat
frame
;
cap
>>
frame
;
EXPECT_TRUE
(
frame
.
empty
());
}
cap
.
release
();
ASSERT_FALSE
(
cap
.
isOpened
());
}
Param
test_data
[]
=
{
make_tuple
(
"video/x-raw, format=BGR"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_BGR2RGB
),
make_tuple
(
"video/x-raw, format=GRAY8"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_GRAY2RGB
),
make_tuple
(
"video/x-raw, format=UYVY"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_YUV2RGB_UYVY
),
make_tuple
(
"video/x-raw, format=YUY2"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_YUV2RGB_YUY2
),
make_tuple
(
"video/x-raw, format=YVYU"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_YUV2RGB_YVYU
),
make_tuple
(
"video/x-raw, format=NV12"
,
Size
(
640
,
480
),
Size
(
640
,
720
),
COLOR_YUV2RGB_NV12
),
make_tuple
(
"video/x-raw, format=NV21"
,
Size
(
640
,
480
),
Size
(
640
,
720
),
COLOR_YUV2RGB_NV21
),
make_tuple
(
"video/x-raw, format=YV12"
,
Size
(
640
,
480
),
Size
(
640
,
720
),
COLOR_YUV2RGB_YV12
),
make_tuple
(
"video/x-raw, format=I420"
,
Size
(
640
,
480
),
Size
(
640
,
720
),
COLOR_YUV2RGB_I420
),
make_tuple
(
"video/x-bayer"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_BayerBG2RGB
),
make_tuple
(
"jpegenc ! image/jpeg"
,
Size
(
640
,
480
),
Size
(
640
,
480
),
COLOR_BGR2RGB
)
};
INSTANTIATE_TEST_CASE_P
(
videoio
,
Videoio_Gstreamer_Test
,
testing
::
ValuesIn
(
test_data
));
}
// namespace
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment