Skip to content

Commit

Permalink
pixelformatsinfo: Changed Bayer format naming to be compatible with C…
Browse files Browse the repository at this point in the history
…I OpenCV version
  • Loading branch information
pkoscik authored and jbylicki committed Jan 22, 2024
1 parent dcae7bc commit f0994d8
Showing 1 changed file with 31 additions and 18 deletions.
49 changes: 31 additions & 18 deletions include/grabthecam/pixelformatsinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include "grabthecam/frameconverters/anyformat2bgrconverter.hpp"
#include "grabthecam/frameconverters/bayer2bgrconverter.hpp"
#include "grabthecam/frameconverters/yuv2bgrconverter.hpp"
#include "grabthecam/frameconverters/packedformats2rgbconverter.hpp"
#include "grabthecam/frameconverters/yuv2bgrconverter.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <map>
#include <linux/videodev2.h>
#include <map>

namespace grabthecam
{
Expand All @@ -33,28 +33,41 @@ static std::map<unsigned int, std::function<std::shared_ptr<FrameConverter>()>>
{V4L2_PIX_FMT_RGB24, [] { return std::make_shared<AnyFormat2BGRConverter>(cv::COLOR_RGB2BGR, CV_8UC3); }},
{V4L2_PIX_FMT_RGBA32, [] { return std::make_shared<AnyFormat2BGRConverter>(cv::COLOR_RGBA2BGR, CV_8UC4); }},
{V4L2_PIX_FMT_ABGR32, [] { return std::make_shared<AnyFormat2BGRConverter>(cv::COLOR_BGRA2BGR, CV_8UC4); }},
{V4L2_PIX_FMT_RGB332, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGB332, CV_8UC1); }},
{V4L2_PIX_FMT_RGB565, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGB565, CV_16UC1); }},
{V4L2_PIX_FMT_ARGB444, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ARGB444, CV_16UC1); }},
{V4L2_PIX_FMT_ABGR444, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ABGR444, CV_16UC1); }},
{V4L2_PIX_FMT_RGBA444, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGBA444, CV_16UC1); }},
{V4L2_PIX_FMT_BGRA444, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_BGRA444, CV_16UC1); }},
{V4L2_PIX_FMT_ARGB555, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ARGB555, CV_16UC1); }},
{V4L2_PIX_FMT_ABGR555, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ABGR555, CV_16UC1); }},
{V4L2_PIX_FMT_RGBA555, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGBA555, CV_16UC1); }},
{V4L2_PIX_FMT_BGRA555, [] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_BGRA555, CV_16UC1); }},
{V4L2_PIX_FMT_RGB332,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGB332, CV_8UC1); }},
{V4L2_PIX_FMT_RGB565,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGB565, CV_16UC1); }},
{V4L2_PIX_FMT_ARGB444,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ARGB444, CV_16UC1); }},
{V4L2_PIX_FMT_ABGR444,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ABGR444, CV_16UC1); }},
{V4L2_PIX_FMT_RGBA444,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGBA444, CV_16UC1); }},
{V4L2_PIX_FMT_BGRA444,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_BGRA444, CV_16UC1); }},
{V4L2_PIX_FMT_ARGB555,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ARGB555, CV_16UC1); }},
{V4L2_PIX_FMT_ABGR555,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_ABGR555, CV_16UC1); }},
{V4L2_PIX_FMT_RGBA555,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_RGBA555, CV_16UC1); }},
{V4L2_PIX_FMT_BGRA555,
[] { return std::make_shared<PackedFormats2RGBconverter>(grabthecam::PACKED_BGRA555, CV_16UC1); }},
{V4L2_PIX_FMT_YUYV, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_YUYV); }},
{V4L2_PIX_FMT_UYVY, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_UYVY); }},
{V4L2_PIX_FMT_YVYU, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_YVYU); }},
{V4L2_PIX_FMT_NV12, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_NV12, CV_8UC1); }},
{V4L2_PIX_FMT_NV21, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_NV21, CV_8UC1); }},
{V4L2_PIX_FMT_YVU420, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_YV12, CV_8UC1); }},
{V4L2_PIX_FMT_YUV420, [] { return std::make_shared<Yuv2BGRConverter>(cv::COLOR_YUV2BGR_I420, CV_8UC1); }},
{V4L2_PIX_FMT_SBGGR8, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerBGGR2BGR_EA, CV_8UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SGBRG8, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerGBRG2BGR_EA, CV_8UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SRGGB16, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRGGB2BGR_EA, CV_16UC1, CV_16UC3); }},
{V4L2_PIX_FMT_SRGGB8, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRGGB2BGR_EA, CV_8UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SRGGB10, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRGGB2BGR_EA, CV_16UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SRGGB12, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRGGB2BGR_EA, CV_16UC1, CV_8UC3); }}};
{V4L2_PIX_FMT_SBGGR8, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerBG2BGR, CV_8UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SGBRG8, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerGB2BGR, CV_8UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SRGGB16,
[] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRG2BGR, CV_16UC1, CV_16UC3); }},
{V4L2_PIX_FMT_SRGGB8, [] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRG2BGR, CV_8UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SRGGB10,
[] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRG2BGR, CV_16UC1, CV_8UC3); }},
{V4L2_PIX_FMT_SRGGB12,
[] { return std::make_shared<Bayer2BGRConverter>(cv::COLOR_BayerRG2BGR, CV_16UC1, CV_8UC3); }}};

}; // namespace grabthecam

0 comments on commit f0994d8

Please sign in to comment.