mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge branch 'master' into better_png_transparency
* master: (468 commits) added suppression for TBB valgrind issue update CUDA architecture flags initialization increase minimal supported CUDA toolkit to 6.5 check the CPU flag correctly opencv_visualization: check cmdline args provide better error messages stop search of markers in Exif reader to prevent infinite loop Fix calibration fail on python with CALIB_THIN_PRISM_MODEL flag clarify CUDA arithm operations usage with mask fixed empty image condition in resize fixed memory leak in flann tests fisheye: add CALIB_FIX_PRINCIPAL_POINT get/put: more type-safety and code unification using templates py_tutorials: fix cv2.findContours return val imgproc: speed up threshold of 64F version using NEON and SSE * use NEON under aarch64 only * check 64F version correctly bigdata: add test, resolve split/merge issue Improved Carotene library linear resize evaluation precision and enabled it as HAL implementation. persistence: fixing crash with space-only values Removed unnecessary check for Android API level and unused flags. Fix for median blur of 2-channel images ...
This commit is contained in:
@@ -231,8 +231,6 @@ bool PngDecoder::readData( Mat& img )
|
||||
AutoBuffer<uchar*> _buffer(m_height);
|
||||
uchar** buffer = _buffer;
|
||||
int color = img.channels() > 2;
|
||||
uchar* data = img.ptr();
|
||||
int step = (int)img.step;
|
||||
|
||||
if( m_png_ptr && m_info_ptr && m_end_info && m_width && m_height )
|
||||
{
|
||||
@@ -285,7 +283,7 @@ bool PngDecoder::readData( Mat& img )
|
||||
png_read_update_info( png_ptr, info_ptr );
|
||||
|
||||
for( y = 0; y < m_height; y++ )
|
||||
buffer[y] = data + y*step;
|
||||
buffer[y] = img.data + y*img.step;
|
||||
|
||||
png_read_image( png_ptr, buffer );
|
||||
png_read_end( png_ptr, end_info );
|
||||
@@ -376,22 +374,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_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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user