OpenCV  4.9.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
Enumerations
Flags used for image file reading and writing

Detailed Description

Enumerations

enum  cv::ImreadModes {
  cv::IMREAD_UNCHANGED = -1 ,
  cv::IMREAD_GRAYSCALE = 0 ,
  cv::IMREAD_COLOR = 1 ,
  cv::IMREAD_ANYDEPTH = 2 ,
  cv::IMREAD_ANYCOLOR = 4 ,
  cv::IMREAD_LOAD_GDAL = 8 ,
  cv::IMREAD_REDUCED_GRAYSCALE_2 = 16 ,
  cv::IMREAD_REDUCED_COLOR_2 = 17 ,
  cv::IMREAD_REDUCED_GRAYSCALE_4 = 32 ,
  cv::IMREAD_REDUCED_COLOR_4 = 33 ,
  cv::IMREAD_REDUCED_GRAYSCALE_8 = 64 ,
  cv::IMREAD_REDUCED_COLOR_8 = 65 ,
  cv::IMREAD_IGNORE_ORIENTATION = 128
}
 Imread flags. More...
 
enum  cv::ImwriteEXRCompressionFlags {
  cv::IMWRITE_EXR_COMPRESSION_NO = 0 ,
  cv::IMWRITE_EXR_COMPRESSION_RLE = 1 ,
  cv::IMWRITE_EXR_COMPRESSION_ZIPS = 2 ,
  cv::IMWRITE_EXR_COMPRESSION_ZIP = 3 ,
  cv::IMWRITE_EXR_COMPRESSION_PIZ = 4 ,
  cv::IMWRITE_EXR_COMPRESSION_PXR24 = 5 ,
  cv::IMWRITE_EXR_COMPRESSION_B44 = 6 ,
  cv::IMWRITE_EXR_COMPRESSION_B44A = 7 ,
  cv::IMWRITE_EXR_COMPRESSION_DWAA = 8 ,
  cv::IMWRITE_EXR_COMPRESSION_DWAB = 9
}
 
enum  cv::ImwriteEXRTypeFlags {
  cv::IMWRITE_EXR_TYPE_HALF = 1 ,
  cv::IMWRITE_EXR_TYPE_FLOAT = 2
}
 
enum  cv::ImwriteFlags {
  cv::IMWRITE_JPEG_QUALITY = 1 ,
  cv::IMWRITE_JPEG_PROGRESSIVE = 2 ,
  cv::IMWRITE_JPEG_OPTIMIZE = 3 ,
  cv::IMWRITE_JPEG_RST_INTERVAL = 4 ,
  cv::IMWRITE_JPEG_LUMA_QUALITY = 5 ,
  cv::IMWRITE_JPEG_CHROMA_QUALITY = 6 ,
  cv::IMWRITE_JPEG_SAMPLING_FACTOR = 7 ,
  cv::IMWRITE_PNG_COMPRESSION = 16 ,
  cv::IMWRITE_PNG_STRATEGY = 17 ,
  cv::IMWRITE_PNG_BILEVEL = 18 ,
  cv::IMWRITE_PXM_BINARY = 32 ,
  cv::IMWRITE_EXR_TYPE = (3 << 4) + 0 ,
  cv::IMWRITE_EXR_COMPRESSION = (3 << 4) + 1 ,
  cv::IMWRITE_EXR_DWA_COMPRESSION_LEVEL = (3 << 4) + 2 ,
  cv::IMWRITE_WEBP_QUALITY = 64 ,
  cv::IMWRITE_HDR_COMPRESSION = (5 << 4) + 0 ,
  cv::IMWRITE_PAM_TUPLETYPE = 128 ,
  cv::IMWRITE_TIFF_RESUNIT = 256 ,
  cv::IMWRITE_TIFF_XDPI = 257 ,
  cv::IMWRITE_TIFF_YDPI = 258 ,
  cv::IMWRITE_TIFF_COMPRESSION = 259 ,
  cv::IMWRITE_JPEG2000_COMPRESSION_X1000 = 272 ,
  cv::IMWRITE_AVIF_QUALITY = 512 ,
  cv::IMWRITE_AVIF_DEPTH = 513 ,
  cv::IMWRITE_AVIF_SPEED = 514
}
 Imwrite flags. More...
 
enum  cv::ImwriteHDRCompressionFlags {
  cv::IMWRITE_HDR_COMPRESSION_NONE = 0 ,
  cv::IMWRITE_HDR_COMPRESSION_RLE = 1
}
 Imwrite HDR specific values for IMWRITE_HDR_COMPRESSION parameter key. More...
 
enum  cv::ImwriteJPEGSamplingFactorParams {
  cv::IMWRITE_JPEG_SAMPLING_FACTOR_411 = 0x411111 ,
  cv::IMWRITE_JPEG_SAMPLING_FACTOR_420 = 0x221111 ,
  cv::IMWRITE_JPEG_SAMPLING_FACTOR_422 = 0x211111 ,
  cv::IMWRITE_JPEG_SAMPLING_FACTOR_440 = 0x121111 ,
  cv::IMWRITE_JPEG_SAMPLING_FACTOR_444 = 0x111111
}
 
enum  cv::ImwritePAMFlags {
  cv::IMWRITE_PAM_FORMAT_NULL = 0 ,
  cv::IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1 ,
  cv::IMWRITE_PAM_FORMAT_GRAYSCALE = 2 ,
  cv::IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3 ,
  cv::IMWRITE_PAM_FORMAT_RGB = 4 ,
  cv::IMWRITE_PAM_FORMAT_RGB_ALPHA = 5
}
 Imwrite PAM specific tupletype flags used to define the 'TUPLETYPE' field of a PAM file. More...
 
enum  cv::ImwritePNGFlags {
  cv::IMWRITE_PNG_STRATEGY_DEFAULT = 0 ,
  cv::IMWRITE_PNG_STRATEGY_FILTERED = 1 ,
  cv::IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2 ,
  cv::IMWRITE_PNG_STRATEGY_RLE = 3 ,
  cv::IMWRITE_PNG_STRATEGY_FIXED = 4
}
 Imwrite PNG specific flags used to tune the compression algorithm. More...
 

Enumeration Type Documentation

◆ ImreadModes

#include <opencv2/imgcodecs.hpp>

Imread flags.

Enumerator
IMREAD_UNCHANGED 
Python: cv.IMREAD_UNCHANGED

If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). Ignore EXIF orientation.

IMREAD_GRAYSCALE 
Python: cv.IMREAD_GRAYSCALE

If set, always convert image to the single channel grayscale image (codec internal conversion).

IMREAD_COLOR 
Python: cv.IMREAD_COLOR

If set, always convert image to the 3 channel BGR color image.

IMREAD_ANYDEPTH 
Python: cv.IMREAD_ANYDEPTH

If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.

IMREAD_ANYCOLOR 
Python: cv.IMREAD_ANYCOLOR

If set, the image is read in any possible color format.

IMREAD_LOAD_GDAL 
Python: cv.IMREAD_LOAD_GDAL

If set, use the gdal driver for loading the image.

IMREAD_REDUCED_GRAYSCALE_2 
Python: cv.IMREAD_REDUCED_GRAYSCALE_2

If set, always convert image to the single channel grayscale image and the image size reduced 1/2.

IMREAD_REDUCED_COLOR_2 
Python: cv.IMREAD_REDUCED_COLOR_2

If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.

IMREAD_REDUCED_GRAYSCALE_4 
Python: cv.IMREAD_REDUCED_GRAYSCALE_4

If set, always convert image to the single channel grayscale image and the image size reduced 1/4.

IMREAD_REDUCED_COLOR_4 
Python: cv.IMREAD_REDUCED_COLOR_4

If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.

IMREAD_REDUCED_GRAYSCALE_8 
Python: cv.IMREAD_REDUCED_GRAYSCALE_8

If set, always convert image to the single channel grayscale image and the image size reduced 1/8.

IMREAD_REDUCED_COLOR_8 
Python: cv.IMREAD_REDUCED_COLOR_8

If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.

IMREAD_IGNORE_ORIENTATION 
Python: cv.IMREAD_IGNORE_ORIENTATION

If set, do not rotate the image according to EXIF's orientation flag.

◆ ImwriteEXRCompressionFlags

#include <opencv2/imgcodecs.hpp>

Enumerator
IMWRITE_EXR_COMPRESSION_NO 
Python: cv.IMWRITE_EXR_COMPRESSION_NO

no compression

IMWRITE_EXR_COMPRESSION_RLE 
Python: cv.IMWRITE_EXR_COMPRESSION_RLE

run length encoding

IMWRITE_EXR_COMPRESSION_ZIPS 
Python: cv.IMWRITE_EXR_COMPRESSION_ZIPS

zlib compression, one scan line at a time

IMWRITE_EXR_COMPRESSION_ZIP 
Python: cv.IMWRITE_EXR_COMPRESSION_ZIP

zlib compression, in blocks of 16 scan lines

IMWRITE_EXR_COMPRESSION_PIZ 
Python: cv.IMWRITE_EXR_COMPRESSION_PIZ

piz-based wavelet compression

IMWRITE_EXR_COMPRESSION_PXR24 
Python: cv.IMWRITE_EXR_COMPRESSION_PXR24

lossy 24-bit float compression

IMWRITE_EXR_COMPRESSION_B44 
Python: cv.IMWRITE_EXR_COMPRESSION_B44

lossy 4-by-4 pixel block compression, fixed compression rate

IMWRITE_EXR_COMPRESSION_B44A 
Python: cv.IMWRITE_EXR_COMPRESSION_B44A

lossy 4-by-4 pixel block compression, flat fields are compressed more

IMWRITE_EXR_COMPRESSION_DWAA 
Python: cv.IMWRITE_EXR_COMPRESSION_DWAA

lossy DCT based compression, in blocks of 32 scanlines. More efficient for partial buffer access. Supported since OpenEXR 2.2.0.

IMWRITE_EXR_COMPRESSION_DWAB 
Python: cv.IMWRITE_EXR_COMPRESSION_DWAB

lossy DCT based compression, in blocks of 256 scanlines. More efficient space wise and faster to decode full frames than DWAA_COMPRESSION. Supported since OpenEXR 2.2.0.

◆ ImwriteEXRTypeFlags

#include <opencv2/imgcodecs.hpp>

Enumerator
IMWRITE_EXR_TYPE_HALF 
Python: cv.IMWRITE_EXR_TYPE_HALF

store as HALF (FP16)

IMWRITE_EXR_TYPE_FLOAT 
Python: cv.IMWRITE_EXR_TYPE_FLOAT

store as FP32 (default)

◆ ImwriteFlags

#include <opencv2/imgcodecs.hpp>

Imwrite flags.

Enumerator
IMWRITE_JPEG_QUALITY 
Python: cv.IMWRITE_JPEG_QUALITY

For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95.

IMWRITE_JPEG_PROGRESSIVE 
Python: cv.IMWRITE_JPEG_PROGRESSIVE

Enable JPEG features, 0 or 1, default is False.

IMWRITE_JPEG_OPTIMIZE 
Python: cv.IMWRITE_JPEG_OPTIMIZE

Enable JPEG features, 0 or 1, default is False.

IMWRITE_JPEG_RST_INTERVAL 
Python: cv.IMWRITE_JPEG_RST_INTERVAL

JPEG restart interval, 0 - 65535, default is 0 - no restart.

IMWRITE_JPEG_LUMA_QUALITY 
Python: cv.IMWRITE_JPEG_LUMA_QUALITY

Separate luma quality level, 0 - 100, default is -1 - don't use.

IMWRITE_JPEG_CHROMA_QUALITY 
Python: cv.IMWRITE_JPEG_CHROMA_QUALITY

Separate chroma quality level, 0 - 100, default is -1 - don't use.

IMWRITE_JPEG_SAMPLING_FACTOR 
Python: cv.IMWRITE_JPEG_SAMPLING_FACTOR

For JPEG, set sampling factor. See cv::ImwriteJPEGSamplingFactorParams.

IMWRITE_PNG_COMPRESSION 
Python: cv.IMWRITE_PNG_COMPRESSION

For PNG, it can be the compression level from 0 to 9. A higher value means a smaller size and longer compression time. If specified, strategy is changed to IMWRITE_PNG_STRATEGY_DEFAULT (Z_DEFAULT_STRATEGY). Default value is 1 (best speed setting).

IMWRITE_PNG_STRATEGY 
Python: cv.IMWRITE_PNG_STRATEGY

One of cv::ImwritePNGFlags, default is IMWRITE_PNG_STRATEGY_RLE.

IMWRITE_PNG_BILEVEL 
Python: cv.IMWRITE_PNG_BILEVEL

Binary level PNG, 0 or 1, default is 0.

IMWRITE_PXM_BINARY 
Python: cv.IMWRITE_PXM_BINARY

For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1.

IMWRITE_EXR_TYPE 
Python: cv.IMWRITE_EXR_TYPE

override EXR storage type (FLOAT (FP32) is default)

IMWRITE_EXR_COMPRESSION 
Python: cv.IMWRITE_EXR_COMPRESSION

override EXR compression type (ZIP_COMPRESSION = 3 is default)

IMWRITE_EXR_DWA_COMPRESSION_LEVEL 
Python: cv.IMWRITE_EXR_DWA_COMPRESSION_LEVEL

override EXR DWA compression level (45 is default)

IMWRITE_WEBP_QUALITY 
Python: cv.IMWRITE_WEBP_QUALITY

For WEBP, it can be a quality from 1 to 100 (the higher is the better). By default (without any parameter) and for quality above 100 the lossless compression is used.

IMWRITE_HDR_COMPRESSION 
Python: cv.IMWRITE_HDR_COMPRESSION

specify HDR compression

IMWRITE_PAM_TUPLETYPE 
Python: cv.IMWRITE_PAM_TUPLETYPE

For PAM, sets the TUPLETYPE field to the corresponding string value that is defined for the format.

IMWRITE_TIFF_RESUNIT 
Python: cv.IMWRITE_TIFF_RESUNIT

For TIFF, use to specify which DPI resolution unit to set; see libtiff documentation for valid values.

IMWRITE_TIFF_XDPI 
Python: cv.IMWRITE_TIFF_XDPI

For TIFF, use to specify the X direction DPI.

IMWRITE_TIFF_YDPI 
Python: cv.IMWRITE_TIFF_YDPI

For TIFF, use to specify the Y direction DPI.

IMWRITE_TIFF_COMPRESSION 
Python: cv.IMWRITE_TIFF_COMPRESSION

For TIFF, use to specify the image compression scheme. See libtiff for integer constants corresponding to compression formats. Note, for images whose depth is CV_32F, only libtiff's SGILOG compression scheme is used. For other supported depths, the compression scheme can be specified by this flag; LZW compression is the default.

IMWRITE_JPEG2000_COMPRESSION_X1000 
Python: cv.IMWRITE_JPEG2000_COMPRESSION_X1000

For JPEG2000, use to specify the target compression rate (multiplied by 1000). The value can be from 0 to 1000. Default is 1000.

IMWRITE_AVIF_QUALITY 
Python: cv.IMWRITE_AVIF_QUALITY

For AVIF, it can be a quality between 0 and 100 (the higher the better). Default is 95.

IMWRITE_AVIF_DEPTH 
Python: cv.IMWRITE_AVIF_DEPTH

For AVIF, it can be 8, 10 or 12. If >8, it is stored/read as CV_32F. Default is 8.

IMWRITE_AVIF_SPEED 
Python: cv.IMWRITE_AVIF_SPEED

For AVIF, it is between 0 (slowest) and (fastest). Default is 9.

◆ ImwriteHDRCompressionFlags

#include <opencv2/imgcodecs.hpp>

Imwrite HDR specific values for IMWRITE_HDR_COMPRESSION parameter key.

Enumerator
IMWRITE_HDR_COMPRESSION_NONE 
Python: cv.IMWRITE_HDR_COMPRESSION_NONE
IMWRITE_HDR_COMPRESSION_RLE 
Python: cv.IMWRITE_HDR_COMPRESSION_RLE

◆ ImwriteJPEGSamplingFactorParams

#include <opencv2/imgcodecs.hpp>

Enumerator
IMWRITE_JPEG_SAMPLING_FACTOR_411 
Python: cv.IMWRITE_JPEG_SAMPLING_FACTOR_411

4x1,1x1,1x1

IMWRITE_JPEG_SAMPLING_FACTOR_420 
Python: cv.IMWRITE_JPEG_SAMPLING_FACTOR_420

2x2,1x1,1x1(Default)

IMWRITE_JPEG_SAMPLING_FACTOR_422 
Python: cv.IMWRITE_JPEG_SAMPLING_FACTOR_422

2x1,1x1,1x1

IMWRITE_JPEG_SAMPLING_FACTOR_440 
Python: cv.IMWRITE_JPEG_SAMPLING_FACTOR_440

1x2,1x1,1x1

IMWRITE_JPEG_SAMPLING_FACTOR_444 
Python: cv.IMWRITE_JPEG_SAMPLING_FACTOR_444

1x1,1x1,1x1(No subsampling)

◆ ImwritePAMFlags

#include <opencv2/imgcodecs.hpp>

Imwrite PAM specific tupletype flags used to define the 'TUPLETYPE' field of a PAM file.

Enumerator
IMWRITE_PAM_FORMAT_NULL 
Python: cv.IMWRITE_PAM_FORMAT_NULL
IMWRITE_PAM_FORMAT_BLACKANDWHITE 
Python: cv.IMWRITE_PAM_FORMAT_BLACKANDWHITE
IMWRITE_PAM_FORMAT_GRAYSCALE 
Python: cv.IMWRITE_PAM_FORMAT_GRAYSCALE
IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA 
Python: cv.IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA
IMWRITE_PAM_FORMAT_RGB 
Python: cv.IMWRITE_PAM_FORMAT_RGB
IMWRITE_PAM_FORMAT_RGB_ALPHA 
Python: cv.IMWRITE_PAM_FORMAT_RGB_ALPHA

◆ ImwritePNGFlags

#include <opencv2/imgcodecs.hpp>

Imwrite PNG specific flags used to tune the compression algorithm.

These flags will be modify the way of PNG image compression and will be passed to the underlying zlib processing stage.

  • The effect of IMWRITE_PNG_STRATEGY_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between IMWRITE_PNG_STRATEGY_DEFAULT and IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY.
  • IMWRITE_PNG_STRATEGY_RLE is designed to be almost as fast as IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY, but give better compression for PNG image data.
  • The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately.
  • IMWRITE_PNG_STRATEGY_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
Enumerator
IMWRITE_PNG_STRATEGY_DEFAULT 
Python: cv.IMWRITE_PNG_STRATEGY_DEFAULT

Use this value for normal data.

IMWRITE_PNG_STRATEGY_FILTERED 
Python: cv.IMWRITE_PNG_STRATEGY_FILTERED

Use this value for data produced by a filter (or predictor).Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better.

IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY 
Python: cv.IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY

Use this value to force Huffman encoding only (no string match).

IMWRITE_PNG_STRATEGY_RLE 
Python: cv.IMWRITE_PNG_STRATEGY_RLE

Use this value to limit match distances to one (run-length encoding).

IMWRITE_PNG_STRATEGY_FIXED 
Python: cv.IMWRITE_PNG_STRATEGY_FIXED

Using this value prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.