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