Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
3df6b6fd
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
3df6b6fd
编写于
3月 26, 2015
作者:
V
Vadim Pisarevsky
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added self-contained motion jpeg encoder (filename should end with .avi; fourcc should be "MJPG"
上级
0545aeb1
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
1596 addition
and
62 deletion
+1596
-62
modules/videoio/CMakeLists.txt
modules/videoio/CMakeLists.txt
+2
-0
modules/videoio/include/opencv2/videoio.hpp
modules/videoio/include/opencv2/videoio.hpp
+6
-2
modules/videoio/src/cap.cpp
modules/videoio/src/cap.cpp
+75
-57
modules/videoio/src/cap_dshow.hpp
modules/videoio/src/cap_dshow.hpp
+1
-1
modules/videoio/src/cap_intelperc.hpp
modules/videoio/src/cap_intelperc.hpp
+1
-1
modules/videoio/src/cap_mjpeg_decoder.cpp
modules/videoio/src/cap_mjpeg_decoder.cpp
+52
-0
modules/videoio/src/cap_mjpeg_encoder.cpp
modules/videoio/src/cap_mjpeg_encoder.cpp
+1443
-0
modules/videoio/src/precomp.hpp
modules/videoio/src/precomp.hpp
+16
-1
未找到文件。
modules/videoio/CMakeLists.txt
浏览文件 @
3df6b6fd
...
...
@@ -27,6 +27,8 @@ set(videoio_hdrs
set
(
videoio_srcs
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap.cpp
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap_images.cpp
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap_mjpeg_encoder.cpp
${
CMAKE_CURRENT_LIST_DIR
}
/src/cap_mjpeg_decoder.cpp
)
file
(
GLOB videoio_ext_hdrs
...
...
modules/videoio/include/opencv2/videoio.hpp
浏览文件 @
3df6b6fd
...
...
@@ -586,10 +586,10 @@ public:
protected:
Ptr
<
CvCapture
>
cap
;
Ptr
<
IVideoCapture
>
icap
;
private:
static
Ptr
<
IVideoCapture
>
createCameraCapture
(
int
index
);
};
class
IVideoWriter
;
/** @brief Video writer class.
*/
class
CV_EXPORTS_W
VideoWriter
...
...
@@ -651,6 +651,10 @@ public:
protected:
Ptr
<
CvVideoWriter
>
writer
;
Ptr
<
IVideoWriter
>
iwriter
;
static
Ptr
<
IVideoWriter
>
create
(
const
String
&
filename
,
int
fourcc
,
double
fps
,
Size
frameSize
,
bool
isColor
=
true
);
};
template
<
>
CV_EXPORTS
void
DefaultDeleter
<
CvCapture
>::
operator
()(
CvCapture
*
obj
)
const
;
...
...
modules/videoio/src/cap.cpp
浏览文件 @
3df6b6fd
...
...
@@ -499,6 +499,67 @@ CV_IMPL void cvReleaseVideoWriter( CvVideoWriter** pwriter )
namespace
cv
{
static
Ptr
<
IVideoCapture
>
IVideoCapture_create
(
int
index
)
{
int
domains
[]
=
{
#ifdef HAVE_DSHOW
CV_CAP_DSHOW
,
#endif
#ifdef HAVE_INTELPERC
CV_CAP_INTELPERC
,
#endif
-
1
,
-
1
};
// interpret preferred interface (0 = autodetect)
int
pref
=
(
index
/
100
)
*
100
;
if
(
pref
)
{
domains
[
0
]
=
pref
;
index
%=
100
;
domains
[
1
]
=-
1
;
}
// try every possibly installed camera API
for
(
int
i
=
0
;
domains
[
i
]
>=
0
;
i
++
)
{
#if defined(HAVE_DSHOW) || \
defined(HAVE_INTELPERC) || \
(0)
Ptr
<
IVideoCapture
>
capture
;
switch
(
domains
[
i
])
{
#ifdef HAVE_DSHOW
case
CV_CAP_DSHOW
:
capture
=
makePtr
<
VideoCapture_DShow
>
(
index
);
break
;
// CV_CAP_DSHOW
#endif
#ifdef HAVE_INTELPERC
case
CV_CAP_INTELPERC
:
capture
=
makePtr
<
VideoCapture_IntelPerC
>
();
break
;
// CV_CAP_INTEL_PERC
#endif
}
if
(
capture
&&
capture
->
isOpened
())
return
capture
;
#endif
}
// failed open a camera
return
Ptr
<
IVideoCapture
>
();
}
static
Ptr
<
IVideoWriter
>
IVideoWriter_create
(
const
String
&
filename
,
int
_fourcc
,
double
fps
,
Size
frameSize
,
bool
isColor
)
{
Ptr
<
IVideoWriter
>
iwriter
;
if
(
_fourcc
==
CV_FOURCC
(
'M'
,
'J'
,
'P'
,
'G'
)
)
iwriter
=
createMotionJpegWriter
(
filename
,
fps
,
frameSize
,
isColor
);
return
iwriter
;
}
VideoCapture
::
VideoCapture
()
{}
...
...
@@ -528,7 +589,7 @@ bool VideoCapture::open(const String& filename)
bool
VideoCapture
::
open
(
int
device
)
{
if
(
isOpened
())
release
();
icap
=
createCameraCaptur
e
(
device
);
icap
=
IVideoCapture_creat
e
(
device
);
if
(
!
icap
.
empty
())
return
true
;
cap
.
reset
(
cvCreateCameraCapture
(
device
));
...
...
@@ -609,59 +670,6 @@ double VideoCapture::get(int propId) const
return
icvGetCaptureProperty
(
cap
,
propId
);
}
Ptr
<
IVideoCapture
>
VideoCapture
::
createCameraCapture
(
int
index
)
{
int
domains
[]
=
{
#ifdef HAVE_DSHOW
CV_CAP_DSHOW
,
#endif
#ifdef HAVE_INTELPERC
CV_CAP_INTELPERC
,
#endif
-
1
,
-
1
};
// interpret preferred interface (0 = autodetect)
int
pref
=
(
index
/
100
)
*
100
;
if
(
pref
)
{
domains
[
0
]
=
pref
;
index
%=
100
;
domains
[
1
]
=-
1
;
}
// try every possibly installed camera API
for
(
int
i
=
0
;
domains
[
i
]
>=
0
;
i
++
)
{
#if defined(HAVE_DSHOW) || \
defined(HAVE_INTELPERC) || \
(0)
Ptr
<
IVideoCapture
>
capture
;
switch
(
domains
[
i
])
{
#ifdef HAVE_DSHOW
case
CV_CAP_DSHOW
:
capture
=
makePtr
<
VideoCapture_DShow
>
(
index
);
if
(
capture
&&
capture
.
dynamicCast
<
VideoCapture_DShow
>
()
->
isOpened
())
return
capture
;
break
;
// CV_CAP_DSHOW
#endif
#ifdef HAVE_INTELPERC
case
CV_CAP_INTELPERC
:
capture
=
makePtr
<
VideoCapture_IntelPerC
>
();
if
(
capture
&&
capture
.
dynamicCast
<
VideoCapture_IntelPerC
>
()
->
isOpened
())
return
capture
;
break
;
// CV_CAP_INTEL_PERC
#endif
}
#endif
}
// failed open a camera
return
Ptr
<
IVideoCapture
>
();
}
VideoWriter
::
VideoWriter
()
{}
...
...
@@ -673,6 +681,7 @@ VideoWriter::VideoWriter(const String& filename, int _fourcc, double fps, Size f
void
VideoWriter
::
release
()
{
iwriter
.
release
();
writer
.
release
();
}
...
...
@@ -683,19 +692,28 @@ VideoWriter::~VideoWriter()
bool
VideoWriter
::
open
(
const
String
&
filename
,
int
_fourcc
,
double
fps
,
Size
frameSize
,
bool
isColor
)
{
if
(
isOpened
())
release
();
iwriter
=
IVideoWriter_create
(
filename
,
_fourcc
,
fps
,
frameSize
,
isColor
);
if
(
!
iwriter
.
empty
())
return
true
;
writer
.
reset
(
cvCreateVideoWriter
(
filename
.
c_str
(),
_fourcc
,
fps
,
frameSize
,
isColor
));
return
isOpened
();
}
bool
VideoWriter
::
isOpened
()
const
{
return
!
writer
.
empty
();
return
!
iwriter
.
empty
()
||
!
writer
.
empty
();
}
void
VideoWriter
::
write
(
const
Mat
&
image
)
{
IplImage
_img
=
image
;
cvWriteFrame
(
writer
,
&
_img
);
if
(
iwriter
)
iwriter
->
write
(
image
);
else
{
IplImage
_img
=
image
;
cvWriteFrame
(
writer
,
&
_img
);
}
}
VideoWriter
&
VideoWriter
::
operator
<<
(
const
Mat
&
image
)
...
...
modules/videoio/src/cap_dshow.hpp
浏览文件 @
3df6b6fd
...
...
@@ -32,7 +32,7 @@ public:
virtual
bool
grabFrame
();
virtual
bool
retrieveFrame
(
int
outputType
,
OutputArray
frame
);
virtual
int
getCaptureDomain
();
bool
isOpened
()
const
;
virtual
bool
isOpened
()
const
;
protected:
void
open
(
int
index
);
void
close
();
...
...
modules/videoio/src/cap_intelperc.hpp
浏览文件 @
3df6b6fd
...
...
@@ -100,7 +100,7 @@ public:
virtual
bool
grabFrame
();
virtual
bool
retrieveFrame
(
int
outputType
,
OutputArray
frame
);
virtual
int
getCaptureDomain
();
bool
isOpened
()
const
;
virtual
bool
isOpened
()
const
;
protected:
bool
m_contextOpened
;
...
...
modules/videoio/src/cap_mjpeg_decoder.cpp
0 → 100644
浏览文件 @
3df6b6fd
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2015, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
namespace
cv
{
Ptr
<
IVideoCapture
>
createMotionJpegCapture
(
const
String
&
filename
)
{
return
Ptr
<
IVideoCapture
>
();
}
}
modules/videoio/src/cap_mjpeg_encoder.cpp
0 → 100644
浏览文件 @
3df6b6fd
此差异已折叠。
点击以展开。
modules/videoio/src/precomp.hpp
浏览文件 @
3df6b6fd
...
...
@@ -168,9 +168,24 @@ namespace cv
virtual
double
getProperty
(
int
)
const
{
return
0
;
}
virtual
bool
setProperty
(
int
,
double
)
{
return
0
;
}
virtual
bool
grabFrame
()
=
0
;
virtual
bool
retrieveFrame
(
int
,
cv
::
OutputArray
)
=
0
;
virtual
bool
retrieveFrame
(
int
,
OutputArray
)
=
0
;
virtual
bool
isOpened
()
const
=
0
;
virtual
int
getCaptureDomain
()
{
return
CAP_ANY
;
}
// Return the type of the capture object: CAP_VFW, etc...
};
class
IVideoWriter
{
public:
virtual
~
IVideoWriter
()
{}
virtual
double
getProperty
(
int
)
const
{
return
0
;
}
virtual
bool
setProperty
(
int
,
double
)
{
return
0
;
}
virtual
bool
isOpened
()
const
=
0
;
virtual
void
write
(
InputArray
)
=
0
;
};
Ptr
<
IVideoCapture
>
createMotionJpegCapture
(
const
String
&
filename
);
Ptr
<
IVideoWriter
>
createMotionJpegWriter
(
const
String
&
filename
,
double
fps
,
Size
frameSize
,
bool
iscolor
);
};
#endif
/* __VIDEOIO_H_ */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录