From 1b22783d4636a74512171d67b95e6482f73cd897 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Sun, 26 Jun 2016 16:39:19 +0300 Subject: [PATCH 1/2] Update grfmt_png.cpp --- modules/imgcodecs/src/grfmt_png.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/imgcodecs/src/grfmt_png.cpp b/modules/imgcodecs/src/grfmt_png.cpp index d5d175f89e..e672e0cc96 100644 --- a/modules/imgcodecs/src/grfmt_png.cpp +++ b/modules/imgcodecs/src/grfmt_png.cpp @@ -370,22 +370,23 @@ bool PngEncoder::write( const Mat& img, const std::vector& params ) } int compression_level = -1; // Invalid value to allow setting 0-9 as valid - int compression_strategy = Z_RLE; // Default strategy + int compression_strategy = IMWRITE_PNG_STRATEGY_RLE; // Default strategy bool isBilevel = false; for( size_t i = 0; i < params.size(); i += 2 ) { - if( params[i] == CV_IMWRITE_PNG_COMPRESSION ) + if( params[i] == IMWRITE_PNG_COMPRESSION ) { + compression_strategy = IMWRITE_PNG_STRATEGY_DEFAULT; // Default strategy compression_level = params[i+1]; compression_level = MIN(MAX(compression_level, 0), Z_BEST_COMPRESSION); } - if( params[i] == CV_IMWRITE_PNG_STRATEGY ) + if( params[i] == IMWRITE_PNG_STRATEGY ) { compression_strategy = params[i+1]; compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED); } - if( params[i] == CV_IMWRITE_PNG_BILEVEL ) + if( params[i] == IMWRITE_PNG_BILEVEL ) { isBilevel = params[i+1] != 0; } From e7ec58031889f68d12ab956b726dbd748046d377 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Mon, 27 Jun 2016 16:38:47 +0300 Subject: [PATCH 2/2] Update imgcodecs.hpp --- modules/imgcodecs/include/opencv2/imgcodecs.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgcodecs/include/opencv2/imgcodecs.hpp b/modules/imgcodecs/include/opencv2/imgcodecs.hpp index ac0fd24ee9..ce827a7e0f 100644 --- a/modules/imgcodecs/include/opencv2/imgcodecs.hpp +++ b/modules/imgcodecs/include/opencv2/imgcodecs.hpp @@ -84,7 +84,7 @@ enum ImwriteFlags { IMWRITE_JPEG_RST_INTERVAL = 4, //!< JPEG restart interval, 0 - 65535, default is 0 - no restart. IMWRITE_JPEG_LUMA_QUALITY = 5, //!< Separate luma quality level, 0 - 100, default is 0 - don't use. IMWRITE_JPEG_CHROMA_QUALITY = 6, //!< Separate chroma quality level, 0 - 100, default is 0 - don't use. - IMWRITE_PNG_COMPRESSION = 16, //!< For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3. + IMWRITE_PNG_COMPRESSION = 16, //!< For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3. Also strategy is changed to IMWRITE_PNG_STRATEGY_DEFAULT (Z_DEFAULT_STRATEGY). IMWRITE_PNG_STRATEGY = 17, //!< One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_DEFAULT. IMWRITE_PNG_BILEVEL = 18, //!< Binary level PNG, 0 or 1, default is 0. IMWRITE_PXM_BINARY = 32, //!< For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.