Merge pull request #19203 from zchrissirhcz:fix-cvSaveImage

Fix cvSaveImage( ) function bug

* fix cvSaveImage crash

* replace emplace_back with {}, no C++11 required

* fix MacOSX build with vector's push_back
pull/19217/head^2
Zhuo Zhang 4 years ago committed by GitHub
parent 1ec2ade65b
commit 6e1da2ef91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      modules/imgcodecs/src/loadsave.cpp

@ -1065,7 +1065,9 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
for( ; _params[i] > 0; i += 2 )
CV_Assert(static_cast<size_t>(i) < cv::CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
}
return cv::imwrite_(filename, cv::cvarrToMat(arr),
std::vector<cv::Mat> img_vec;
img_vec.push_back(cv::cvarrToMat(arr));
return cv::imwrite_(filename, img_vec,
i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL );
}

Loading…
Cancel
Save