Skip to content

Commit

Permalink
* to_format() support nv21 to grayscale
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Dec 19, 2024
1 parent 618d1df commit 22dba04
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions components/vision/src/maix_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 22dba04

Please sign in to comment.