Skip to content

Commit 6e1da2e

Browse files
authored
Merge pull request opencv#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
1 parent 1ec2ade commit 6e1da2e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

modules/imgcodecs/src/loadsave.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,9 @@ cvSaveImage( const char* filename, const CvArr* arr, const int* _params )
10651065
for( ; _params[i] > 0; i += 2 )
10661066
CV_Assert(static_cast<size_t>(i) < cv::CV_IO_MAX_IMAGE_PARAMS*2); // Limit number of params for security reasons
10671067
}
1068-
return cv::imwrite_(filename, cv::cvarrToMat(arr),
1068+
std::vector<cv::Mat> img_vec;
1069+
img_vec.push_back(cv::cvarrToMat(arr));
1070+
return cv::imwrite_(filename, img_vec,
10691071
i > 0 ? std::vector<int>(_params, _params+i) : std::vector<int>(),
10701072
CV_IS_IMAGE(arr) && ((const IplImage*)arr)->origin == IPL_ORIGIN_BL );
10711073
}

0 commit comments

Comments
 (0)