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
aa2ca3aa
Commit
aa2ca3aa
authored
Jul 08, 2013
by
Andrew Senin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve FPS on black and white Ximea cameras
parent
1a245888
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
11 deletions
+34
-11
cap_ximea.cpp
modules/highgui/src/cap_ximea.cpp
+34
-11
No files found.
modules/highgui/src/cap_ximea.cpp
View file @
aa2ca3aa
...
...
@@ -52,6 +52,8 @@ void CvCaptureCAM_XIMEA::init()
{
xiGetNumberDevices
(
&
numDevices
);
hmv
=
NULL
;
frame
=
NULL
;
timeout
=
0
;
memset
(
&
image
,
0
,
sizeof
(
XI_IMG
));
}
...
...
@@ -60,6 +62,8 @@ 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
)
...
...
@@ -73,26 +77,42 @@ bool CvCaptureCAM_XIMEA::open( int wIndex )
// always use auto exposure/gain
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AEAG
,
1
);
if
(
mvret
!=
XI_OK
)
goto
error
;
// always use auto white ballance
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AUTO_WB
,
1
);
if
(
mvret
!=
XI_OK
)
goto
error
;
// default image format RGB24
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_RGB24
);
if
(
mvret
!=
XI_OK
)
goto
error
;
HandleXiResult
(
mvret
);
int
width
=
0
;
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_WIDTH
,
&
width
);
if
(
mvret
!=
XI_OK
)
goto
error
;
HandleXiResult
(
mvret
)
;
int
height
=
0
;
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_HEIGHT
,
&
height
);
if
(
mvret
!=
XI_OK
)
goto
error
;
HandleXiResult
(
mvret
);
int
isColor
=
0
;
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_IMAGE_IS_COLOR
,
&
isColor
);
HandleXiResult
(
mvret
);
if
(
isColor
)
// for color cameras
{
// default image format RGB24
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_RGB24
);
HandleXiResult
(
mvret
);
// always use auto white ballance for color cameras
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AUTO_WB
,
1
);
HandleXiResult
(
mvret
);
// allocate frame buffer for RGB24 image
frame
=
cvCreateImage
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
3
);
}
else
// for mono cameras
{
// default image format MONO8
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_MONO8
);
HandleXiResult
(
mvret
);
// allocate frame buffer for MONO8 image
frame
=
cvCreateImage
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
1
);
}
//default capture timeout 10s
timeout
=
10000
;
...
...
@@ -119,8 +139,11 @@ void CvCaptureCAM_XIMEA::close()
if
(
frame
)
cvReleaseImage
(
&
frame
);
if
(
hmv
)
{
xiStopAcquisition
(
hmv
);
xiCloseDevice
(
hmv
);
}
hmv
=
NULL
;
}
...
...
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