opencv2/imgcodecs.hpp#
#include <opencv2/core.hpp>
Include dependency graph for imgcodecs.hpp:
This graph shows which files directly or indirectly include imgcodecs.hpp:
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 > ¶ms=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 > ¶ms=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 > ¶ms=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 > ¶ms=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 > ¶ms=std::vector< int >())
Saves an image to a specified file.
bool cv::imwriteanimation (const String &filename, const Animation &animation, const std::vector< int > ¶ms=std::vector< int >())
Saves an Animation to a specified file.
static bool cv::imwritemulti (const String &filename, InputArrayOfArrays img, const std::vector< int > ¶ms=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 > ¶ms=std::vector< int >())
Saves an image to a specified file with metadata.