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
469ec7c5
Commit
469ec7c5
authored
Jul 11, 2012
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed vfw (#2156)
parent
bc3fb347
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
cap_vfw.cpp
modules/highgui/src/cap_vfw.cpp
+23
-3
No files found.
modules/highgui/src/cap_vfw.cpp
View file @
469ec7c5
...
...
@@ -182,6 +182,12 @@ bool CvCaptureAVI_VFW::open( const char* filename )
getframe
=
AVIStreamGetFrameOpen
(
avistream
,
&
bmihdr
);
if
(
getframe
!=
0
)
return
true
;
// Attempt to open as 8-bit AVI.
bmihdr
=
icvBitmapHeader
(
size
.
width
,
size
.
height
,
8
);
getframe
=
AVIStreamGetFrameOpen
(
avistream
,
&
bmihdr
);
if
(
getframe
!=
0
)
return
true
;
}
}
}
...
...
@@ -201,14 +207,28 @@ IplImage* CvCaptureAVI_VFW::retrieveFrame(int)
{
if
(
avistream
&&
bmih
)
{
bool
isColor
=
bmih
->
biBitCount
==
24
;
int
nChannels
=
(
isColor
)
?
3
:
1
;
IplImage
src
;
cvInitImageHeader
(
&
src
,
cvSize
(
bmih
->
biWidth
,
bmih
->
biHeight
),
IPL_DEPTH_8U
,
3
,
IPL_ORIGIN_BL
,
4
);
cvSetData
(
&
src
,
(
char
*
)(
bmih
+
1
),
src
.
widthStep
);
IPL_DEPTH_8U
,
nChannels
,
IPL_ORIGIN_BL
,
4
);
char
*
dataPtr
=
(
char
*
)(
bmih
+
1
);
// Only account for the color map size if we are an 8-bit image and the color map is used
if
(
!
isColor
)
{
static
int
RGBQUAD_SIZE_PER_BYTE
=
sizeof
(
RGBQUAD
)
/
sizeof
(
BYTE
);
int
offsetFromColormapToData
=
(
int
)
bmih
->
biClrUsed
*
RGBQUAD_SIZE_PER_BYTE
;
dataPtr
+=
offsetFromColormapToData
;
}
cvSetData
(
&
src
,
dataPtr
,
src
.
widthStep
);
if
(
!
frame
||
frame
->
width
!=
src
.
width
||
frame
->
height
!=
src
.
height
)
{
cvReleaseImage
(
&
frame
);
frame
=
cvCreateImage
(
cvGetSize
(
&
src
),
8
,
3
);
frame
=
cvCreateImage
(
cvGetSize
(
&
src
),
8
,
nChannels
);
}
cvFlip
(
&
src
,
frame
,
0
);
...
...
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