Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
a41b0902
O
Opencv
项目概览
Greenplum
/
Opencv
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
a41b0902
编写于
1月 31, 2012
作者:
A
Alexander Reshetnikov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prepared some videos for future tests. Added first version of common positioning video test.
上级
fef90e22
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
148 addition
and
5 deletion
+148
-5
modules/highgui/src/cap_ffmpeg_impl.hpp
modules/highgui/src/cap_ffmpeg_impl.hpp
+4
-1
modules/highgui/test/test_pos.cpp
modules/highgui/test/test_pos.cpp
+120
-0
modules/highgui/test/test_video_io.cpp
modules/highgui/test/test_video_io.cpp
+24
-4
未找到文件。
modules/highgui/src/cap_ffmpeg_impl.hpp
浏览文件 @
a41b0902
...
...
@@ -507,6 +507,9 @@ bool CvCapture_FFMPEG::reopen()
#ifndef AVSEEK_FLAG_FRAME
#define AVSEEK_FLAG_FRAME 0
#endif
ifndef
AVSEEK_FLAG_ANY
#define AVSEEK_FLAG_ANY 1
#endif
bool
CvCapture_FFMPEG
::
open
(
const
char
*
_filename
)
{
...
...
@@ -832,7 +835,7 @@ bool CvCapture_FFMPEG::setProperty( int property_id, double value )
}
else
{
int
flags
=
AVSEEK_FLAG_
FRAME
;
int
flags
=
AVSEEK_FLAG_
ANY
;
if
(
timestamp
<
ic
->
streams
[
video_stream
]
->
cur_dts
)
flags
|=
AVSEEK_FLAG_BACKWARD
;
int
ret
=
av_seek_frame
(
ic
,
video_stream
,
timestamp
,
flags
);
...
...
modules/highgui/test/test_pos.cpp
0 → 100644
浏览文件 @
a41b0902
#include "test_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdio.h>
/* #include <cv.h>
#include <cxcore.h>
#include <iostream>
#include <sstream>
#include <string> */
using
namespace
cv
;
using
namespace
std
;
//ticket #1497
#define HIGHGUI_POSITIONING_ERROR_OPEN 0
#define MESSAGE_ERROR_CONTENT "Cannot read source video file."
class
CV_VideoPositioningTest
:
public
cvtest
::
BaseTest
{
public:
void
run
(
int
);
};
void
CV_VideoPositioningTest
::
run
(
int
)
{
const
string
&
src_dir
=
ts
->
get_data_path
();
std
::
cout
<<
src_dir
.
c_str
()
<<
endl
;
string
file_path
=
"/home/reshetnikov/SVN_Projects/OpenCV/opencv_extra/testdata/perf/video/sample_sorenson.mov"
;
std
::
cout
<<
file_path
.
c_str
()
<<
endl
;
cv
::
VideoCapture
cap
(
file_path
);
// CvCapture* cap = cvCreateFileCapture(file_path.c_str());
if
(
!
cap
.
isOpened
())
{
printf
(
"Error!"
);
return
;
}
std
::
cout
<<
"Frame pos: "
<<
cap
.
get
(
CV_CAP_PROP_POS_FRAMES
)
<<
std
::
endl
;
// IplImage* frame = cvQueryFrame(cap);
Mat
frame
;
cap
>>
frame
;
/* if (!frame)
{
return;
} */
std
::
cout
<<
"Frames number: "
<<
cap
.
get
(
CV_CAP_PROP_FRAME_COUNT
)
<<
std
::
endl
;
int
step
=
20
;
int
frameCount
=
1
;
while
(
frameCount
<
100
)
{
std
::
cout
<<
"Frame count: "
<<
frameCount
<<
"
\t
Actual frame pos: "
<<
cap
.
get
(
CV_CAP_PROP_POS_FRAMES
)
<<
std
::
endl
;
// Save the frame
std
::
stringstream
ss
;
ss
<<
frameCount
;
std
::
string
filename
=
ss
.
str
()
+
".png"
;
imwrite
(
file_path
,
frame
,
vector
<
int
>
(
1
));
// Advance by step frames
frameCount
+=
step
;
std
::
cout
<<
"cvSetCaptureProperty result: "
<<
cap
.
set
(
CV_CAP_PROP_POS_FRAMES
,
frameCount
)
<<
std
::
endl
;;
// frame = cvQueryFrame(cap);
}
// cvReleaseCapture(&cap);
cap
.
release
();
}
/*
47 NOTES
48
49 Output:
50 Frame pos: 0
51 Frame count: 1 Actual frame pos: -1.84467e+017
52 cvSetCaptureProperty result: 1
53 Frame count: 21 Actual frame pos: -1.84467e+017
54 cvSetCaptureProperty result: 1
55 Frame count: 41 Actual frame pos: -1.84467e+017
56 cvSetCaptureProperty result: 1
57 Frame count: 61 Actual frame pos: -1.84467e+017
58 cvSetCaptureProperty result: 1
59 Frame count: 81 Actual frame pos: -1.84467e+017
60 cvSetCaptureProperty result: 1
61
62 Expected:
63 Frame pos: 0
64 Frame count: 1 Actual frame pos: 1
65 cvSetCaptureProperty result: 1
66 Frame count: 21 Actual frame pos: 21
67 cvSetCaptureProperty result: 1
68 Frame count: 41 Actual frame pos: 41
69 cvSetCaptureProperty result: 1
70 Frame count: 61 Actual frame pos: 61
71 cvSetCaptureProperty result: 1
72 Frame count: 81 Actual frame pos: 81
73 cvSetCaptureProperty result: 1
74
75 In addition, the frame retrieved from cvQueryFrame was not the correct frame
76 */
TEST
(
HighguiPositioning
,
regression
)
{
CV_VideoPositioningTest
test
;
test
.
safe_run
();
}
modules/highgui/test/test_video_io.cpp
浏览文件 @
a41b0902
...
...
@@ -42,6 +42,7 @@
#include "test_precomp.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "stdio.h"
using
namespace
cv
;
using
namespace
std
;
...
...
@@ -56,6 +57,12 @@ public:
void
run
(
int
);
};
class
CV_PositioningTest
:
public
cvtest
::
BaseTest
{
public:
void
run
(
int
);
};
double
PSNR
(
const
Mat
&
m1
,
const
Mat
&
m2
)
{
Mat
tmp
;
...
...
@@ -232,6 +239,11 @@ void CV_HighGuiTest::VideoTest(const string& dir, int fourcc)
ts
->
printf
(
ts
->
LOG
,
"end test function : ImagesVideo
\n
"
);
}
void
CV_PositioningTest
::
run
(
int
)
{
}
void
CV_HighGuiTest
::
run
(
int
/*start_from */
)
{
...
...
@@ -240,13 +252,21 @@ void CV_HighGuiTest::run( int /*start_from */)
#if defined WIN32 || (defined __linux__ && !defined ANDROID)
#if !defined HAVE_GSTREAMER || defined HAVE_GSTREAMER_APP
VideoTest
(
ts
->
get_data_path
(),
CV_FOURCC_DEFAULT
);
const
char
codecs
[][
4
]
=
{
{
'I'
,
'Y'
,
'U'
,
'V'
},
{
'X'
,
'V'
,
'I'
,
'D'
},
{
'M'
,
'P'
,
'G'
,
'2'
},
{
'M'
,
'J'
,
'P'
,
'G'
}
};
printf
(
"%s"
,
ts
->
get_data_path
().
c_str
());
VideoTest
(
ts
->
get_data_path
(),
CV_FOURCC
(
'X'
,
'V'
,
'I'
,
'D'
));
int
count
=
sizeof
(
codecs
)
/
(
4
*
sizeof
(
char
));
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
VideoTest
(
ts
->
get_data_path
(),
CV_FOURCC
(
codecs
[
i
][
0
],
codecs
[
i
][
1
],
codecs
[
i
][
2
],
codecs
[
i
][
3
]));
}
VideoTest
(
ts
->
get_data_path
(),
CV_FOURCC
(
'M'
,
'P'
,
'G'
,
'2'
));
VideoTest
(
ts
->
get_data_path
(),
CV_FOURCC
(
'M'
,
'J'
,
'P'
,
'G'
));
#endif
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录