Commit 1b22783d authored by Suleyman TURKMEN's avatar Suleyman TURKMEN

Update grfmt_png.cpp

parent 0e436c3f
...@@ -370,22 +370,23 @@ bool PngEncoder::write( const Mat& img, const std::vector<int>& params ) ...@@ -370,22 +370,23 @@ bool PngEncoder::write( const Mat& img, const std::vector<int>& params )
} }
int compression_level = -1; // Invalid value to allow setting 0-9 as valid 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; bool isBilevel = false;
for( size_t i = 0; i < params.size(); i += 2 ) 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 = params[i+1];
compression_level = MIN(MAX(compression_level, 0), Z_BEST_COMPRESSION); 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 = params[i+1];
compression_strategy = MIN(MAX(compression_strategy, 0), Z_FIXED); 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; isBilevel = params[i+1] != 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment