opencv2/imgcodecs.hpp#

#include <opencv2/core.hpp>

Include dependency graph for imgcodecs.hpp:

opencv2/imgcodecs.hpp Node1 opencv2/imgcodecs.hpp Node2 opencv2/core.hpp Node1->Node2 Node3 opencv2/core/cvdef.h Node2->Node3 Node10 opencv2/core/base.hpp Node2->Node10 Node14 opencv2/core/cvstd.hpp Node2->Node14 Node30 opencv2/core/traits.hpp Node2->Node30 Node31 opencv2/core/matx.hpp Node2->Node31 Node36 opencv2/core/types.hpp Node2->Node36 Node39 opencv2/core/mat.hpp Node2->Node39 Node43 opencv2/core/persistence.hpp Node2->Node43 Node44 opencv2/core/operations.hpp Node2->Node44 Node47 opencv2/core/cvstd.inl.hpp Node2->Node47 Node48 opencv2/core/utility.hpp Node2->Node48 Node51 opencv2/core/optim.hpp Node2->Node51 Node4 opencv2/core/version.hpp Node3->Node4 Node5 limits Node3->Node5 Node6 opencv2/core/hal/interface.h Node3->Node6 Node8 cstdint Node3->Node8 Node9 cv_cpu_dispatch.h Node3->Node9 Node7 cstddef Node6->Node7 Node6->Node8 Node10->Node3 Node11 opencv2/opencv_modules.hpp Node10->Node11 Node12 climits Node10->Node12 Node13 algorithm Node10->Node13 Node10->Node14 Node24 opencv2/core/fwddecl.hpp Node10->Node24 Node25 opencv2/core/neon_utils.hpp Node10->Node25 Node26 opencv2/core/vsx_utils.hpp Node10->Node26 Node28 opencv2/core/exception.hpp Node10->Node28 Node29 opencv2/core/check.hpp Node10->Node29 Node14->Node3 Node14->Node7 Node14->Node13 Node15 cstring Node14->Node15 Node16 cctype Node14->Node16 Node17 string Node14->Node17 Node18 utility Node14->Node18 Node19 cstdlib Node14->Node19 Node20 cmath Node14->Node20 Node21 cvstd_wrapper.hpp Node14->Node21 Node21->Node3 Node21->Node17 Node22 memory Node21->Node22 Node23 type_traits Node21->Node23 Node24->Node3 Node25->Node3 Node26->Node3 Node27 assert.h Node26->Node27 Node28->Node3 Node28->Node14 Node29->Node3 Node29->Node14 Node29->Node24 Node30->Node3 Node31->Node3 Node31->Node10 Node31->Node30 Node32 opencv2/core/saturate.hpp Node31->Node32 Node34 initializer_list Node31->Node34 Node35 opencv2/core/matx.inl.hpp Node31->Node35 Node32->Node3 Node32->Node12 Node33 opencv2/core/fast_math.hpp Node32->Node33 Node33->Node3 Node33->Node20 Node36->Node3 Node36->Node5 Node36->Node12 Node36->Node14 Node36->Node31 Node37 cfloat Node36->Node37 Node38 vector Node36->Node38 Node39->Node23 Node39->Node31 Node39->Node36 Node40 opencv2/core/bufferpool.hpp Node39->Node40 Node41 array Node39->Node41 Node42 opencv2/core/mat.inl.hpp Node39->Node42 Node43->Node36 Node43->Node39 Node45 cstdio Node44->Node45 Node46 ostream Node44->Node46 Node48->Node2 Node48->Node46 Node49 functional Node48->Node49 Node50 mutex Node48->Node50 Node51->Node2

opencv2/imgcodecs.hpp Node1 opencv2/imgcodecs.hpp Node2 opencv2/core.hpp Node1->Node2 Node3 opencv2/core/cvdef.h Node2->Node3 Node10 opencv2/core/base.hpp Node2->Node10 Node14 opencv2/core/cvstd.hpp Node2->Node14 Node30 opencv2/core/traits.hpp Node2->Node30 Node31 opencv2/core/matx.hpp Node2->Node31 Node36 opencv2/core/types.hpp Node2->Node36 Node39 opencv2/core/mat.hpp Node2->Node39 Node43 opencv2/core/persistence.hpp Node2->Node43 Node44 opencv2/core/operations.hpp Node2->Node44 Node47 opencv2/core/cvstd.inl.hpp Node2->Node47 Node48 opencv2/core/utility.hpp Node2->Node48 Node51 opencv2/core/optim.hpp Node2->Node51 Node4 opencv2/core/version.hpp Node3->Node4 Node5 limits Node3->Node5 Node6 opencv2/core/hal/interface.h Node3->Node6 Node8 cstdint Node3->Node8 Node9 cv_cpu_dispatch.h Node3->Node9 Node7 cstddef Node6->Node7 Node6->Node8 Node10->Node3 Node11 opencv2/opencv_modules.hpp Node10->Node11 Node12 climits Node10->Node12 Node13 algorithm Node10->Node13 Node10->Node14 Node24 opencv2/core/fwddecl.hpp Node10->Node24 Node25 opencv2/core/neon_utils.hpp Node10->Node25 Node26 opencv2/core/vsx_utils.hpp Node10->Node26 Node28 opencv2/core/exception.hpp Node10->Node28 Node29 opencv2/core/check.hpp Node10->Node29 Node14->Node3 Node14->Node7 Node14->Node13 Node15 cstring Node14->Node15 Node16 cctype Node14->Node16 Node17 string Node14->Node17 Node18 utility Node14->Node18 Node19 cstdlib Node14->Node19 Node20 cmath Node14->Node20 Node21 cvstd_wrapper.hpp Node14->Node21 Node21->Node3 Node21->Node17 Node22 memory Node21->Node22 Node23 type_traits Node21->Node23 Node24->Node3 Node25->Node3 Node26->Node3 Node27 assert.h Node26->Node27 Node28->Node3 Node28->Node14 Node29->Node3 Node29->Node14 Node29->Node24 Node30->Node3 Node31->Node3 Node31->Node10 Node31->Node30 Node32 opencv2/core/saturate.hpp Node31->Node32 Node34 initializer_list Node31->Node34 Node35 opencv2/core/matx.inl.hpp Node31->Node35 Node32->Node3 Node32->Node12 Node33 opencv2/core/fast_math.hpp Node32->Node33 Node33->Node3 Node33->Node20 Node36->Node3 Node36->Node5 Node36->Node12 Node36->Node14 Node36->Node31 Node37 cfloat Node36->Node37 Node38 vector Node36->Node38 Node39->Node23 Node39->Node31 Node39->Node36 Node40 opencv2/core/bufferpool.hpp Node39->Node40 Node41 array Node39->Node41 Node42 opencv2/core/mat.inl.hpp Node39->Node42 Node43->Node36 Node43->Node39 Node45 cstdio Node44->Node45 Node46 ostream Node44->Node46 Node48->Node2 Node48->Node46 Node49 functional Node48->Node49 Node50 mutex Node48->Node50 Node51->Node2

This graph shows which files directly or indirectly include imgcodecs.hpp:

incby n9964e0c2cf opencv2/imgcodecs/imgcodecs.hpp n7b84d2e6f4 opencv2/imgcodecs.hpp n9964e0c2cf->n7b84d2e6f4

incby n9964e0c2cf opencv2/imgcodecs/imgcodecs.hpp n7b84d2e6f4 opencv2/imgcodecs.hpp n9964e0c2cf->n7b84d2e6f4

Classes#

struct cv::Animation

Represents an animation with multiple frames. The Animation struct is designed to store and manage data for animated sequences such as those from animated formats (e.g., GIF, AVIF, APNG, WebP). It provides support for looping, background color settings, frame timing, and frame storage. More…

class cv::ImageCollection

To read multi-page images on demand. More…

struct cv::ImageCollection::iterator

Namespaces#

namespace cv

Enumerations#

enum cv::ImageMetadataType {
IMAGE_METADATA_UNKNOWN = -1,
IMAGE_METADATA_EXIF = 0,
IMAGE_METADATA_XMP = 1,
IMAGE_METADATA_ICCP = 2,
IMAGE_METADATA_CICP = 3,
IMAGE_METADATA_MAX = 3
}
enum cv::ImreadModes {
IMREAD_UNCHANGED = -1,
IMREAD_GRAYSCALE = 0,
IMREAD_COLOR_BGR = 1,
IMREAD_COLOR = 1,
IMREAD_ANYDEPTH = 2,
IMREAD_ANYCOLOR = 4,
IMREAD_LOAD_GDAL = 8,
IMREAD_REDUCED_GRAYSCALE_2 = 16,
IMREAD_REDUCED_COLOR_2 = 17,
IMREAD_REDUCED_GRAYSCALE_4 = 32,
IMREAD_REDUCED_COLOR_4 = 33,
IMREAD_REDUCED_GRAYSCALE_8 = 64,
IMREAD_REDUCED_COLOR_8 = 65,
IMREAD_IGNORE_ORIENTATION = 128,
IMREAD_COLOR_RGB = 256
}
enum cv::ImwriteBMPCompressionFlags {
IMWRITE_BMP_COMPRESSION_RGB = 0,
IMWRITE_BMP_COMPRESSION_BITFIELDS = 3
}

Imwrite BMP specific values for IMWRITE_BMP_COMPRESSION parameter key. More…

enum cv::ImwriteEXRCompressionFlags {
IMWRITE_EXR_COMPRESSION_NO = 0,
IMWRITE_EXR_COMPRESSION_RLE = 1,
IMWRITE_EXR_COMPRESSION_ZIPS = 2,
IMWRITE_EXR_COMPRESSION_ZIP = 3,
IMWRITE_EXR_COMPRESSION_PIZ = 4,
IMWRITE_EXR_COMPRESSION_PXR24 = 5,
IMWRITE_EXR_COMPRESSION_B44 = 6,
IMWRITE_EXR_COMPRESSION_B44A = 7,
IMWRITE_EXR_COMPRESSION_DWAA = 8,
IMWRITE_EXR_COMPRESSION_DWAB = 9
}
enum cv::ImwriteEXRTypeFlags {
IMWRITE_EXR_TYPE_HALF = 1,
IMWRITE_EXR_TYPE_FLOAT = 2
}
enum cv::ImwriteFlags {
IMWRITE_JPEG_QUALITY = 1,
IMWRITE_JPEG_PROGRESSIVE = 2,
IMWRITE_JPEG_OPTIMIZE = 3,
IMWRITE_JPEG_RST_INTERVAL = 4,
IMWRITE_JPEG_LUMA_QUALITY = 5,
IMWRITE_JPEG_CHROMA_QUALITY = 6,
IMWRITE_JPEG_SAMPLING_FACTOR = 7,
IMWRITE_PNG_COMPRESSION = 16,
IMWRITE_PNG_STRATEGY = 17,
IMWRITE_PNG_BILEVEL = 18,
IMWRITE_PNG_FILTER = 19,
IMWRITE_PNG_ZLIBBUFFER_SIZE = 20,
IMWRITE_PXM_BINARY = 32,
IMWRITE_EXR_TYPE = (3 << 4) + 0,
IMWRITE_EXR_COMPRESSION = (3 << 4) + 1,
IMWRITE_EXR_DWA_COMPRESSION_LEVEL = (3 << 4) + 2,
IMWRITE_WEBP_QUALITY = 64,
IMWRITE_WEBP_LOSSLESS_MODE = 65,
IMWRITE_HDR_COMPRESSION = (5 << 4) + 0,
IMWRITE_PAM_TUPLETYPE = 128,
IMWRITE_TIFF_RESUNIT = 256,
IMWRITE_TIFF_XDPI = 257,
IMWRITE_TIFF_YDPI = 258,
IMWRITE_TIFF_COMPRESSION = 259,
IMWRITE_TIFF_ROWSPERSTRIP = 278,
IMWRITE_TIFF_PREDICTOR = 317,
IMWRITE_JPEG2000_COMPRESSION_X1000 = 272,
IMWRITE_AVIF_QUALITY = 512,
IMWRITE_AVIF_DEPTH = 513,
IMWRITE_AVIF_SPEED = 514,
IMWRITE_JPEGXL_QUALITY = 640,
IMWRITE_JPEGXL_EFFORT = 641,
IMWRITE_JPEGXL_DISTANCE = 642,
IMWRITE_JPEGXL_DECODING_SPEED = 643,
IMWRITE_BMP_COMPRESSION = 768,
IMWRITE_GIF_LOOP = 1024,
IMWRITE_GIF_SPEED = 1025,
IMWRITE_GIF_QUALITY = 1026,
IMWRITE_GIF_DITHER = 1027,
IMWRITE_GIF_TRANSPARENCY = 1028,
IMWRITE_GIF_COLORTABLE = 1029
}

Imwrite flags. More…

enum cv::ImwriteGIFCompressionFlags {
IMWRITE_GIF_FAST_NO_DITHER = 1,
IMWRITE_GIF_FAST_FLOYD_DITHER = 2,
IMWRITE_GIF_COLORTABLE_SIZE_8 = 3,
IMWRITE_GIF_COLORTABLE_SIZE_16 = 4,
IMWRITE_GIF_COLORTABLE_SIZE_32 = 5,
IMWRITE_GIF_COLORTABLE_SIZE_64 = 6,
IMWRITE_GIF_COLORTABLE_SIZE_128 = 7,
IMWRITE_GIF_COLORTABLE_SIZE_256 = 8
}

Imwrite GIF specific values for IMWRITE_GIF_QUALITY parameter key, if larger than 3, then its related to the size of the color table. More…

enum cv::ImwriteHDRCompressionFlags {
IMWRITE_HDR_COMPRESSION_NONE = 0,
IMWRITE_HDR_COMPRESSION_RLE = 1
}

Imwrite HDR specific values for IMWRITE_HDR_COMPRESSION parameter key. More…

enum cv::ImwriteJPEGSamplingFactorParams {
IMWRITE_JPEG_SAMPLING_FACTOR_411 = 0x411111,
IMWRITE_JPEG_SAMPLING_FACTOR_420 = 0x221111,
IMWRITE_JPEG_SAMPLING_FACTOR_422 = 0x211111,
IMWRITE_JPEG_SAMPLING_FACTOR_440 = 0x121111,
IMWRITE_JPEG_SAMPLING_FACTOR_444 = 0x111111
}
enum cv::ImwritePAMFlags {
IMWRITE_PAM_FORMAT_NULL = 0,
IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1,
IMWRITE_PAM_FORMAT_GRAYSCALE = 2,
IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3,
IMWRITE_PAM_FORMAT_RGB = 4,
IMWRITE_PAM_FORMAT_RGB_ALPHA = 5
}

Imwrite PAM specific tupletype flags used to define the ‘TUPLETYPE’ field of a PAM file. More…

enum cv::ImwritePNGFilterFlags {
IMWRITE_PNG_FILTER_NONE = 8,
IMWRITE_PNG_FILTER_SUB = 16,
IMWRITE_PNG_FILTER_UP = 32,
IMWRITE_PNG_FILTER_AVG = 64,
IMWRITE_PNG_FILTER_PAETH = 128,
IMWRITE_PNG_FAST_FILTERS = (IMWRITE_PNG_FILTER_NONE | IMWRITE_PNG_FILTER_SUB | IMWRITE_PNG_FILTER_UP),
IMWRITE_PNG_ALL_FILTERS = (IMWRITE_PNG_FAST_FILTERS | IMWRITE_PNG_FILTER_AVG | IMWRITE_PNG_FILTER_PAETH)
}

Imwrite PNG specific values for IMWRITE_PNG_FILTER parameter key. More…

enum cv::ImwritePNGFlags {
IMWRITE_PNG_STRATEGY_DEFAULT = 0,
IMWRITE_PNG_STRATEGY_FILTERED = 1,
IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
IMWRITE_PNG_STRATEGY_RLE = 3,
IMWRITE_PNG_STRATEGY_FIXED = 4
}

Imwrite PNG specific flags used to tune the compression algorithm. More…

enum cv::ImwriteTiffCompressionFlags {
IMWRITE_TIFF_COMPRESSION_NONE = 1,
IMWRITE_TIFF_COMPRESSION_CCITTRLE = 2,
IMWRITE_TIFF_COMPRESSION_CCITTFAX3 = 3,
IMWRITE_TIFF_COMPRESSION_CCITT_T4 = 3,
IMWRITE_TIFF_COMPRESSION_CCITTFAX4 = 4,
IMWRITE_TIFF_COMPRESSION_CCITT_T6 = 4,
IMWRITE_TIFF_COMPRESSION_LZW = 5,
IMWRITE_TIFF_COMPRESSION_OJPEG = 6,
IMWRITE_TIFF_COMPRESSION_JPEG = 7,
IMWRITE_TIFF_COMPRESSION_T85 = 9,
IMWRITE_TIFF_COMPRESSION_T43 = 10,
IMWRITE_TIFF_COMPRESSION_NEXT = 32766,
IMWRITE_TIFF_COMPRESSION_CCITTRLEW = 32771,
IMWRITE_TIFF_COMPRESSION_PACKBITS = 32773,
IMWRITE_TIFF_COMPRESSION_THUNDERSCAN = 32809,
IMWRITE_TIFF_COMPRESSION_IT8CTPAD = 32895,
IMWRITE_TIFF_COMPRESSION_IT8LW = 32896,
IMWRITE_TIFF_COMPRESSION_IT8MP = 32897,
IMWRITE_TIFF_COMPRESSION_IT8BL = 32898,
IMWRITE_TIFF_COMPRESSION_PIXARFILM = 32908,
IMWRITE_TIFF_COMPRESSION_PIXARLOG = 32909,
IMWRITE_TIFF_COMPRESSION_DEFLATE = 32946,
IMWRITE_TIFF_COMPRESSION_ADOBE_DEFLATE = 8,
IMWRITE_TIFF_COMPRESSION_DCS = 32947,
IMWRITE_TIFF_COMPRESSION_JBIG = 34661,
IMWRITE_TIFF_COMPRESSION_SGILOG = 34676,
IMWRITE_TIFF_COMPRESSION_SGILOG24 = 34677,
IMWRITE_TIFF_COMPRESSION_JP2000 = 34712,
IMWRITE_TIFF_COMPRESSION_LERC = 34887,
IMWRITE_TIFF_COMPRESSION_LZMA = 34925,
IMWRITE_TIFF_COMPRESSION_ZSTD = 50000,
IMWRITE_TIFF_COMPRESSION_WEBP = 50001,
IMWRITE_TIFF_COMPRESSION_JXL = 50002
}
enum cv::ImwriteTiffPredictorFlags {
IMWRITE_TIFF_PREDICTOR_NONE = 1,
IMWRITE_TIFF_PREDICTOR_HORIZONTAL = 2,
IMWRITE_TIFF_PREDICTOR_FLOATINGPOINT = 3
}
enum cv::ImwriteTiffResolutionUnitFlags {
IMWRITE_TIFF_RESOLUTION_UNIT_NONE = 1,
IMWRITE_TIFF_RESOLUTION_UNIT_INCH = 2,
IMWRITE_TIFF_RESOLUTION_UNIT_CENTIMETER = 3
}
enum cv::ImwriteWEBPLosslessMode {
IMWRITE_WEBP_LOSSLESS_OFF = 0,
IMWRITE_WEBP_LOSSLESS_ON = 1,
IMWRITE_WEBP_LOSSLESS_PRESERVE_COLOR = 2
}

Imwrite WEBP specific values for IMWRITE_WEBP_LOSSLESS_MODE parameter key. More…

Functions#

bool cv::haveImageReader (const String &filename)

Checks if the specified image file can be decoded by OpenCV.

bool cv::haveImageWriter (const String &filename)

Checks if the specified image file or specified file extension can be encoded by OpenCV.

size_t cv::imcount (const String &filename, int flags=IMREAD_COLOR_BGR)

Returns the number of images inside the given file.

Mat cv::imdecode (InputArray buf, int flags)

Reads an image from a buffer in memory.

Mat cv::imdecode (InputArray buf, int flags, Mat *dst)
bool cv::imdecodeanimation (InputArray buf, Animation &animation, int start=0, int count=INT16_MAX)

Loads frames from an animated image buffer into an Animation structure.

bool cv::imdecodemulti (InputArray buf, int flags, std::vector< Mat > &mats, const cv::Range &range=Range::all())

Reads a multi-page image from a buffer in memory.

Mat cv::imdecodeWithMetadata (InputArray buf, std::vector< int > &metadataTypes, OutputArrayOfArrays metadata, int flags)

Reads an image from a memory buffer and extracts associated metadata.

bool cv::imencode (const String &ext, InputArray img, std::vector< uchar > &buf, const std::vector< int > &params=std::vector< int >())

Encodes an image into a memory buffer.

bool cv::imencodeanimation (const String &ext, const Animation &animation, std::vector< uchar > &buf, const std::vector< int > &params=std::vector< int >())

Encodes an Animation to a memory buffer.

bool cv::imencodemulti (const String &ext, InputArrayOfArrays imgs, std::vector< uchar > &buf, const std::vector< int > &params=std::vector< int >())

Encodes array of images into a memory buffer.

bool cv::imencodeWithMetadata (const String &ext, InputArray img, const std::vector< int > &metadataTypes, InputArrayOfArrays metadata, std::vector< uchar > &buf, const std::vector< int > &params=std::vector< int >())

Encodes an image into a memory buffer.

Mat cv::imread (const String &filename, int flags=IMREAD_COLOR_BGR)

Loads an image from a file.

void cv::imread (const String &filename, OutputArray dst, int flags=IMREAD_COLOR_BGR)

Loads an image from a file.

bool cv::imreadanimation (const String &filename, Animation &animation, int start=0, int count=INT16_MAX)

Loads frames from an animated image file into an Animation structure.

bool cv::imreadmulti (const String &filename, std::vector< Mat > &mats, int flags=IMREAD_COLOR_BGR)

Loads a multi-page image from a file.

bool cv::imreadmulti (const String &filename, std::vector< Mat > &mats, int start, int count, int flags=IMREAD_ANYCOLOR)

Loads images of a multi-page image from a file.

Mat cv::imreadWithMetadata (const String &filename, std::vector< int > &metadataTypes, OutputArrayOfArrays metadata, int flags)

Reads an image from a file along with associated metadata.

bool cv::imwrite (const String &filename, InputArray img, const std::vector< int > &params=std::vector< int >())

Saves an image to a specified file.

bool cv::imwriteanimation (const String &filename, const Animation &animation, const std::vector< int > &params=std::vector< int >())

Saves an Animation to a specified file.

static bool cv::imwritemulti (const String &filename, InputArrayOfArrays img, const std::vector< int > &params=std::vector< int >())

multi-image overload for bindings

bool cv::imwriteWithMetadata (const String &filename, InputArray img, const std::vector< int > &metadataTypes, InputArrayOfArrays &metadata, const std::vector< int > &params=std::vector< int >())

Saves an image to a specified file with metadata.