From bf939b8c962c0f4cf3018e87a7bd731c907f1910 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 28 Feb 2024 17:52:40 +0800 Subject: [PATCH] =?UTF-8?q?JPG/PNG=E5=8E=8B=E7=BC=A9=E5=89=8D=E5=85=88?= =?UTF-8?q?=E7=BA=B5=E5=90=91=E7=BF=BB=E8=BD=AC=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imgproc/algs/image_encoder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/imgproc/algs/image_encoder.cpp b/imgproc/algs/image_encoder.cpp index a918bde..2199d78 100644 --- a/imgproc/algs/image_encoder.cpp +++ b/imgproc/algs/image_encoder.cpp @@ -99,9 +99,12 @@ std::shared_ptr> img_encoder::encode(LPPACKIMAGE head, cv::Ma } else { + cv::Mat out; + + cv::flip(mat, out, 0); ptr.reset(new std::vector()); head->format = fmt_ == ".jpg" ? IMG_FMT_JPEG : IMG_FMT_PNG; - cv::imencode(fmt_.c_str(), mat, *ptr, param_); + cv::imencode(fmt_.c_str(), out, *ptr, param_); head->prc_time = watch.elapse_ms(); printf("encode to '%s' in %ums: %u\n", fmt_.c_str(), head->prc_time, ptr->size()); }