CvSink: Support grayscale images.

Also support 4-channel BGRx images and provide better error reporting
on bad images passed to PutFrame.
This commit is contained in:
Peter Johnson
2016-12-23 21:01:21 -08:00
parent 205d3b1d04
commit 4c8c41fdc0
11 changed files with 176 additions and 9 deletions

View File

@@ -67,6 +67,8 @@ static VideoMode::PixelFormat ToPixelFormat(__u32 pixelFormat) {
return VideoMode::kRGB565;
case V4L2_PIX_FMT_BGR24:
return VideoMode::kBGR;
case V4L2_PIX_FMT_GREY:
return VideoMode::kGray;
default:
return VideoMode::kUnknown;
}
@@ -83,6 +85,8 @@ static __u32 FromPixelFormat(VideoMode::PixelFormat pixelFormat) {
return V4L2_PIX_FMT_RGB565;
case VideoMode::kBGR:
return V4L2_PIX_FMT_BGR24;
case VideoMode::kGray:
return V4L2_PIX_FMT_GREY;
default:
return 0;
}