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
01acb08c
Commit
01acb08c
authored
7 years ago
by
Pavel Rojtberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
videoio: ximea - allow opening capture by serial number
parent
1d4a29f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
cap.cpp
modules/videoio/src/cap.cpp
+5
-1
cap_ximea.cpp
modules/videoio/src/cap_ximea.cpp
+36
-5
precomp.hpp
modules/videoio/src/precomp.hpp
+1
-0
No files found.
modules/videoio/src/cap.cpp
View file @
01acb08c
...
...
@@ -354,7 +354,11 @@ CV_IMPL CvCapture * cvCreateFileCaptureWithPreference (const char * filename, in
TRY_OPEN
(
result
,
cvCreateFileCapture_OpenNI2
(
filename
))
if
(
apiPreference
)
break
;
#endif
#ifdef HAVE_XIMEA
case
CAP_XIAPI
:
TRY_OPEN
(
result
,
cvCreateCameraCapture_XIMEA
(
filename
))
if
(
apiPreference
)
break
;
#endif
case
CAP_IMAGES
:
TRY_OPEN
(
result
,
cvCreateFileCapture_Images
(
filename
))
}
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/src/cap_ximea.cpp
View file @
01acb08c
...
...
@@ -18,6 +18,7 @@ public:
virtual
~
CvCaptureCAM_XIMEA
()
{
close
();
}
virtual
bool
open
(
int
index
);
bool
open
(
const
char
*
deviceName
);
virtual
void
close
();
virtual
double
getProperty
(
int
)
const
;
virtual
bool
setProperty
(
int
,
double
);
...
...
@@ -26,6 +27,7 @@ public:
virtual
int
getCaptureDomain
()
{
return
CV_CAP_XIAPI
;
}
// Return the type of the capture object: CV_CAP_VFW, etc...
private
:
bool
_open
();
void
init
();
void
errMsg
(
const
char
*
msg
,
int
errNum
)
const
;
void
resetCvImage
();
...
...
@@ -51,6 +53,17 @@ CvCapture* cvCreateCameraCapture_XIMEA( int index )
return
0
;
}
CvCapture
*
cvCreateCameraCapture_XIMEA
(
const
char
*
serialNumber
)
{
CvCaptureCAM_XIMEA
*
capture
=
new
CvCaptureCAM_XIMEA
;
if
(
capture
->
open
(
serialNumber
))
return
capture
;
delete
capture
;
return
0
;
}
/**********************************************************************************/
// Enumerate connected devices
void
CvCaptureCAM_XIMEA
::
init
()
...
...
@@ -75,13 +88,10 @@ void CvCaptureCAM_XIMEA::init()
// Initialize camera input
bool
CvCaptureCAM_XIMEA
::
open
(
int
wIndex
)
{
#define HandleXiResult(res) if (res!=XI_OK) goto error;
int
mvret
=
XI_OK
;
if
(
numDevices
==
0
)
return
false
;
int
mvret
=
XI_OK
;
if
((
mvret
=
xiOpenDevice
(
wIndex
,
&
hmv
))
!=
XI_OK
)
{
#if defined _WIN32
...
...
@@ -97,12 +107,33 @@ bool CvCaptureCAM_XIMEA::open( int wIndex )
#endif
}
return
_open
();
}
bool
CvCaptureCAM_XIMEA
::
open
(
const
char
*
serialNumber
)
{
if
(
numDevices
==
0
)
return
false
;
int
mvret
=
XI_OK
;
if
((
mvret
=
xiOpenDeviceBy
(
XI_OPEN_BY_SN
,
serialNumber
,
&
hmv
))
!=
XI_OK
)
{
errMsg
(
"Open XI_DEVICE failed"
,
mvret
);
return
false
;
}
return
_open
();
}
bool
CvCaptureCAM_XIMEA
::
_open
()
{
#define HandleXiResult(res) if (res!=XI_OK) goto error;
int
width
=
0
;
int
height
=
0
;
int
isColor
=
0
;
// always use auto exposure/gain
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AEAG
,
1
);
int
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AEAG
,
1
);
HandleXiResult
(
mvret
);
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_WIDTH
,
&
width
);
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/src/precomp.hpp
View file @
01acb08c
...
...
@@ -126,6 +126,7 @@ CvCapture* cvCreateFileCapture_OpenNI( const char* filename );
CvCapture
*
cvCreateFileCapture_OpenNI2
(
const
char
*
filename
);
CvCapture
*
cvCreateCameraCapture_Android
(
int
index
);
CvCapture
*
cvCreateCameraCapture_XIMEA
(
int
index
);
CvCapture
*
cvCreateCameraCapture_XIMEA
(
const
char
*
serialNumber
);
CvCapture
*
cvCreateCameraCapture_AVFoundation
(
int
index
);
CvCapture
*
cvCreateCameraCapture_Aravis
(
int
index
);
...
...
This diff is collapsed.
Click to expand it.
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