public class Imgcodecs extends Object
Constructor and Description |
---|
Imgcodecs() |
Modifier and Type | Method and Description |
---|---|
static boolean |
haveImageReader(String filename)
Returns true if the specified image can be decoded by OpenCV
|
static boolean |
haveImageWriter(String filename)
Returns true if an image with the specified filename can be encoded by OpenCV
|
static long |
imcount(String filename)
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
|
static long |
imcount(String filename,
int flags)
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
|
static Mat |
imdecode(Mat buf,
int flags)
Reads an image from a buffer in memory.
|
static boolean |
imdecodemulti(Mat buf,
int flags,
List<Mat> mats)
Reads a multi-page image from a buffer in memory.
|
static boolean |
imdecodemulti(Mat buf,
int flags,
List<Mat> mats,
Range range)
Reads a multi-page image from a buffer in memory.
|
static boolean |
imencode(String ext,
Mat img,
MatOfByte buf)
Encodes an image into a memory buffer.
|
static boolean |
imencode(String ext,
Mat img,
MatOfByte buf,
MatOfInt params)
Encodes an image into a memory buffer.
|
static Mat |
imread(String filename)
Loads an image from a file.
|
static Mat |
imread(String filename,
int flags)
Loads an image from a file.
|
static void |
imread(String filename,
Mat dst)
Loads an image from a file.
|
static void |
imread(String filename,
Mat dst,
int flags)
Loads an image from a file.
|
static boolean |
imreadmulti(String filename,
List<Mat> mats)
Loads a multi-page image from a file.
|
static boolean |
imreadmulti(String filename,
List<Mat> mats,
int flags)
Loads a multi-page image from a file.
|
static boolean |
imreadmulti(String filename,
List<Mat> mats,
int start,
int count)
Loads a of images of a multi-page image from a file.
|
static boolean |
imreadmulti(String filename,
List<Mat> mats,
int start,
int count,
int flags)
Loads a of images of a multi-page image from a file.
|
static boolean |
imwrite(String filename,
Mat img)
Saves an image to a specified file.
|
static boolean |
imwrite(String filename,
Mat img,
MatOfInt params)
Saves an image to a specified file.
|
static boolean |
imwritemulti(String filename,
List<Mat> img) |
static boolean |
imwritemulti(String filename,
List<Mat> img,
MatOfInt params) |
public static final int IMREAD_UNCHANGED
public static final int IMREAD_GRAYSCALE
public static final int IMREAD_COLOR
public static final int IMREAD_ANYDEPTH
public static final int IMREAD_ANYCOLOR
public static final int IMREAD_LOAD_GDAL
public static final int IMREAD_REDUCED_GRAYSCALE_2
public static final int IMREAD_REDUCED_COLOR_2
public static final int IMREAD_REDUCED_GRAYSCALE_4
public static final int IMREAD_REDUCED_COLOR_4
public static final int IMREAD_REDUCED_GRAYSCALE_8
public static final int IMREAD_REDUCED_COLOR_8
public static final int IMREAD_IGNORE_ORIENTATION
public static final int IMWRITE_EXR_COMPRESSION_NO
public static final int IMWRITE_EXR_COMPRESSION_RLE
public static final int IMWRITE_EXR_COMPRESSION_ZIPS
public static final int IMWRITE_EXR_COMPRESSION_ZIP
public static final int IMWRITE_EXR_COMPRESSION_PIZ
public static final int IMWRITE_EXR_COMPRESSION_PXR24
public static final int IMWRITE_EXR_COMPRESSION_B44
public static final int IMWRITE_EXR_COMPRESSION_B44A
public static final int IMWRITE_EXR_COMPRESSION_DWAA
public static final int IMWRITE_EXR_COMPRESSION_DWAB
public static final int IMWRITE_EXR_TYPE_HALF
public static final int IMWRITE_EXR_TYPE_FLOAT
public static final int IMWRITE_JPEG_QUALITY
public static final int IMWRITE_JPEG_PROGRESSIVE
public static final int IMWRITE_JPEG_OPTIMIZE
public static final int IMWRITE_JPEG_RST_INTERVAL
public static final int IMWRITE_JPEG_LUMA_QUALITY
public static final int IMWRITE_JPEG_CHROMA_QUALITY
public static final int IMWRITE_JPEG_SAMPLING_FACTOR
public static final int IMWRITE_PNG_COMPRESSION
public static final int IMWRITE_PNG_STRATEGY
public static final int IMWRITE_PNG_BILEVEL
public static final int IMWRITE_PXM_BINARY
public static final int IMWRITE_EXR_TYPE
public static final int IMWRITE_EXR_COMPRESSION
public static final int IMWRITE_EXR_DWA_COMPRESSION_LEVEL
public static final int IMWRITE_WEBP_QUALITY
public static final int IMWRITE_HDR_COMPRESSION
public static final int IMWRITE_PAM_TUPLETYPE
public static final int IMWRITE_TIFF_RESUNIT
public static final int IMWRITE_TIFF_XDPI
public static final int IMWRITE_TIFF_YDPI
public static final int IMWRITE_TIFF_COMPRESSION
public static final int IMWRITE_TIFF_ROWSPERSTRIP
public static final int IMWRITE_TIFF_PREDICTOR
public static final int IMWRITE_JPEG2000_COMPRESSION_X1000
public static final int IMWRITE_AVIF_QUALITY
public static final int IMWRITE_AVIF_DEPTH
public static final int IMWRITE_AVIF_SPEED
public static final int IMWRITE_HDR_COMPRESSION_NONE
public static final int IMWRITE_HDR_COMPRESSION_RLE
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_411
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_420
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_422
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_440
public static final int IMWRITE_JPEG_SAMPLING_FACTOR_444
public static final int IMWRITE_PAM_FORMAT_NULL
public static final int IMWRITE_PAM_FORMAT_BLACKANDWHITE
public static final int IMWRITE_PAM_FORMAT_GRAYSCALE
public static final int IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA
public static final int IMWRITE_PAM_FORMAT_RGB
public static final int IMWRITE_PAM_FORMAT_RGB_ALPHA
public static final int IMWRITE_PNG_STRATEGY_DEFAULT
public static final int IMWRITE_PNG_STRATEGY_FILTERED
public static final int IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY
public static final int IMWRITE_PNG_STRATEGY_RLE
public static final int IMWRITE_PNG_STRATEGY_FIXED
public static final int IMWRITE_TIFF_COMPRESSION_NONE
public static final int IMWRITE_TIFF_COMPRESSION_CCITTRLE
public static final int IMWRITE_TIFF_COMPRESSION_CCITTFAX3
public static final int IMWRITE_TIFF_COMPRESSION_CCITT_T4
public static final int IMWRITE_TIFF_COMPRESSION_CCITTFAX4
public static final int IMWRITE_TIFF_COMPRESSION_CCITT_T6
public static final int IMWRITE_TIFF_COMPRESSION_LZW
public static final int IMWRITE_TIFF_COMPRESSION_OJPEG
public static final int IMWRITE_TIFF_COMPRESSION_JPEG
public static final int IMWRITE_TIFF_COMPRESSION_T85
public static final int IMWRITE_TIFF_COMPRESSION_T43
public static final int IMWRITE_TIFF_COMPRESSION_NEXT
public static final int IMWRITE_TIFF_COMPRESSION_CCITTRLEW
public static final int IMWRITE_TIFF_COMPRESSION_PACKBITS
public static final int IMWRITE_TIFF_COMPRESSION_THUNDERSCAN
public static final int IMWRITE_TIFF_COMPRESSION_IT8CTPAD
public static final int IMWRITE_TIFF_COMPRESSION_IT8LW
public static final int IMWRITE_TIFF_COMPRESSION_IT8MP
public static final int IMWRITE_TIFF_COMPRESSION_IT8BL
public static final int IMWRITE_TIFF_COMPRESSION_PIXARFILM
public static final int IMWRITE_TIFF_COMPRESSION_PIXARLOG
public static final int IMWRITE_TIFF_COMPRESSION_DEFLATE
public static final int IMWRITE_TIFF_COMPRESSION_ADOBE_DEFLATE
public static final int IMWRITE_TIFF_COMPRESSION_DCS
public static final int IMWRITE_TIFF_COMPRESSION_JBIG
public static final int IMWRITE_TIFF_COMPRESSION_SGILOG
public static final int IMWRITE_TIFF_COMPRESSION_SGILOG24
public static final int IMWRITE_TIFF_COMPRESSION_JP2000
public static final int IMWRITE_TIFF_COMPRESSION_LERC
public static final int IMWRITE_TIFF_COMPRESSION_LZMA
public static final int IMWRITE_TIFF_COMPRESSION_ZSTD
public static final int IMWRITE_TIFF_COMPRESSION_WEBP
public static final int IMWRITE_TIFF_COMPRESSION_JXL
public static final int IMWRITE_TIFF_PREDICTOR_NONE
public static final int IMWRITE_TIFF_PREDICTOR_HORIZONTAL
public static final int IMWRITE_TIFF_PREDICTOR_FLOATINGPOINT
public static Mat imread(String filename, int flags)
filename
- Name of file to be loaded.flags
- Flag that can take values of cv::ImreadModespublic static Mat imread(String filename)
filename
- Name of file to be loaded.public static void imread(String filename, Mat dst, int flags)
filename
- Name of file to be loaded.dst
- object in which the image will be loaded.flags
- Flag that can take values of cv::ImreadModes
Note:
The image passing through the img parameter can be pre-allocated. The memory is reused if the shape and the type match with the load image.public static void imread(String filename, Mat dst)
filename
- Name of file to be loaded.dst
- object in which the image will be loaded.
Note:
The image passing through the img parameter can be pre-allocated. The memory is reused if the shape and the type match with the load image.public static boolean imreadmulti(String filename, List<Mat> mats, int flags)
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::imreadpublic static boolean imreadmulti(String filename, List<Mat> mats)
filename
- Name of file to be loaded.mats
- A vector of Mat objects holding each page.
SEE: cv::imreadpublic static boolean imreadmulti(String filename, List<Mat> mats, int start, int count, int flags)
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::imreadpublic static boolean imreadmulti(String filename, List<Mat> mats, int start, int count)
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::imreadpublic static long imcount(String filename, int flags)
filename
- Name of file to be loaded.flags
- Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.public static long imcount(String filename)
filename
- Name of file to be loaded.public static boolean imwrite(String filename, Mat img, MatOfInt params)
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::ImwriteFlagspublic static boolean imwrite(String filename, Mat img)
filename
- Name of the file.img
- (Mat or vector of Mat) Image or Images to be saved.public static Mat imdecode(Mat buf, int flags)
buf
- Input array or vector of bytes.flags
- The same flags as in cv::imread, see cv::ImreadModes.public static boolean imdecodemulti(Mat buf, int flags, List<Mat> mats, Range range)
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.public static boolean imdecodemulti(Mat buf, int flags, List<Mat> mats)
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.public static boolean imencode(String ext, Mat img, MatOfByte buf, MatOfInt params)
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.public static boolean imencode(String ext, Mat img, MatOfByte buf)
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.public static boolean haveImageReader(String filename)
filename
- File name of the imagepublic static boolean haveImageWriter(String filename)
filename
- File name of the imageCopyright © 2024. All rights reserved.