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
91a8ea5e
Commit
91a8ea5e
authored
Nov 05, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3387 from YusukeSuzuki:cap_v4l_rgb24fix
parents
7de4e049
9cd08c66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
cap_v4l.cpp
modules/videoio/src/cap_v4l.cpp
+24
-1
No files found.
modules/videoio/src/cap_v4l.cpp
View file @
91a8ea5e
...
...
@@ -294,7 +294,8 @@ enum PALETTE_TYPE {
PALETTE_SBGGR8
,
PALETTE_SN9C10X
,
PALETTE_MJPEG
,
PALETTE_SGBRG
PALETTE_SGBRG
,
PALETTE_RGB24
};
typedef
struct
CvCaptureCAM_V4L
...
...
@@ -587,6 +588,10 @@ static int autosetup_capture_mode_v4l2(CvCaptureCAM_V4L* capture)
if
(
try_palette_v4l2
(
capture
,
V4L2_PIX_FMT_SGBRG
)
==
0
)
{
capture
->
palette
=
PALETTE_SGBRG
;
}
else
if
(
try_palette_v4l2
(
capture
,
V4L2_PIX_FMT_RGB24
)
==
0
)
{
capture
->
palette
=
PALETTE_RGB24
;
}
else
{
...
...
@@ -1916,6 +1921,18 @@ static void sgbrg2rgb24(long int WIDTH, long int HEIGHT, unsigned char *src, uns
}
}
static
void
rgb24_to_rgb24
(
int
width
,
int
height
,
unsigned
char
*
src
,
unsigned
char
*
dst
)
{
const
int
size
=
width
*
height
;
for
(
int
i
=
0
;
i
<
size
;
++
i
,
src
+=
3
,
dst
+=
3
)
{
*
(
dst
+
0
)
=
*
(
src
+
2
);
*
(
dst
+
1
)
=
*
(
src
+
1
);
*
(
dst
+
2
)
=
*
(
src
+
0
);
}
}
#define CLAMP(x) ((x)<0?0:((x)>255)?255:(x))
typedef
struct
{
...
...
@@ -2219,6 +2236,12 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
(
unsigned
char
*
)
capture
->
buffers
[(
capture
->
bufferIndex
+
1
)
%
capture
->
req
.
count
].
start
,
(
unsigned
char
*
)
capture
->
frame
.
imageData
);
break
;
case
PALETTE_RGB24
:
rgb24_to_rgb24
(
capture
->
form
.
fmt
.
pix
.
width
,
capture
->
form
.
fmt
.
pix
.
height
,
(
unsigned
char
*
)
capture
->
buffers
[(
capture
->
bufferIndex
+
1
)
%
capture
->
req
.
count
].
start
,
(
unsigned
char
*
)
capture
->
frame
.
imageData
);
break
;
}
}
#endif
/* HAVE_CAMV4L2 */
...
...
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