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
93120775
Commit
93120775
authored
Nov 11, 2013
by
Philippe FOUBERT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using four spaces for indentation.
parent
05d93757
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
65 deletions
+65
-65
cap_ximea.cpp
modules/highgui/src/cap_ximea.cpp
+65
-65
No files found.
modules/highgui/src/cap_ximea.cpp
View file @
93120775
...
...
@@ -67,88 +67,88 @@ bool CvCaptureCAM_XIMEA::open( int wIndex )
if
(
0
==
numDevices
)
{
res
=
false
;
res
=
false
;
}
else
if
(
XI_OK
!=
(
mvret
=
xiOpenDevice
(
wIndex
,
&
hmv
)))
{
errMsg
(
"Open XI_DEVICE failed"
,
mvret
);
res
=
false
;
errMsg
(
"Open XI_DEVICE failed"
,
mvret
);
res
=
false
;
}
else
{
int
width
=
0
;
int
height
=
0
;
int
isColor
=
0
;
int
width
=
0
;
int
height
=
0
;
int
isColor
=
0
;
// always use auto exposure/gain
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AEAG
,
1
)))
{
res
=
false
;
}
else
if
(
XI_OK
!=
(
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_WIDTH
,
&
width
)))
{
res
=
false
;
}
else
if
(
XI_OK
!=
(
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_HEIGHT
,
&
height
)))
{
res
=
false
;
}
else
if
(
XI_OK
!=
(
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_IMAGE_IS_COLOR
,
&
isColor
)))
{
res
=
false
;
}
else
{
if
(
isColor
)
// for color cameras
// always use auto exposure/gain
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AEAG
,
1
)))
{
// default image format RGB24
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_RGB24
)))
{
res
=
false
;
}
// always use auto white ballance for color cameras
else
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AUTO_WB
,
1
)))
{
}
else
if
(
XI_OK
!=
(
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_WIDTH
,
&
width
)))
{
res
=
false
;
}
else
{
// allocate frame buffer for RGB24 image
frame
=
cvCreateImage
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
3
);
}
}
else
// for mono cameras
else
if
(
XI_OK
!=
(
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_HEIGHT
,
&
height
)))
{
// default image format MONO8
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_MONO8
)))
{
res
=
false
;
}
else
{
// allocate frame buffer for MONO8 image
frame
=
cvCreateImage
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
1
);
}
}
}
if
(
true
==
res
)
{
//default capture timeout 10s
timeout
=
10000
;
else
if
(
XI_OK
!=
(
mvret
=
xiGetParamInt
(
hmv
,
XI_PRM_IMAGE_IS_COLOR
,
&
isColor
)))
{
res
=
false
;
}
else
{
if
(
isColor
)
// for color cameras
{
// default image format RGB24
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_RGB24
)))
{
res
=
false
;
}
// always use auto white ballance for color cameras
else
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_AUTO_WB
,
1
)))
{
res
=
false
;
}
else
{
// allocate frame buffer for RGB24 image
frame
=
cvCreateImage
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
3
);
}
}
else
// for mono cameras
{
// default image format MONO8
if
(
XI_OK
!=
(
mvret
=
xiSetParamInt
(
hmv
,
XI_PRM_IMAGE_DATA_FORMAT
,
XI_MONO8
)))
{
res
=
false
;
}
else
{
// allocate frame buffer for MONO8 image
frame
=
cvCreateImage
(
cvSize
(
width
,
height
),
IPL_DEPTH_8U
,
1
);
}
}
}
if
(
XI_OK
!=
(
mvret
=
xiStartAcquisition
(
hmv
))
)
if
(
true
==
res
)
{
errMsg
(
"StartAcquisition XI_DEVICE failed"
,
mvret
);
res
=
false
;
//default capture timeout 10s
timeout
=
10000
;
if
(
XI_OK
!=
(
mvret
=
xiStartAcquisition
(
hmv
)))
{
errMsg
(
"StartAcquisition XI_DEVICE failed"
,
mvret
);
res
=
false
;
}
}
else
{
errMsg
(
"Open XI_DEVICE failed"
,
mvret
);
xiCloseDevice
(
hmv
);
hmv
=
NULL
;
}
}
else
{
errMsg
(
"Open XI_DEVICE failed"
,
mvret
);
xiCloseDevice
(
hmv
);
hmv
=
NULL
;
}
}
return
true
;
}
...
...
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