|
|
e54cd7 |
From 6e1da2ef91907678159d40f600a56094c4d196b9 Mon Sep 17 00:00:00 2001
|
|
|
e54cd7 |
From: Zhuo Zhang <zchrissirhcz@gmail.com>
|
|
|
e54cd7 |
Date: Fri, 25 Dec 2020 00:58:16 +0800
|
|
|
e54cd7 |
Subject: [PATCH] Merge pull request #19203 from zchrissirhcz:fix-cvSaveImage
|
|
|
e54cd7 |
|
|
|
e54cd7 |
Fix cvSaveImage( ) function bug
|
|
|
e54cd7 |
|
|
|
e54cd7 |
* fix cvSaveImage crash
|
|
|
e54cd7 |
|
|
|
e54cd7 |
* replace emplace_back with {}, no C++11 required
|
|
|
e54cd7 |
|
|
|
e54cd7 |
* fix MacOSX build with vector's push_back
|
|
|
e54cd7 |
---
|
|
|
e54cd7 |
modules/imgcodecs/src/loadsave.cpp | 4 +++-
|
|
|
e54cd7 |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
e54cd7 |
|
|
|
e54cd7 |
diff --git a/modules/imgcodecs/src/loadsave.cpp b/modules/imgcodecs/src/loadsave.cpp
|
|
|
e54cd7 |
index 4e626cd2165b..44c458c7273c 100644
|
|
|
e54cd7 |
--- a/modules/imgcodecs/src/loadsave.cpp
|
|
|
e54cd7 |
+++ b/modules/imgcodecs/src/loadsave.cpp
|
|
|
e54cd7 |
@@ -1001,7 +1001,9 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
|
|
|
e54cd7 |
for( ; _params[i] > 0; i += 2 )
|
|
|
e54cd7 |
CV_Assert(static_cast<size_t>(i) < cv::CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
|
|
|
e54cd7 |
}
|
|
|
e54cd7 |
- return cv::imwrite_(filename, cv::cvarrToMat(arr),
|
|
|
e54cd7 |
+ std::vector<cv::Mat> img_vec;
|
|
|
e54cd7 |
+ img_vec.push_back(cv::cvarrToMat(arr));
|
|
|
e54cd7 |
+ return cv::imwrite_(filename, img_vec,
|
|
|
e54cd7 |
i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
|
|
|
e54cd7 |
CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL );
|
|
|
e54cd7 |
}
|