Skip to content

Commit f503890

Browse files
authored
Merge pull request opencv#26152 from sturkmen72:m_buf_supported
Documentation update for imagecodecs opencv#26152 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
1 parent e043d5d commit f503890

File tree

7 files changed

+252
-247
lines changed

7 files changed

+252
-247
lines changed

modules/imgcodecs/include/opencv2/imgcodecs.hpp

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ enum ImwriteHDRCompressionFlags {
222222
223223
@anchor imread
224224
225-
The function imread loads an image from the specified file and returns it. If the image cannot be
226-
read (because of missing file, improper permissions, unsupported or invalid format), the function
227-
returns an empty matrix ( Mat::data==NULL ).
225+
The `imread` function loads an image from the specified file and returns OpenCV matrix. If the image cannot be
226+
read (because of a missing file, improper permissions, or unsupported/invalid format), the function
227+
returns an empty matrix.
228228
229229
Currently, the following file formats are supported:
230230
@@ -234,7 +234,7 @@ Currently, the following file formats are supported:
234234
- Portable Network Graphics - \*.png (see the *Note* section)
235235
- WebP - \*.webp (see the *Note* section)
236236
- AVIF - \*.avif (see the *Note* section)
237-
- Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
237+
- Portable image format - \*.pbm, \*.pgm, \*.ppm, \*.pxm, \*.pnm (always supported)
238238
- PFM files - \*.pfm (see the *Note* section)
239239
- Sun rasters - \*.sr, \*.ras (always supported)
240240
- TIFF files - \*.tiff, \*.tif (see the *Note* section)
@@ -243,32 +243,31 @@ Currently, the following file formats are supported:
243243
- Raster and Vector geospatial data supported by GDAL (see the *Note* section)
244244
245245
@note
246-
- The function determines the type of an image by the content, not by the file extension.
246+
- The function determines the type of an image by its content, not by the file extension.
247247
- In the case of color images, the decoded images will have the channels stored in **B G R** order.
248248
- When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available.
249-
Results may differ to the output of cvtColor()
250-
- On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg,
251-
libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs,
252-
and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware
253-
that currently these native image loaders give images with different pixel values because of
254-
the color management embedded into MacOSX.
255-
- On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for
256-
codecs supplied with an OS image. Install the relevant packages (do not forget the development
257-
files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn
249+
Results may differ from the output of cvtColor().
250+
- On Microsoft Windows\* and Mac OS\*, the codecs shipped with OpenCV (libjpeg, libpng, libtiff,
251+
and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On Mac OS,
252+
there is also an option to use native Mac OS image readers. However, beware that currently these
253+
native image loaders give images with different pixel values because of the color management embedded
254+
into Mac OS.
255+
- On Linux\*, BSD flavors, and other Unix-like open-source operating systems, OpenCV looks for
256+
codecs supplied with the OS. Ensure the relevant packages are installed (including development
257+
files, such as "libjpeg-dev" in Debian\* and Ubuntu\*) to get codec support, or turn
258258
on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
259-
- In the case you set *WITH_GDAL* flag to true in CMake and @ref IMREAD_LOAD_GDAL to load the image,
260-
then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting
261-
the following formats: [Raster](http://www.gdal.org/formats_list.html),
262-
[Vector](http://www.gdal.org/ogr_formats.html).
263-
- If EXIF information is embedded in the image file, the EXIF orientation will be taken into account
264-
and thus the image will be rotated accordingly except if the flags @ref IMREAD_IGNORE_ORIENTATION
259+
- If the *WITH_GDAL* flag is set to true in CMake and @ref IMREAD_LOAD_GDAL is used to load the image,
260+
the [GDAL](http://www.gdal.org) driver will be used to decode the image, supporting
261+
[Raster](http://www.gdal.org/formats_list.html) and [Vector](http://www.gdal.org/ogr_formats.html) formats.
262+
- If EXIF information is embedded in the image file, the EXIF orientation will be taken into account,
263+
and thus the image will be rotated accordingly unless the flags @ref IMREAD_IGNORE_ORIENTATION
265264
or @ref IMREAD_UNCHANGED are passed.
266-
- Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
267-
- By default number of pixels must be less than 2^30. Limit can be set using system
268-
variable OPENCV_IO_MAX_IMAGE_PIXELS
265+
- Use the IMREAD_UNCHANGED flag to preserve the floating-point values from PFM images.
266+
- By default, the number of pixels must be less than 2^30. This limit can be changed by setting
267+
the environment variable `OPENCV_IO_MAX_IMAGE_PIXELS`. See @ref tutorial_env_reference.
269268
270-
@param filename Name of file to be loaded.
271-
@param flags Flag that can take values of cv::ImreadModes
269+
@param filename Name of the file to be loaded.
270+
@param flags Flag that can take values of `cv::ImreadModes`.
272271
*/
273272
CV_EXPORTS_W Mat imread( const String& filename, int flags = IMREAD_COLOR_BGR );
274273

modules/imgcodecs/src/bitstrm.cpp

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,6 @@
1-
/*M///////////////////////////////////////////////////////////////////////////////////////
2-
//
3-
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4-
//
5-
// By downloading, copying, installing or using the software you agree to this license.
6-
// If you do not agree to this license, do not download, install,
7-
// copy or use the software.
8-
//
9-
//
10-
// License Agreement
11-
// For Open Source Computer Vision Library
12-
//
13-
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14-
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15-
// Third party copyrights are property of their respective owners.
16-
//
17-
// Redistribution and use in source and binary forms, with or without modification,
18-
// are permitted provided that the following conditions are met:
19-
//
20-
// * Redistribution's of source code must retain the above copyright notice,
21-
// this list of conditions and the following disclaimer.
22-
//
23-
// * Redistribution's in binary form must reproduce the above copyright notice,
24-
// this list of conditions and the following disclaimer in the documentation
25-
// and/or other materials provided with the distribution.
26-
//
27-
// * The name of the copyright holders may not be used to endorse or promote products
28-
// derived from this software without specific prior written permission.
29-
//
30-
// This software is provided by the copyright holders and contributors "as is" and
31-
// any express or implied warranties, including, but not limited to, the implied
32-
// warranties of merchantability and fitness for a particular purpose are disclaimed.
33-
// In no event shall the Intel Corporation or contributors be liable for any direct,
34-
// indirect, incidental, special, exemplary, or consequential damages
35-
// (including, but not limited to, procurement of substitute goods or services;
36-
// loss of use, data, or profits; or business interruption) however caused
37-
// and on any theory of liability, whether in contract, strict liability,
38-
// or tort (including negligence or otherwise) arising in any way out of
39-
// the use of this software, even if advised of the possibility of such damage.
40-
//
41-
//M*/
1+
// This file is part of OpenCV project.
2+
// It is subject to the license terms in the LICENSE file found in the top-level
3+
// directory of this distribution and at http://opencv.org/license.html
424

435
#include "precomp.hpp"
446
#include "bitstrm.hpp"
@@ -49,11 +11,6 @@ namespace cv
4911

5012
const int BS_DEF_BLOCK_SIZE = 1<<15;
5113

52-
bool bsIsBigEndian( void )
53-
{
54-
return (((const int*)"\0\x1\x2\x3\x4\x5\x6\x7")[0] & 255) != 0;
55-
}
56-
5714
///////////////////////// RBaseStream ////////////////////////////
5815

5916
bool RBaseStream::isOpened()

modules/imgcodecs/src/bitstrm.hpp

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,6 @@
1-
/*M///////////////////////////////////////////////////////////////////////////////////////
2-
//
3-
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4-
//
5-
// By downloading, copying, installing or using the software you agree to this license.
6-
// If you do not agree to this license, do not download, install,
7-
// copy or use the software.
8-
//
9-
//
10-
// License Agreement
11-
// For Open Source Computer Vision Library
12-
//
13-
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14-
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15-
// Third party copyrights are property of their respective owners.
16-
//
17-
// Redistribution and use in source and binary forms, with or without modification,
18-
// are permitted provided that the following conditions are met:
19-
//
20-
// * Redistribution's of source code must retain the above copyright notice,
21-
// this list of conditions and the following disclaimer.
22-
//
23-
// * Redistribution's in binary form must reproduce the above copyright notice,
24-
// this list of conditions and the following disclaimer in the documentation
25-
// and/or other materials provided with the distribution.
26-
//
27-
// * The name of the copyright holders may not be used to endorse or promote products
28-
// derived from this software without specific prior written permission.
29-
//
30-
// This software is provided by the copyright holders and contributors "as is" and
31-
// any express or implied warranties, including, but not limited to, the implied
32-
// warranties of merchantability and fitness for a particular purpose are disclaimed.
33-
// In no event shall the Intel Corporation or contributors be liable for any direct,
34-
// indirect, incidental, special, exemplary, or consequential damages
35-
// (including, but not limited to, procurement of substitute goods or services;
36-
// loss of use, data, or profits; or business interruption) however caused
37-
// and on any theory of liability, whether in contract, strict liability,
38-
// or tort (including negligence or otherwise) arising in any way out of
39-
// the use of this software, even if advised of the possibility of such damage.
40-
//
41-
//M*/
1+
// This file is part of OpenCV project.
2+
// It is subject to the license terms in the LICENSE file found in the top-level
3+
// directory of this distribution and at http://opencv.org/license.html
424

435
#ifndef _BITSTRM_H_
446
#define _BITSTRM_H_
@@ -183,13 +145,6 @@ class WMByteStream : public WLByteStream
183145
bool putDWord( int val );
184146
};
185147

186-
inline unsigned BSWAP(unsigned v)
187-
{
188-
return (v<<24)|((v&0xff00)<<8)|((v>>8)&0xff00)|((unsigned)v>>24);
189-
}
190-
191-
bool bsIsBigEndian( void );
192-
193148
}
194149

195150
#endif/*_BITSTRM_H_*/

0 commit comments

Comments
 (0)