add bgr888
This commit is contained in:
@@ -45,8 +45,10 @@ cv::Mat frame2mat(const std::shared_ptr<device::Frame> &frame) {
|
||||
cv::Mat img(frame->height(), frame->width(), CV_8UC2, frame->data());
|
||||
cv::cvtColor(img, img, cv::COLOR_YUV2BGR_YUY2);
|
||||
return img;
|
||||
} else if (frame->format() == Format::RGB888) {
|
||||
return cv::Mat(frame->height(), frame->width(), CV_8UC3, frame->data());
|
||||
} else if (frame->format() == Format::BGR888) {
|
||||
cv::Mat img(frame->height(), frame->width(), CV_8UC3, frame->data());
|
||||
cv::cvtColor(img, img, CV_BGRA2RGBA);
|
||||
return img;
|
||||
} else {
|
||||
return cv::Mat(frame->height(), frame->width(), CV_8UC1, frame->data());
|
||||
}
|
||||
|
||||
@@ -33,17 +33,19 @@ const std::map<Model, std::map<Capabilities, StreamRequests>>
|
||||
{Model::STANDARD,
|
||||
{{Capabilities::STEREO, {{480, 752, Format::YUYV, 25}}},
|
||||
{Capabilities::STEREO_COLOR,
|
||||
{{1280, 400, Format::YUYV, 20},
|
||||
{1280, 400, Format::YUYV, 30},
|
||||
{1280, 400, Format::YUYV, 60},
|
||||
{2560, 800, Format::YUYV, 10},
|
||||
{2560, 800, Format::YUYV, 20},
|
||||
{2560, 800, Format::YUYV, 30},
|
||||
{1280, 400, Format::RGB888, 20},
|
||||
{1280, 400, Format::RGB888, 30},
|
||||
{1280, 400, Format::RGB888, 60},
|
||||
{2560, 800, Format::RGB888, 10},
|
||||
{2560, 800, Format::RGB888, 20},
|
||||
{2560, 800, Format::RGB888, 30}}}}}};
|
||||
{// {1280, 400, Format::YUYV, 10},
|
||||
// {1280, 400, Format::YUYV, 20},
|
||||
// {1280, 400, Format::YUYV, 30},
|
||||
// {1280, 400, Format::YUYV, 60},
|
||||
// {2560, 800, Format::YUYV, 10},
|
||||
// {2560, 800, Format::YUYV, 20},
|
||||
// {2560, 800, Format::YUYV, 30},
|
||||
{1280, 400, Format::BGR888, 10},
|
||||
{1280, 400, Format::BGR888, 20},
|
||||
{1280, 400, Format::BGR888, 30},
|
||||
{1280, 400, Format::BGR888, 60},
|
||||
{2560, 800, Format::BGR888, 10},
|
||||
{2560, 800, Format::BGR888, 20},
|
||||
{2560, 800, Format::BGR888, 30}}}}}};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
||||
@@ -79,7 +79,7 @@ bool unpack_left_img_pixels(
|
||||
CHECK_NOTNULL(frame);
|
||||
CHECK_EQ(request.format, frame->format());
|
||||
auto data_new = reinterpret_cast<const std::uint8_t *>(data);
|
||||
if (request.format == Format::YUYV || request.format == Format::RGB888) {
|
||||
if (request.format == Format::YUYV || request.format == Format::BGR888) {
|
||||
std::size_t n = request.format == Format::YUYV ? 2 : 3;
|
||||
std::size_t w = frame->width() * n;
|
||||
std::size_t h = frame->height();
|
||||
@@ -105,7 +105,7 @@ bool unpack_right_img_pixels(
|
||||
CHECK_NOTNULL(frame);
|
||||
CHECK_EQ(request.format, frame->format());
|
||||
auto data_new = reinterpret_cast<const std::uint8_t *>(data);
|
||||
if (request.format == Format::YUYV || request.format == Format::RGB888) {
|
||||
if (request.format == Format::YUYV || request.format == Format::BGR888) {
|
||||
std::size_t n = request.format == Format::YUYV ? 2 : 3;
|
||||
std::size_t w = frame->width() * n;
|
||||
std::size_t h = frame->height();
|
||||
|
||||
@@ -167,7 +167,7 @@ std::size_t bytes_per_pixel(const Format &value) {
|
||||
return 1;
|
||||
case Format::YUYV:
|
||||
return 2;
|
||||
case Format::RGB888:
|
||||
case Format::BGR888:
|
||||
return 3;
|
||||
default:
|
||||
LOG(FATAL) << "Unknown format";
|
||||
|
||||
Reference in New Issue
Block a user