From df002263f3bb5e47a9fb911a91305189a51be959 Mon Sep 17 00:00:00 2001 From: lxowalle Date: Sat, 11 May 2024 10:24:23 +0800 Subject: [PATCH] fix to jpeg bug --- components/vision/include/maix_image.hpp | 2 +- components/vision/src/maix_image.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/vision/include/maix_image.hpp b/components/vision/include/maix_image.hpp index 12a761e8..0d68cc70 100644 --- a/components/vision/include/maix_image.hpp +++ b/components/vision/include/maix_image.hpp @@ -306,7 +306,7 @@ namespace maix::image * @param quality the quality of jpg, default is 95. range is (50, 100]. * @return new image object. Need be delete by caller in C++. * @throw err.Exception, if two images' format not support, **or already the format**, will raise exception - * @maixcdk maix.image.Image.to_jpeg + * @maixpy maix.image.Image.to_jpeg */ image::Image *to_jpeg(int quality = 95); diff --git a/components/vision/src/maix_image.cpp b/components/vision/src/maix_image.cpp index dfaf1012..81efdd03 100644 --- a/components/vision/src/maix_image.cpp +++ b/components/vision/src/maix_image.cpp @@ -400,7 +400,7 @@ namespace maix::image { #ifdef PLATFORM_MAIXCAM image::Image *img = nullptr; - if (!mmf_enc_jpg_push(0, (uint8_t *)_data, _width, _height, mmf_invert_format_to_mmf(image::FMT_YVU420SP))) { + if (!mmf_enc_jpg_push_with_quality(0, (uint8_t *)_data, _width, _height, mmf_invert_format_to_mmf(image::FMT_YVU420SP), 95)) { uint8_t *data; int data_size; if (!mmf_enc_jpg_pop(0, &data, &data_size)) { @@ -426,7 +426,7 @@ namespace maix::image p_img = this; } - if (!mmf_enc_jpg_push(0, (uint8_t *)p_img->data(), _width, _height, mmf_invert_format_to_mmf(image::FMT_RGB888))) { + if (!mmf_enc_jpg_push_with_quality(0, (uint8_t *)p_img->data(), _width, _height, mmf_invert_format_to_mmf(image::FMT_RGB888), 80)) { uint8_t *data; int data_size; if (!mmf_enc_jpg_pop(0, &data, &data_size)) {