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
70e22b68
Commit
70e22b68
authored
Mar 07, 2014
by
Roman Donchenko
Committed by
OpenCV Buildbot
Mar 07, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2397 from vbystricky:intelperc
parents
2879ff20
193e97a3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
198 additions
and
12 deletions
+198
-12
highgui.hpp
modules/highgui/include/opencv2/highgui.hpp
+5
-1
cap.cpp
modules/highgui/src/cap.cpp
+63
-9
cap_intelperc.cpp
modules/highgui/src/cap_intelperc.cpp
+0
-0
cap_intelperc.hpp
modules/highgui/src/cap_intelperc.hpp
+116
-0
precomp.hpp
modules/highgui/src/precomp.hpp
+14
-2
No files found.
modules/highgui/include/opencv2/highgui.hpp
View file @
70e22b68
...
...
@@ -530,6 +530,8 @@ enum { CAP_INTELPERC_DEPTH_MAP = 0, // Each pixel is a 16-bit integ
CAP_INTELPERC_IMAGE
=
3
};
class
IVideoCapture
;
class
CV_EXPORTS_W
VideoCapture
{
public
:
...
...
@@ -554,9 +556,11 @@ public:
protected
:
Ptr
<
CvCapture
>
cap
;
Ptr
<
IVideoCapture
>
icap
;
private
:
static
Ptr
<
IVideoCapture
>
createCameraCapture
(
int
index
);
};
class
CV_EXPORTS_W
VideoWriter
{
public
:
...
...
modules/highgui/src/cap.cpp
View file @
70e22b68
...
...
@@ -40,6 +40,7 @@
//M*/
#include "precomp.hpp"
#include "cap_intelperc.hpp"
#if defined _M_X64 && defined _MSC_VER && !defined CV_ICC
#pragma optimize("",off)
...
...
@@ -345,14 +346,6 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
return
capture
;
break
;
// CV_CAP_GIGANETIX
#endif
#ifdef HAVE_INTELPERC
case
CV_CAP_INTELPERC
:
capture
=
cvCreateCameraCapture_IntelPerC
(
index
);
if
(
capture
)
return
capture
;
break
;
// CV_CAP_INTEL_PERC
#endif
}
}
...
...
@@ -497,6 +490,7 @@ VideoCapture::VideoCapture(int device)
VideoCapture
::~
VideoCapture
()
{
icap
.
release
();
cap
.
release
();
}
...
...
@@ -510,24 +504,36 @@ bool VideoCapture::open(const String& filename)
bool
VideoCapture
::
open
(
int
device
)
{
if
(
isOpened
())
release
();
icap
=
createCameraCapture
(
device
);
if
(
!
icap
.
empty
())
return
true
;
cap
.
reset
(
cvCreateCameraCapture
(
device
));
return
isOpened
();
}
bool
VideoCapture
::
isOpened
()
const
{
return
!
cap
.
empty
();
}
bool
VideoCapture
::
isOpened
()
const
{
return
(
!
cap
.
empty
()
||
!
icap
.
empty
());
}
void
VideoCapture
::
release
()
{
icap
.
release
();
cap
.
release
();
}
bool
VideoCapture
::
grab
()
{
if
(
!
icap
.
empty
())
return
icap
->
grabFrame
();
return
cvGrabFrame
(
cap
)
!=
0
;
}
bool
VideoCapture
::
retrieve
(
OutputArray
image
,
int
channel
)
{
if
(
!
icap
.
empty
())
return
icap
->
retrieveFrame
(
channel
,
image
);
IplImage
*
_img
=
cvRetrieveFrame
(
cap
,
channel
);
if
(
!
_img
)
{
...
...
@@ -567,14 +573,62 @@ VideoCapture& VideoCapture::operator >> (UMat& image)
bool
VideoCapture
::
set
(
int
propId
,
double
value
)
{
if
(
!
icap
.
empty
())
return
icap
->
setProperty
(
propId
,
value
);
return
cvSetCaptureProperty
(
cap
,
propId
,
value
)
!=
0
;
}
double
VideoCapture
::
get
(
int
propId
)
{
if
(
!
icap
.
empty
())
return
icap
->
getProperty
(
propId
);
return
cvGetCaptureProperty
(
cap
,
propId
);
}
Ptr
<
IVideoCapture
>
VideoCapture
::
createCameraCapture
(
int
index
)
{
int
domains
[]
=
{
#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_INTELPERC) || \
(0)
Ptr
<
IVideoCapture
>
capture
;
switch
(
domains
[
i
])
{
#ifdef HAVE_INTELPERC
case
CV_CAP_INTELPERC
:
capture
=
Ptr
<
IVideoCapture
>
(
new
cv
::
VideoCapture_IntelPerC
());
if
(
capture
)
return
capture
;
break
;
// CV_CAP_INTEL_PERC
#endif
}
#endif
}
// failed open a camera
return
Ptr
<
IVideoCapture
>
();
}
VideoWriter
::
VideoWriter
()
{}
...
...
modules/highgui/src/cap_intelperc.cpp
View file @
70e22b68
This diff is collapsed.
Click to expand it.
modules/highgui/src/cap_intelperc.hpp
0 → 100644
View file @
70e22b68
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
//M*/
#ifndef _CAP_INTELPERC_HPP_
#define _CAP_INTELPERC_HPP_
#include "precomp.hpp"
#ifdef HAVE_INTELPERC
#include "pxcsession.h"
#include "pxcsmartptr.h"
#include "pxccapture.h"
namespace
cv
{
class
IntelPerCStreamBase
{
public
:
IntelPerCStreamBase
();
virtual
~
IntelPerCStreamBase
();
bool
isValid
();
bool
grabFrame
();
int
getProfileIDX
()
const
;
public
:
virtual
bool
initStream
(
PXCSession
*
session
)
=
0
;
virtual
double
getProperty
(
int
propIdx
);
virtual
bool
setProperty
(
int
propIdx
,
double
propVal
);
protected
:
PXCSmartPtr
<
PXCCapture
::
Device
>
m_device
;
bool
initDevice
(
PXCSession
*
session
);
PXCSmartPtr
<
PXCCapture
::
VideoStream
>
m_stream
;
void
initStreamImpl
(
PXCImage
::
ImageType
type
);
protected
:
std
::
vector
<
PXCCapture
::
VideoStream
::
ProfileInfo
>
m_profiles
;
int
m_profileIdx
;
int
m_frameIdx
;
pxcU64
m_timeStampStartNS
;
double
m_timeStamp
;
PXCSmartPtr
<
PXCImage
>
m_pxcImage
;
virtual
bool
validProfile
(
const
PXCCapture
::
VideoStream
::
ProfileInfo
&
/*pinfo*/
);
void
enumProfiles
();
};
class
IntelPerCStreamImage
:
public
IntelPerCStreamBase
{
public
:
IntelPerCStreamImage
();
virtual
~
IntelPerCStreamImage
();
virtual
bool
initStream
(
PXCSession
*
session
);
virtual
double
getProperty
(
int
propIdx
);
virtual
bool
setProperty
(
int
propIdx
,
double
propVal
);
public
:
bool
retrieveAsOutputArray
(
OutputArray
image
);
};
class
IntelPerCStreamDepth
:
public
IntelPerCStreamBase
{
public
:
IntelPerCStreamDepth
();
virtual
~
IntelPerCStreamDepth
();
virtual
bool
initStream
(
PXCSession
*
session
);
virtual
double
getProperty
(
int
propIdx
);
virtual
bool
setProperty
(
int
propIdx
,
double
propVal
);
public
:
bool
retrieveDepthAsOutputArray
(
OutputArray
image
);
bool
retrieveIRAsOutputArray
(
OutputArray
image
);
bool
retrieveUVAsOutputArray
(
OutputArray
image
);
protected
:
virtual
bool
validProfile
(
const
PXCCapture
::
VideoStream
::
ProfileInfo
&
pinfo
);
protected
:
bool
retriveFrame
(
int
type
,
int
planeIdx
,
OutputArray
frame
);
};
class
VideoCapture_IntelPerC
:
public
IVideoCapture
{
public
:
VideoCapture_IntelPerC
();
virtual
~
VideoCapture_IntelPerC
();
virtual
double
getProperty
(
int
propIdx
);
virtual
bool
setProperty
(
int
propIdx
,
double
propVal
);
virtual
bool
grabFrame
();
virtual
bool
retrieveFrame
(
int
outputType
,
OutputArray
frame
);
virtual
int
getCaptureDomain
();
bool
isOpened
()
const
;
protected
:
bool
m_contextOpened
;
PXCSmartPtr
<
PXCSession
>
m_session
;
IntelPerCStreamImage
m_imageStream
;
IntelPerCStreamDepth
m_depthStream
;
};
}
#endif //HAVE_INTELPERC
#endif //_CAP_INTELPERC_HPP_
\ No newline at end of file
modules/highgui/src/precomp.hpp
View file @
70e22b68
...
...
@@ -136,8 +136,6 @@ CvCapture* cvCreateFileCapture_OpenNI( const char* filename );
CvCapture
*
cvCreateCameraCapture_Android
(
int
index
);
CvCapture
*
cvCreateCameraCapture_XIMEA
(
int
index
);
CvCapture
*
cvCreateCameraCapture_AVFoundation
(
int
index
);
CvCapture
*
cvCreateCameraCapture_IntelPerC
(
int
index
);
CVAPI
(
int
)
cvHaveImageReader
(
const
char
*
filename
);
CVAPI
(
int
)
cvHaveImageWriter
(
const
char
*
filename
);
...
...
@@ -198,6 +196,20 @@ double cvGetRatioWindow_GTK(const char* name);
double
cvGetOpenGlProp_W32
(
const
char
*
name
);
double
cvGetOpenGlProp_GTK
(
const
char
*
name
);
namespace
cv
{
class
IVideoCapture
{
public
:
virtual
~
IVideoCapture
()
{}
virtual
double
getProperty
(
int
)
{
return
0
;
}
virtual
bool
setProperty
(
int
,
double
)
{
return
0
;
}
virtual
bool
grabFrame
()
=
0
;
virtual
bool
retrieveFrame
(
int
,
cv
::
OutputArray
)
=
0
;
virtual
int
getCaptureDomain
()
{
return
CAP_ANY
;
}
// Return the type of the capture object: CAP_VFW, etc...
};
};
//for QT
#if defined (HAVE_QT)
double
cvGetModeWindow_QT
(
const
char
*
name
);
...
...
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