java.lang.Object
org.opencv.imgcodecs.Imgcodecs
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MatdicomJpgFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from file segments.static MatdicomJpgFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength, int dicomflags) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from file segments.static MatdicomJpgFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength, int dicomflags, int flags) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from file segments.static MatdicomJpgMatRead(Mat buf) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from Mat.static MatdicomJpgMatRead(Mat buf, int dicomflags) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from Mat.static MatdicomJpgMatRead(Mat buf, int dicomflags, int flags) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from Mat.static MatdicomJpgWrite(Mat image, MatOfInt dicomParams, String colormodel) Encodes an DICOM image into a memory buffer.static MatdicomRawFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength, MatOfInt dicomparams, String colormodel) Loads a raw image (include RLE compressed image) from file segments.static MatdicomRawMatRead(Mat buf, MatOfInt dicomParams, String colormodel) Loads a raw image (include RLE compressed image) from Mat.static booleanhaveImageReader(String filename) Returns true if the specified image can be decoded by OpenCVstatic booleanhaveImageWriter(String filename) Returns true if an image with the specified filename can be encoded by OpenCVstatic longReturns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page imagesstatic longReturns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page imagesstatic MatReads an image from a buffer in memory.static booleanimdecodemulti(Mat buf, int flags, List<Mat> mats) Reads a multi-page image from a buffer in memory.static booleanimdecodemulti(Mat buf, int flags, List<Mat> mats, Range range) Reads a multi-page image from a buffer in memory.static booleanEncodes an image into a memory buffer.static booleanEncodes an image into a memory buffer.static MatLoads an image from a file.static MatLoads an image from a file.static booleanimreadmulti(String filename, List<Mat> mats) Loads a multi-page image from a file.static booleanimreadmulti(String filename, List<Mat> mats, int flags) Loads a multi-page image from a file.static booleanimreadmulti(String filename, List<Mat> mats, int start, int count) Loads a of images of a multi-page image from a file.static booleanimreadmulti(String filename, List<Mat> mats, int start, int count, int flags) Loads a of images of a multi-page image from a file.static booleanSaves an image to a specified file.static booleanSaves an image to a specified file.static booleanimwritemulti(String filename, List<Mat> img) static booleanimwritemulti(String filename, List<Mat> img, MatOfInt params)
-
Field Details
-
DICOM_CP_UNKNOWN
public static final int DICOM_CP_UNKNOWN- See Also:
-
DICOM_CP_JPG
public static final int DICOM_CP_JPG- See Also:
-
DICOM_CP_JPLS
public static final int DICOM_CP_JPLS- See Also:
-
DICOM_CP_J2K
public static final int DICOM_CP_J2K- See Also:
-
DICOM_FLAG_DEFAULT
public static final int DICOM_FLAG_DEFAULT- See Also:
-
DICOM_FLAG_UNSIGNED
public static final int DICOM_FLAG_UNSIGNED- See Also:
-
DICOM_FLAG_SIGNED
public static final int DICOM_FLAG_SIGNED- See Also:
-
DICOM_FLAG_YBR
public static final int DICOM_FLAG_YBR- See Also:
-
DICOM_FLAG_BIGENDIAN
public static final int DICOM_FLAG_BIGENDIAN- See Also:
-
DICOM_FLAG_FLOAT
public static final int DICOM_FLAG_FLOAT- See Also:
-
DICOM_FLAG_RLE
public static final int DICOM_FLAG_RLE- See Also:
-
DICOM_FLAG_FORCE_RGB_CONVERSION
public static final int DICOM_FLAG_FORCE_RGB_CONVERSION- See Also:
-
DICOM_PARAM_IMREAD
public static final int DICOM_PARAM_IMREAD- See Also:
-
DICOM_PARAM_DCM_IMREAD
public static final int DICOM_PARAM_DCM_IMREAD- See Also:
-
DICOM_PARAM_WIDTH
public static final int DICOM_PARAM_WIDTH- See Also:
-
DICOM_PARAM_HEIGHT
public static final int DICOM_PARAM_HEIGHT- See Also:
-
DICOM_PARAM_COMPRESSION
public static final int DICOM_PARAM_COMPRESSION- See Also:
-
DICOM_PARAM_COMPONENTS
public static final int DICOM_PARAM_COMPONENTS- See Also:
-
DICOM_PARAM_BITS_PER_SAMPLE
public static final int DICOM_PARAM_BITS_PER_SAMPLE- See Also:
-
DICOM_PARAM_INTERLEAVE_MODE
public static final int DICOM_PARAM_INTERLEAVE_MODE- See Also:
-
DICOM_PARAM_STREAM_VR
public static final int DICOM_PARAM_STREAM_VR- See Also:
-
DICOM_PARAM_COLOR_MODEL
public static final int DICOM_PARAM_COLOR_MODEL- See Also:
-
DICOM_PARAM_JPEG_MODE
public static final int DICOM_PARAM_JPEG_MODE- See Also:
-
DICOM_PARAM_JPEGLS_LOSSY_ERROR
public static final int DICOM_PARAM_JPEGLS_LOSSY_ERROR- See Also:
-
DICOM_PARAM_J2K_COMPRESSION_FACTOR
public static final int DICOM_PARAM_J2K_COMPRESSION_FACTOR- See Also:
-
DICOM_PARAM_JPEG_QUALITY
public static final int DICOM_PARAM_JPEG_QUALITY- See Also:
-
DICOM_PARAM_JPEG_PREDICTION
public static final int DICOM_PARAM_JPEG_PREDICTION- See Also:
-
DICOM_PARAM_JPEG_PT_TRANSFORM
public static final int DICOM_PARAM_JPEG_PT_TRANSFORM- See Also:
-
JPEG_baseline
public static final int JPEG_baseline- See Also:
-
JPEG_sequential
public static final int JPEG_sequential- See Also:
-
JPEG_spectralSelection
public static final int JPEG_spectralSelection- See Also:
-
JPEG_progressive
public static final int JPEG_progressive- See Also:
-
JPEG_lossless
public static final int JPEG_lossless- See Also:
-
POS_IMAGE_DESCRIPTION
public static final int POS_IMAGE_DESCRIPTION- See Also:
-
POS_MAKE
public static final int POS_MAKE- See Also:
-
POS_MODEL
public static final int POS_MODEL- See Also:
-
POS_ORIENTATION
public static final int POS_ORIENTATION- See Also:
-
POS_XRESOLUTION
public static final int POS_XRESOLUTION- See Also:
-
POS_YRESOLUTION
public static final int POS_YRESOLUTION- See Also:
-
POS_RESOLUTION_UNIT
public static final int POS_RESOLUTION_UNIT- See Also:
-
POS_SOFTWARE
public static final int POS_SOFTWARE- See Also:
-
POS_DATE_TIME
public static final int POS_DATE_TIME- See Also:
-
POS_COPYRIGHT
public static final int POS_COPYRIGHT- See Also:
-
IMREAD_UNCHANGED
public static final int IMREAD_UNCHANGED- See Also:
-
IMREAD_GRAYSCALE
public static final int IMREAD_GRAYSCALE- See Also:
-
IMREAD_COLOR
public static final int IMREAD_COLOR- See Also:
-
IMREAD_ANYDEPTH
public static final int IMREAD_ANYDEPTH- See Also:
-
IMREAD_ANYCOLOR
public static final int IMREAD_ANYCOLOR- See Also:
-
IMREAD_LOAD_GDAL
public static final int IMREAD_LOAD_GDAL- See Also:
-
IMREAD_REDUCED_GRAYSCALE_2
public static final int IMREAD_REDUCED_GRAYSCALE_2- See Also:
-
IMREAD_REDUCED_COLOR_2
public static final int IMREAD_REDUCED_COLOR_2- See Also:
-
IMREAD_REDUCED_GRAYSCALE_4
public static final int IMREAD_REDUCED_GRAYSCALE_4- See Also:
-
IMREAD_REDUCED_COLOR_4
public static final int IMREAD_REDUCED_COLOR_4- See Also:
-
IMREAD_REDUCED_GRAYSCALE_8
public static final int IMREAD_REDUCED_GRAYSCALE_8- See Also:
-
IMREAD_REDUCED_COLOR_8
public static final int IMREAD_REDUCED_COLOR_8- See Also:
-
IMREAD_IGNORE_ORIENTATION
public static final int IMREAD_IGNORE_ORIENTATION- See Also:
-
IMWRITE_EXR_COMPRESSION_NO
public static final int IMWRITE_EXR_COMPRESSION_NO- See Also:
-
IMWRITE_EXR_COMPRESSION_RLE
public static final int IMWRITE_EXR_COMPRESSION_RLE- See Also:
-
IMWRITE_EXR_COMPRESSION_ZIPS
public static final int IMWRITE_EXR_COMPRESSION_ZIPS- See Also:
-
IMWRITE_EXR_COMPRESSION_ZIP
public static final int IMWRITE_EXR_COMPRESSION_ZIP- See Also:
-
IMWRITE_EXR_COMPRESSION_PIZ
public static final int IMWRITE_EXR_COMPRESSION_PIZ- See Also:
-
IMWRITE_EXR_COMPRESSION_PXR24
public static final int IMWRITE_EXR_COMPRESSION_PXR24- See Also:
-
IMWRITE_EXR_COMPRESSION_B44
public static final int IMWRITE_EXR_COMPRESSION_B44- See Also:
-
IMWRITE_EXR_COMPRESSION_B44A
public static final int IMWRITE_EXR_COMPRESSION_B44A- See Also:
-
IMWRITE_EXR_COMPRESSION_DWAA
public static final int IMWRITE_EXR_COMPRESSION_DWAA- See Also:
-
IMWRITE_EXR_COMPRESSION_DWAB
public static final int IMWRITE_EXR_COMPRESSION_DWAB- See Also:
-
IMWRITE_EXR_TYPE_HALF
public static final int IMWRITE_EXR_TYPE_HALF- See Also:
-
IMWRITE_EXR_TYPE_FLOAT
public static final int IMWRITE_EXR_TYPE_FLOAT- See Also:
-
IMWRITE_JPEG_QUALITY
public static final int IMWRITE_JPEG_QUALITY- See Also:
-
IMWRITE_JPEG_PROGRESSIVE
public static final int IMWRITE_JPEG_PROGRESSIVE- See Also:
-
IMWRITE_JPEG_OPTIMIZE
public static final int IMWRITE_JPEG_OPTIMIZE- See Also:
-
IMWRITE_JPEG_RST_INTERVAL
public static final int IMWRITE_JPEG_RST_INTERVAL- See Also:
-
IMWRITE_JPEG_LUMA_QUALITY
public static final int IMWRITE_JPEG_LUMA_QUALITY- See Also:
-
IMWRITE_JPEG_CHROMA_QUALITY
public static final int IMWRITE_JPEG_CHROMA_QUALITY- See Also:
-
IMWRITE_JPEG_SAMPLING_FACTOR
public static final int IMWRITE_JPEG_SAMPLING_FACTOR- See Also:
-
IMWRITE_PNG_COMPRESSION
public static final int IMWRITE_PNG_COMPRESSION- See Also:
-
IMWRITE_PNG_STRATEGY
public static final int IMWRITE_PNG_STRATEGY- See Also:
-
IMWRITE_PNG_BILEVEL
public static final int IMWRITE_PNG_BILEVEL- See Also:
-
IMWRITE_PXM_BINARY
public static final int IMWRITE_PXM_BINARY- See Also:
-
IMWRITE_EXR_TYPE
public static final int IMWRITE_EXR_TYPE- See Also:
-
IMWRITE_EXR_COMPRESSION
public static final int IMWRITE_EXR_COMPRESSION- See Also:
-
IMWRITE_EXR_DWA_COMPRESSION_LEVEL
public static final int IMWRITE_EXR_DWA_COMPRESSION_LEVEL- See Also:
-
IMWRITE_WEBP_QUALITY
public static final int IMWRITE_WEBP_QUALITY- See Also:
-
IMWRITE_HDR_COMPRESSION
public static final int IMWRITE_HDR_COMPRESSION- See Also:
-
IMWRITE_PAM_TUPLETYPE
public static final int IMWRITE_PAM_TUPLETYPE- See Also:
-
IMWRITE_TIFF_RESUNIT
public static final int IMWRITE_TIFF_RESUNIT- See Also:
-
IMWRITE_TIFF_XDPI
public static final int IMWRITE_TIFF_XDPI- See Also:
-
IMWRITE_TIFF_YDPI
public static final int IMWRITE_TIFF_YDPI- See Also:
-
IMWRITE_TIFF_COMPRESSION
public static final int IMWRITE_TIFF_COMPRESSION- See Also:
-
IMWRITE_JPEG2000_COMPRESSION_X1000
public static final int IMWRITE_JPEG2000_COMPRESSION_X1000- See Also:
-
IMWRITE_AVIF_QUALITY
public static final int IMWRITE_AVIF_QUALITY- See Also:
-
IMWRITE_AVIF_DEPTH
public static final int IMWRITE_AVIF_DEPTH- See Also:
-
IMWRITE_AVIF_SPEED
public static final int IMWRITE_AVIF_SPEED- See Also:
-
IMWRITE_HDR_COMPRESSION_NONE
public static final int IMWRITE_HDR_COMPRESSION_NONE- See Also:
-
IMWRITE_HDR_COMPRESSION_RLE
public static final int IMWRITE_HDR_COMPRESSION_RLE- See Also:
-
IMWRITE_JPEG_SAMPLING_FACTOR_411
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_411- See Also:
-
IMWRITE_JPEG_SAMPLING_FACTOR_420
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_420- See Also:
-
IMWRITE_JPEG_SAMPLING_FACTOR_422
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_422- See Also:
-
IMWRITE_JPEG_SAMPLING_FACTOR_440
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_440- See Also:
-
IMWRITE_JPEG_SAMPLING_FACTOR_444
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_444- See Also:
-
IMWRITE_PAM_FORMAT_NULL
public static final int IMWRITE_PAM_FORMAT_NULL- See Also:
-
IMWRITE_PAM_FORMAT_BLACKANDWHITE
public static final int IMWRITE_PAM_FORMAT_BLACKANDWHITE- See Also:
-
IMWRITE_PAM_FORMAT_GRAYSCALE
public static final int IMWRITE_PAM_FORMAT_GRAYSCALE- See Also:
-
IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA
public static final int IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA- See Also:
-
IMWRITE_PAM_FORMAT_RGB
public static final int IMWRITE_PAM_FORMAT_RGB- See Also:
-
IMWRITE_PAM_FORMAT_RGB_ALPHA
public static final int IMWRITE_PAM_FORMAT_RGB_ALPHA- See Also:
-
IMWRITE_PNG_STRATEGY_DEFAULT
public static final int IMWRITE_PNG_STRATEGY_DEFAULT- See Also:
-
IMWRITE_PNG_STRATEGY_FILTERED
public static final int IMWRITE_PNG_STRATEGY_FILTERED- See Also:
-
IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY
public static final int IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY- See Also:
-
IMWRITE_PNG_STRATEGY_RLE
public static final int IMWRITE_PNG_STRATEGY_RLE- See Also:
-
IMWRITE_PNG_STRATEGY_FIXED
public static final int IMWRITE_PNG_STRATEGY_FIXED- See Also:
-
EPI_Unknown
public static final int EPI_Unknown- See Also:
-
EPI_Missing
public static final int EPI_Missing- See Also:
-
EPI_Monochrome1
public static final int EPI_Monochrome1- See Also:
-
EPI_Monochrome2
public static final int EPI_Monochrome2- See Also:
-
EPI_PaletteColor
public static final int EPI_PaletteColor- See Also:
-
EPI_RGB
public static final int EPI_RGB- See Also:
-
EPI_HSV
public static final int EPI_HSV- See Also:
-
EPI_ARGB
public static final int EPI_ARGB- See Also:
-
EPI_CMYK
public static final int EPI_CMYK- See Also:
-
EPI_YBR_Full
public static final int EPI_YBR_Full- See Also:
-
EPI_YBR_Full_422
public static final int EPI_YBR_Full_422- See Also:
-
EPI_YBR_Partial_422
public static final int EPI_YBR_Partial_422- See Also:
-
ILV_NONE
public static final int ILV_NONE- See Also:
-
ILV_LINE
public static final int ILV_LINE- See Also:
-
ILV_SAMPLE
public static final int ILV_SAMPLE- See Also:
-
-
Constructor Details
-
Imgcodecs
public Imgcodecs()
-
-
Method Details
-
imread
Loads an image from a file. imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported:- Windows bitmaps - \*.bmp, \*.dib (always supported)
- JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Note* section)
- JPEG 2000 files - \*.jp2 (see the *Note* section)
- Portable Network Graphics - \*.png (see the *Note* section)
- WebP - \*.webp (see the *Note* section)
- AVIF - \*.avif (see the *Note* section)
- Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
- PFM files - \*.pfm (see the *Note* section)
- Sun rasters - \*.sr, \*.ras (always supported)
- TIFF files - \*.tiff, \*.tif (see the *Note* section)
- OpenEXR Image files - \*.exr (see the *Note* section)
- Radiance HDR - \*.hdr, \*.pic (always supported)
- Raster and Vector geospatial data supported by GDAL (see the *Note* section)
- The function determines the type of an image by the content, not by the file extension.
- In the case of color images, the decoded images will have the channels stored in B G R order.
- When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available. Results may differ to the output of cvtColor()
- On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware that currently these native image loaders give images with different pixel values because of the color management embedded into MacOSX.
- On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
- In the case you set *WITH_GDAL* flag to true in CMake and REF: IMREAD_LOAD_GDAL to load the image, then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting the following formats: [Raster](http://www.gdal.org/formats_list.html), [Vector](http://www.gdal.org/ogr_formats.html).
- If EXIF information is embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flags REF: IMREAD_IGNORE_ORIENTATION or REF: IMREAD_UNCHANGED are passed.
- Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
- By default number of pixels must be less than 2^30. Limit can be set using system variable OPENCV_IO_MAX_IMAGE_PIXELS
- Parameters:
filename- Name of file to be loaded.tags- Output parameter for returning the list of EXIF tagsflags- Flag that can take values of cv::ImreadModes- Returns:
- automatically generated
-
imread
Loads an image from a file. imread The function imread loads an image from the specified file and returns it. If the image cannot be read (because of missing file, improper permissions, unsupported or invalid format), the function returns an empty matrix ( Mat::data==NULL ). Currently, the following file formats are supported:- Windows bitmaps - \*.bmp, \*.dib (always supported)
- JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Note* section)
- JPEG 2000 files - \*.jp2 (see the *Note* section)
- Portable Network Graphics - \*.png (see the *Note* section)
- WebP - \*.webp (see the *Note* section)
- AVIF - \*.avif (see the *Note* section)
- Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
- PFM files - \*.pfm (see the *Note* section)
- Sun rasters - \*.sr, \*.ras (always supported)
- TIFF files - \*.tiff, \*.tif (see the *Note* section)
- OpenEXR Image files - \*.exr (see the *Note* section)
- Radiance HDR - \*.hdr, \*.pic (always supported)
- Raster and Vector geospatial data supported by GDAL (see the *Note* section)
- The function determines the type of an image by the content, not by the file extension.
- In the case of color images, the decoded images will have the channels stored in B G R order.
- When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available. Results may differ to the output of cvtColor()
- On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg, libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs, and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware that currently these native image loaders give images with different pixel values because of the color management embedded into MacOSX.
- On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for codecs supplied with an OS image. Install the relevant packages (do not forget the development files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
- In the case you set *WITH_GDAL* flag to true in CMake and REF: IMREAD_LOAD_GDAL to load the image, then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting the following formats: [Raster](http://www.gdal.org/formats_list.html), [Vector](http://www.gdal.org/ogr_formats.html).
- If EXIF information is embedded in the image file, the EXIF orientation will be taken into account and thus the image will be rotated accordingly except if the flags REF: IMREAD_IGNORE_ORIENTATION or REF: IMREAD_UNCHANGED are passed.
- Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
- By default number of pixels must be less than 2^30. Limit can be set using system variable OPENCV_IO_MAX_IMAGE_PIXELS
- Parameters:
filename- Name of file to be loaded.tags- Output parameter for returning the list of EXIF tags- Returns:
- automatically generated
-
dicomJpgFileRead
public static Mat dicomJpgFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength, int dicomflags, int flags) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from file segments. The function dicomJpgRead loads a DICOM image from the specified file into Mat.- Parameters:
filename- Name of file to be loaded.segposition- A vector of double holding the position of each fragment to read.seglength- A vector of double holding the length of each fragment to read.dicomflags- specific DICOM Flags (signed, ybr). Default is unsigned data. See DICOM_IMREAD in grfmt_dcm_dicom.hpp.flags- Flag that can take values of cv::ImreadModes.- Returns:
- automatically generated
-
dicomJpgFileRead
public static Mat dicomJpgFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength, int dicomflags) Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from file segments. The function dicomJpgRead loads a DICOM image from the specified file into Mat.- Parameters:
filename- Name of file to be loaded.segposition- A vector of double holding the position of each fragment to read.seglength- A vector of double holding the length of each fragment to read.dicomflags- specific DICOM Flags (signed, ybr). Default is unsigned data. See DICOM_IMREAD in grfmt_dcm_dicom.hpp.- Returns:
- automatically generated
-
dicomJpgFileRead
Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from file segments. The function dicomJpgRead loads a DICOM image from the specified file into Mat.- Parameters:
filename- Name of file to be loaded.segposition- A vector of double holding the position of each fragment to read.seglength- A vector of double holding the length of each fragment to read.- Returns:
- automatically generated
-
dicomJpgMatRead
Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from Mat. The function dicomJpgRead loads a DICOM image from a specified byte array into Mat.- Parameters:
buf- the raw byte data of jpg image (1 raw, x column).dicomflags- specific DICOM Flags (signed, ybr). Default is unsigned data. See DICOM_IMREAD in grfmt_dcm_dicom.hpp.flags- Flag that can take values of cv::ImreadModes.- Returns:
- automatically generated
-
dicomJpgMatRead
Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from Mat. The function dicomJpgRead loads a DICOM image from a specified byte array into Mat.- Parameters:
buf- the raw byte data of jpg image (1 raw, x column).dicomflags- specific DICOM Flags (signed, ybr). Default is unsigned data. See DICOM_IMREAD in grfmt_dcm_dicom.hpp.- Returns:
- automatically generated
-
dicomJpgMatRead
Loads a jpeg image (jpeg, jpeg-losseless, jpeg-ls and jpeg-2000) from Mat. The function dicomJpgRead loads a DICOM image from a specified byte array into Mat.- Parameters:
buf- the raw byte data of jpg image (1 raw, x column).- Returns:
- automatically generated
-
dicomRawFileRead
public static Mat dicomRawFileRead(String filename, MatOfDouble segposition, MatOfDouble seglength, MatOfInt dicomparams, String colormodel) Loads a raw image (include RLE compressed image) from file segments. The function dicomRawRead loads a DICOM image from the specified file into Mat.- Parameters:
filename- Name of file to be loaded.segposition- The position of the image to read.seglength- The length image to read.dicomparams- automatically generatedcolormodel- The image color model.- Returns:
- automatically generated
-
dicomRawMatRead
Loads a raw image (include RLE compressed image) from Mat. The function dicomRawRead loads a DICOM image from a specified byte array into Mat.- Parameters:
buf- the raw byte data of jpg image (1 raw, x column).dicomParams- A vector of int containing the specific DICOM parameters. See DICOM_PARAM in grfmt_dcm_dicom.hpp.colormodel- The image color model.- Returns:
- automatically generated
-
dicomJpgWrite
Encodes an DICOM image into a memory buffer.- Parameters:
image- automatically generateddicomParams- automatically generatedcolormodel- The image color model.- Returns:
- automatically generated
-
imreadmulti
Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects.- Parameters:
filename- Name of file to be loaded.mats- A vector of Mat objects holding each page.flags- Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR. SEE: cv::imread- Returns:
- automatically generated
-
imreadmulti
Loads a multi-page image from a file. The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects.- Parameters:
filename- Name of file to be loaded.mats- A vector of Mat objects holding each page. SEE: cv::imread- Returns:
- automatically generated
-
imreadmulti
Loads a of images of a multi-page image from a file. The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects.- Parameters:
filename- Name of file to be loaded.mats- A vector of Mat objects holding each page.start- Start index of the image to loadcount- Count number of images to loadflags- Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR. SEE: cv::imread- Returns:
- automatically generated
-
imreadmulti
Loads a of images of a multi-page image from a file. The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects.- Parameters:
filename- Name of file to be loaded.mats- A vector of Mat objects holding each page.start- Start index of the image to loadcount- Count number of images to load SEE: cv::imread- Returns:
- automatically generated
-
imcount
Returns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page images- Parameters:
filename- Name of file to be loaded.flags- Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.- Returns:
- automatically generated
-
imcount
Returns the number of images inside the give file The function imcount will return the number of pages in a multi-page image, or 1 for single-page images- Parameters:
filename- Name of file to be loaded.- Returns:
- automatically generated
-
imwrite
Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). In general, only 8-bit unsigned (CV_8U) single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function, with these exceptions:- With OpenEXR encoder, only 32-bit float (CV_32F) images can be saved.
- 8-bit unsigned (CV_8U) images are not supported.
- With Radiance HDR encoder, non 64-bit float (CV_64F) images can be saved.
- All images will be converted to 32-bit float (CV_32F).
- With JPEG 2000 encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- With PAM encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- With PNG encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- PNG images with an alpha channel can be saved using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).
- With PGM/PPM encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- With TIFF encoder, 8-bit unsigned (CV_8U), 16-bit unsigned (CV_16U), 32-bit float (CV_32F) and 64-bit float
(CV_64F) images can be saved.
- Multiple images (vector of Mat) can be saved in TIFF format (see the code sample below).
- 32-bit float 3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding (4 bytes per pixel)
- Parameters:
filename- Name of the file.img- (Mat or vector of Mat) Image or Images to be saved.params- Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags- Returns:
- automatically generated
- With OpenEXR encoder, only 32-bit float (CV_32F) images can be saved.
-
imwrite
Saves an image to a specified file. The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see cv::imread for the list of extensions). In general, only 8-bit unsigned (CV_8U) single-channel or 3-channel (with 'BGR' channel order) images can be saved using this function, with these exceptions:- With OpenEXR encoder, only 32-bit float (CV_32F) images can be saved.
- 8-bit unsigned (CV_8U) images are not supported.
- With Radiance HDR encoder, non 64-bit float (CV_64F) images can be saved.
- All images will be converted to 32-bit float (CV_32F).
- With JPEG 2000 encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- With PAM encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- With PNG encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- PNG images with an alpha channel can be saved using this function. To do this, create 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).
- With PGM/PPM encoder, 8-bit unsigned (CV_8U) and 16-bit unsigned (CV_16U) images can be saved.
- With TIFF encoder, 8-bit unsigned (CV_8U), 16-bit unsigned (CV_16U), 32-bit float (CV_32F) and 64-bit float
(CV_64F) images can be saved.
- Multiple images (vector of Mat) can be saved in TIFF format (see the code sample below).
- 32-bit float 3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding (4 bytes per pixel)
- Parameters:
filename- Name of the file.img- (Mat or vector of Mat) Image or Images to be saved.- Returns:
- automatically generated
- With OpenEXR encoder, only 32-bit float (CV_32F) images can be saved.
-
imwritemulti
-
imwritemulti
-
imdecode
Reads an image from a buffer in memory. The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or contains invalid data, the function returns an empty matrix ( Mat::data==NULL ). See cv::imread for the list of supported formats and flags description. Note: In the case of color images, the decoded images will have the channels stored in B G R order.- Parameters:
buf- Input array or vector of bytes.flags- The same flags as in cv::imread, see cv::ImreadModes.- Returns:
- automatically generated
-
imdecodemulti
Reads a multi-page image from a buffer in memory. The function imdecodemulti reads a multi-page image from the specified buffer in the memory. If the buffer is too short or contains invalid data, the function returns false. See cv::imreadmulti for the list of supported formats and flags description. Note: In the case of color images, the decoded images will have the channels stored in B G R order.- Parameters:
buf- Input array or vector of bytes.flags- The same flags as in cv::imread, see cv::ImreadModes.mats- A vector of Mat objects holding each page, if more than one.range- A continuous selection of pages.- Returns:
- automatically generated
-
imdecodemulti
Reads a multi-page image from a buffer in memory. The function imdecodemulti reads a multi-page image from the specified buffer in the memory. If the buffer is too short or contains invalid data, the function returns false. See cv::imreadmulti for the list of supported formats and flags description. Note: In the case of color images, the decoded images will have the channels stored in B G R order.- Parameters:
buf- Input array or vector of bytes.flags- The same flags as in cv::imread, see cv::ImreadModes.mats- A vector of Mat objects holding each page, if more than one.- Returns:
- automatically generated
-
imencode
Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.- Parameters:
ext- File extension that defines the output format. Must include a leading period.img- Image to be written.buf- Output buffer resized to fit the compressed image.params- Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.- Returns:
- automatically generated
-
imencode
Encodes an image into a memory buffer. The function imencode compresses the image and stores it in the memory buffer that is resized to fit the result. See cv::imwrite for the list of supported formats and flags description.- Parameters:
ext- File extension that defines the output format. Must include a leading period.img- Image to be written.buf- Output buffer resized to fit the compressed image.- Returns:
- automatically generated
-
haveImageReader
Returns true if the specified image can be decoded by OpenCV- Parameters:
filename- File name of the image- Returns:
- automatically generated
-
haveImageWriter
Returns true if an image with the specified filename can be encoded by OpenCV- Parameters:
filename- File name of the image- Returns:
- automatically generated
-