From cd0a6befd61cb878dc8e5ea62c0ec526c8cd71fc Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 9 Mar 2025 14:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 82d7b6cb..fa7101e5 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -3594,8 +3594,17 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat) #endif #endif // OUTPUT_DBG_INFO + bool imgExisted = std::filesystem::exists(std::filesystem::path(fullPath)); + if (imgExisted) + { + size_t imgFileSize = getFileSize(fullPath); + if (imgFileSize == 0 || imgFileSize == (size_t)-1) + { + imgExisted = false; + } + } - if (!std::filesystem::exists(std::filesystem::path(fullPath)) || getFileSize(fullPath) == 0) + if (!imgExisted) { bool res = cv::imwrite(fullPath.c_str(), mat, params); if (!res) @@ -3854,7 +3863,16 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector