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
17888ce0
Commit
17888ce0
authored
Jun 27, 2018
by
Florian Echtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for 8-bit greyscale format
parent
051b40f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
cap_v4l.cpp
modules/videoio/src/cap_v4l.cpp
+22
-1
No files found.
modules/videoio/src/cap_v4l.cpp
View file @
17888ce0
...
@@ -440,7 +440,8 @@ static int autosetup_capture_mode_v4l2(CvCaptureCAM_V4L* capture) {
...
@@ -440,7 +440,8 @@ static int autosetup_capture_mode_v4l2(CvCaptureCAM_V4L* capture) {
V4L2_PIX_FMT_MJPEG
,
V4L2_PIX_FMT_MJPEG
,
V4L2_PIX_FMT_JPEG
,
V4L2_PIX_FMT_JPEG
,
#endif
#endif
V4L2_PIX_FMT_Y16
V4L2_PIX_FMT_Y16
,
V4L2_PIX_FMT_GREY
};
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
try_order
)
/
sizeof
(
__u32
);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
try_order
)
/
sizeof
(
__u32
);
i
++
)
{
...
@@ -533,6 +534,7 @@ static int v4l2_num_channels(__u32 palette) {
...
@@ -533,6 +534,7 @@ static int v4l2_num_channels(__u32 palette) {
case
V4L2_PIX_FMT_MJPEG
:
case
V4L2_PIX_FMT_MJPEG
:
case
V4L2_PIX_FMT_JPEG
:
case
V4L2_PIX_FMT_JPEG
:
case
V4L2_PIX_FMT_Y16
:
case
V4L2_PIX_FMT_Y16
:
case
V4L2_PIX_FMT_GREY
:
return
1
;
return
1
;
case
V4L2_PIX_FMT_YUYV
:
case
V4L2_PIX_FMT_YUYV
:
case
V4L2_PIX_FMT_UYVY
:
case
V4L2_PIX_FMT_UYVY
:
...
@@ -1091,6 +1093,13 @@ y16_to_rgb24 (int width, int height, unsigned char* src, unsigned char* dst)
...
@@ -1091,6 +1093,13 @@ y16_to_rgb24 (int width, int height, unsigned char* src, unsigned char* dst)
cvtColor
(
gray8
,
Mat
(
height
,
width
,
CV_8UC3
,
dst
),
COLOR_GRAY2BGR
);
cvtColor
(
gray8
,
Mat
(
height
,
width
,
CV_8UC3
,
dst
),
COLOR_GRAY2BGR
);
}
}
static
inline
void
y8_to_rgb24
(
int
width
,
int
height
,
unsigned
char
*
src
,
unsigned
char
*
dst
)
{
Mat
gray8
(
height
,
width
,
CV_8UC1
,
src
);
cvtColor
(
gray8
,
Mat
(
height
,
width
,
CV_8UC3
,
dst
),
COLOR_GRAY2BGR
);
}
#ifdef HAVE_JPEG
#ifdef HAVE_JPEG
/* convert from mjpeg to rgb24 */
/* convert from mjpeg to rgb24 */
...
@@ -1560,6 +1569,18 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
...
@@ -1560,6 +1569,18 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
capture
->
frame
.
imageSize
);
capture
->
frame
.
imageSize
);
}
}
break
;
break
;
case
V4L2_PIX_FMT_GREY
:
if
(
capture
->
convert_rgb
){
y8_to_rgb24
(
capture
->
form
.
fmt
.
pix
.
width
,
capture
->
form
.
fmt
.
pix
.
height
,
(
unsigned
char
*
)
capture
->
buffers
[
capture
->
bufferIndex
].
start
,
(
unsigned
char
*
)
capture
->
frame
.
imageData
);
}
else
{
memcpy
((
char
*
)
capture
->
frame
.
imageData
,
(
char
*
)
capture
->
buffers
[
capture
->
bufferIndex
].
start
,
capture
->
frame
.
imageSize
);
}
break
;
}
}
if
(
capture
->
returnFrame
)
if
(
capture
->
returnFrame
)
...
...
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