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
f715e5b0
Commit
f715e5b0
authored
Mar 17, 2016
by
Josh Lubawy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for YUV 4:2:0 NV12 frame format in VFW camera capture
parent
1cd3c6f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
cap_vfw.cpp
modules/videoio/src/cap_vfw.cpp
+13
-2
No files found.
modules/videoio/src/cap_vfw.cpp
View file @
f715e5b0
...
@@ -43,6 +43,8 @@
...
@@ -43,6 +43,8 @@
#include <vfw.h>
#include <vfw.h>
#include <cstdio>
#ifdef __GNUC__
#ifdef __GNUC__
#define WM_CAP_FIRSTA (WM_USER)
#define WM_CAP_FIRSTA (WM_USER)
#define capSendMessage(hwnd,m,w,l) (IsWindow(hwnd)?SendMessage(hwnd,m,w,l):0)
#define capSendMessage(hwnd,m,w,l) (IsWindow(hwnd)?SendMessage(hwnd,m,w,l):0)
...
@@ -498,8 +500,17 @@ IplImage* CvCaptureCAM_VFW::retrieveFrame(int)
...
@@ -498,8 +500,17 @@ IplImage* CvCaptureCAM_VFW::retrieveFrame(int)
frame
=
cvCreateImage
(
cvSize
(
vfmt0
.
biWidth
,
vfmt0
.
biHeight
),
8
,
3
);
frame
=
cvCreateImage
(
cvSize
(
vfmt0
.
biWidth
,
vfmt0
.
biHeight
),
8
,
3
);
}
}
if
(
vfmt0
.
biCompression
!=
BI_RGB
||
if
(
vfmt0
.
biCompression
==
MAKEFOURCC
(
'N'
,
'V'
,
'1'
,
'2'
)
)
vfmt0
.
biBitCount
!=
24
)
{
// Frame is in YUV 4:2:0 NV12 format, convert to BGR color space
// See https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx#nv12)
IplImage
src
;
cvInitImageHeader
(
&
src
,
cvSize
(
vfmt0
.
biWidth
,
vfmt0
.
biHeight
*
3
/
2
),
IPL_DEPTH_8U
,
1
,
IPL_ORIGIN_BL
,
4
);
cvSetData
(
&
src
,
hdr
->
lpData
,
src
.
widthStep
);
cvCvtColor
(
&
src
,
frame
,
CV_YUV2BGR_NV12
);
}
else
if
(
vfmt0
.
biCompression
!=
BI_RGB
||
vfmt0
.
biBitCount
!=
24
)
{
{
BITMAPINFOHEADER
vfmt1
=
icvBitmapHeader
(
vfmt0
.
biWidth
,
vfmt0
.
biHeight
,
24
);
BITMAPINFOHEADER
vfmt1
=
icvBitmapHeader
(
vfmt0
.
biWidth
,
vfmt0
.
biHeight
,
24
);
...
...
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