new function imread_reduced()
by this new function we can set libjpeg "scale_denom" parameter and load jpeg images scaled 1/2 - 1/4 - 1/8 other image formats resized after loading
This commit is contained in:
@@ -242,8 +242,12 @@ bool JpegDecoder::readHeader()
|
||||
{
|
||||
jpeg_read_header( &state->cinfo, TRUE );
|
||||
|
||||
m_width = state->cinfo.image_width;
|
||||
m_height = state->cinfo.image_height;
|
||||
state->cinfo.scale_num=1;
|
||||
state->cinfo.scale_denom = m_scale_denom;
|
||||
m_scale_denom=1; // trick! to know which decoder used scale_denom see imread_
|
||||
jpeg_calc_output_dimensions(&state->cinfo);
|
||||
m_width = state->cinfo.output_width;
|
||||
m_height = state->cinfo.output_height;
|
||||
m_type = state->cinfo.num_components > 1 ? CV_8UC3 : CV_8UC1;
|
||||
result = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user