From 22dba048e1f275e9d1df4df8378efc3da70377f6 Mon Sep 17 00:00:00 2001 From: lxowalle Date: Thu, 19 Dec 2024 10:31:26 +0800 Subject: [PATCH] * to_format() support nv21 to grayscale --- components/vision/src/maix_image.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/vision/src/maix_image.cpp b/components/vision/src/maix_image.cpp index aff9e1c2..bef0fc23 100644 --- a/components/vision/src/maix_image.cpp +++ b/components/vision/src/maix_image.cpp @@ -876,6 +876,20 @@ namespace maix::image throw err::Exception(err::ERR_NOT_IMPL, "not support format"); } break; + case image::FMT_YVU420SP: + switch (format) + { + case image::FMT_GRAYSCALE: + { + auto img = new image::Image(_width, _height, image::FMT_GRAYSCALE); + memcpy(img->data(), _data, _width * _height); + return img; + } + break; + default: + throw err::Exception(err::ERR_NOT_IMPL, "not support format"); + } + break; default: throw err::Exception(err::ERR_NOT_IMPL, "not support format"); }