001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.imgcodecs;
005
006import java.util.ArrayList;
007import java.util.List;
008import org.opencv.core.Mat;
009import org.opencv.core.MatOfByte;
010import org.opencv.core.MatOfInt;
011import org.opencv.utils.Converters;
012
013// C++: class Imgcodecs
014
015public class Imgcodecs {
016
017    // C++: enum ImreadModes (cv.ImreadModes)
018    public static final int
019            IMREAD_UNCHANGED = -1,
020            IMREAD_GRAYSCALE = 0,
021            IMREAD_COLOR = 1,
022            IMREAD_ANYDEPTH = 2,
023            IMREAD_ANYCOLOR = 4,
024            IMREAD_LOAD_GDAL = 8,
025            IMREAD_REDUCED_GRAYSCALE_2 = 16,
026            IMREAD_REDUCED_COLOR_2 = 17,
027            IMREAD_REDUCED_GRAYSCALE_4 = 32,
028            IMREAD_REDUCED_COLOR_4 = 33,
029            IMREAD_REDUCED_GRAYSCALE_8 = 64,
030            IMREAD_REDUCED_COLOR_8 = 65,
031            IMREAD_IGNORE_ORIENTATION = 128;
032
033
034    // C++: enum ImwriteEXRCompressionFlags (cv.ImwriteEXRCompressionFlags)
035    public static final int
036            IMWRITE_EXR_COMPRESSION_NO = 0,
037            IMWRITE_EXR_COMPRESSION_RLE = 1,
038            IMWRITE_EXR_COMPRESSION_ZIPS = 2,
039            IMWRITE_EXR_COMPRESSION_ZIP = 3,
040            IMWRITE_EXR_COMPRESSION_PIZ = 4,
041            IMWRITE_EXR_COMPRESSION_PXR24 = 5,
042            IMWRITE_EXR_COMPRESSION_B44 = 6,
043            IMWRITE_EXR_COMPRESSION_B44A = 7,
044            IMWRITE_EXR_COMPRESSION_DWAA = 8,
045            IMWRITE_EXR_COMPRESSION_DWAB = 9;
046
047
048    // C++: enum ImwriteEXRTypeFlags (cv.ImwriteEXRTypeFlags)
049    public static final int
050            IMWRITE_EXR_TYPE_HALF = 1,
051            IMWRITE_EXR_TYPE_FLOAT = 2;
052
053
054    // C++: enum ImwriteFlags (cv.ImwriteFlags)
055    public static final int
056            IMWRITE_JPEG_QUALITY = 1,
057            IMWRITE_JPEG_PROGRESSIVE = 2,
058            IMWRITE_JPEG_OPTIMIZE = 3,
059            IMWRITE_JPEG_RST_INTERVAL = 4,
060            IMWRITE_JPEG_LUMA_QUALITY = 5,
061            IMWRITE_JPEG_CHROMA_QUALITY = 6,
062            IMWRITE_PNG_COMPRESSION = 16,
063            IMWRITE_PNG_STRATEGY = 17,
064            IMWRITE_PNG_BILEVEL = 18,
065            IMWRITE_PXM_BINARY = 32,
066            IMWRITE_EXR_TYPE = (3 << 4) + 0,
067            IMWRITE_EXR_COMPRESSION = (3 << 4) + 1,
068            IMWRITE_WEBP_QUALITY = 64,
069            IMWRITE_PAM_TUPLETYPE = 128,
070            IMWRITE_TIFF_RESUNIT = 256,
071            IMWRITE_TIFF_XDPI = 257,
072            IMWRITE_TIFF_YDPI = 258,
073            IMWRITE_TIFF_COMPRESSION = 259,
074            IMWRITE_JPEG2000_COMPRESSION_X1000 = 272;
075
076
077    // C++: enum ImwritePAMFlags (cv.ImwritePAMFlags)
078    public static final int
079            IMWRITE_PAM_FORMAT_NULL = 0,
080            IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1,
081            IMWRITE_PAM_FORMAT_GRAYSCALE = 2,
082            IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3,
083            IMWRITE_PAM_FORMAT_RGB = 4,
084            IMWRITE_PAM_FORMAT_RGB_ALPHA = 5;
085
086
087    // C++: enum ImwritePNGFlags (cv.ImwritePNGFlags)
088    public static final int
089            IMWRITE_PNG_STRATEGY_DEFAULT = 0,
090            IMWRITE_PNG_STRATEGY_FILTERED = 1,
091            IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY = 2,
092            IMWRITE_PNG_STRATEGY_RLE = 3,
093            IMWRITE_PNG_STRATEGY_FIXED = 4;
094
095
096    //
097    // C++:  Mat cv::imread(String filename, int flags = IMREAD_COLOR)
098    //
099
100    /**
101     * Loads an image from a file.
102     *
103     *  imread
104     *
105     * The function imread loads an image from the specified file and returns it. If the image cannot be
106     * read (because of missing file, improper permissions, unsupported or invalid format), the function
107     * returns an empty matrix ( Mat::data==NULL ).
108     *
109     * Currently, the following file formats are supported:
110     *
111     * <ul>
112     *   <li>
113     *    Windows bitmaps - \*.bmp, \*.dib (always supported)
114     *   </li>
115     *   <li>
116     *    JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Note* section)
117     *   </li>
118     *   <li>
119     *    JPEG 2000 files - \*.jp2 (see the *Note* section)
120     *   </li>
121     *   <li>
122     *    Portable Network Graphics - \*.png (see the *Note* section)
123     *   </li>
124     *   <li>
125     *    WebP - \*.webp (see the *Note* section)
126     *   </li>
127     *   <li>
128     *    Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
129     *   </li>
130     *   <li>
131     *    PFM files - \*.pfm (see the *Note* section)
132     *   </li>
133     *   <li>
134     *    Sun rasters - \*.sr, \*.ras (always supported)
135     *   </li>
136     *   <li>
137     *    TIFF files - \*.tiff, \*.tif (see the *Note* section)
138     *   </li>
139     *   <li>
140     *    OpenEXR Image files - \*.exr (see the *Note* section)
141     *   </li>
142     *   <li>
143     *    Radiance HDR - \*.hdr, \*.pic (always supported)
144     *   </li>
145     *   <li>
146     *    Raster and Vector geospatial data supported by GDAL (see the *Note* section)
147     *   </li>
148     * </ul>
149     *
150     * <b>Note:</b>
151     * <ul>
152     *   <li>
153     *    The function determines the type of an image by the content, not by the file extension.
154     *   </li>
155     *   <li>
156     *    In the case of color images, the decoded images will have the channels stored in <b>B G R</b> order.
157     *   </li>
158     *   <li>
159     *    When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available.
160     *     Results may differ to the output of cvtColor()
161     *   </li>
162     *   <li>
163     *    On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg,
164     *     libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs,
165     *     and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware
166     *     that currently these native image loaders give images with different pixel values because of
167     *     the color management embedded into MacOSX.
168     *   </li>
169     *   <li>
170     *    On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for
171     *     codecs supplied with an OS image. Install the relevant packages (do not forget the development
172     *     files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn
173     *     on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
174     *   </li>
175     *   <li>
176     *    In the case you set *WITH_GDAL* flag to true in CMake and REF: IMREAD_LOAD_GDAL to load the image,
177     *     then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting
178     *     the following formats: [Raster](http://www.gdal.org/formats_list.html),
179     *     [Vector](http://www.gdal.org/ogr_formats.html).
180     *   </li>
181     *   <li>
182     *    If EXIF information is embedded in the image file, the EXIF orientation will be taken into account
183     *     and thus the image will be rotated accordingly except if the flags REF: IMREAD_IGNORE_ORIENTATION
184     *     or REF: IMREAD_UNCHANGED are passed.
185     *   </li>
186     *   <li>
187     *    Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
188     *   </li>
189     *   <li>
190     *    By default number of pixels must be less than 2^30. Limit can be set using system
191     *     variable OPENCV_IO_MAX_IMAGE_PIXELS
192     *   </li>
193     * </ul>
194     *
195     * @param filename Name of file to be loaded.
196     * @param flags Flag that can take values of cv::ImreadModes
197     * @return automatically generated
198     */
199    public static Mat imread(String filename, int flags) {
200        return new Mat(imread_0(filename, flags));
201    }
202
203    /**
204     * Loads an image from a file.
205     *
206     *  imread
207     *
208     * The function imread loads an image from the specified file and returns it. If the image cannot be
209     * read (because of missing file, improper permissions, unsupported or invalid format), the function
210     * returns an empty matrix ( Mat::data==NULL ).
211     *
212     * Currently, the following file formats are supported:
213     *
214     * <ul>
215     *   <li>
216     *    Windows bitmaps - \*.bmp, \*.dib (always supported)
217     *   </li>
218     *   <li>
219     *    JPEG files - \*.jpeg, \*.jpg, \*.jpe (see the *Note* section)
220     *   </li>
221     *   <li>
222     *    JPEG 2000 files - \*.jp2 (see the *Note* section)
223     *   </li>
224     *   <li>
225     *    Portable Network Graphics - \*.png (see the *Note* section)
226     *   </li>
227     *   <li>
228     *    WebP - \*.webp (see the *Note* section)
229     *   </li>
230     *   <li>
231     *    Portable image format - \*.pbm, \*.pgm, \*.ppm \*.pxm, \*.pnm (always supported)
232     *   </li>
233     *   <li>
234     *    PFM files - \*.pfm (see the *Note* section)
235     *   </li>
236     *   <li>
237     *    Sun rasters - \*.sr, \*.ras (always supported)
238     *   </li>
239     *   <li>
240     *    TIFF files - \*.tiff, \*.tif (see the *Note* section)
241     *   </li>
242     *   <li>
243     *    OpenEXR Image files - \*.exr (see the *Note* section)
244     *   </li>
245     *   <li>
246     *    Radiance HDR - \*.hdr, \*.pic (always supported)
247     *   </li>
248     *   <li>
249     *    Raster and Vector geospatial data supported by GDAL (see the *Note* section)
250     *   </li>
251     * </ul>
252     *
253     * <b>Note:</b>
254     * <ul>
255     *   <li>
256     *    The function determines the type of an image by the content, not by the file extension.
257     *   </li>
258     *   <li>
259     *    In the case of color images, the decoded images will have the channels stored in <b>B G R</b> order.
260     *   </li>
261     *   <li>
262     *    When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available.
263     *     Results may differ to the output of cvtColor()
264     *   </li>
265     *   <li>
266     *    On Microsoft Windows\* OS and MacOSX\*, the codecs shipped with an OpenCV image (libjpeg,
267     *     libpng, libtiff, and libjasper) are used by default. So, OpenCV can always read JPEGs, PNGs,
268     *     and TIFFs. On MacOSX, there is also an option to use native MacOSX image readers. But beware
269     *     that currently these native image loaders give images with different pixel values because of
270     *     the color management embedded into MacOSX.
271     *   </li>
272     *   <li>
273     *    On Linux\*, BSD flavors and other Unix-like open-source operating systems, OpenCV looks for
274     *     codecs supplied with an OS image. Install the relevant packages (do not forget the development
275     *     files, for example, "libjpeg-dev", in Debian\* and Ubuntu\*) to get the codec support or turn
276     *     on the OPENCV_BUILD_3RDPARTY_LIBS flag in CMake.
277     *   </li>
278     *   <li>
279     *    In the case you set *WITH_GDAL* flag to true in CMake and REF: IMREAD_LOAD_GDAL to load the image,
280     *     then the [GDAL](http://www.gdal.org) driver will be used in order to decode the image, supporting
281     *     the following formats: [Raster](http://www.gdal.org/formats_list.html),
282     *     [Vector](http://www.gdal.org/ogr_formats.html).
283     *   </li>
284     *   <li>
285     *    If EXIF information is embedded in the image file, the EXIF orientation will be taken into account
286     *     and thus the image will be rotated accordingly except if the flags REF: IMREAD_IGNORE_ORIENTATION
287     *     or REF: IMREAD_UNCHANGED are passed.
288     *   </li>
289     *   <li>
290     *    Use the IMREAD_UNCHANGED flag to keep the floating point values from PFM image.
291     *   </li>
292     *   <li>
293     *    By default number of pixels must be less than 2^30. Limit can be set using system
294     *     variable OPENCV_IO_MAX_IMAGE_PIXELS
295     *   </li>
296     * </ul>
297     *
298     * @param filename Name of file to be loaded.
299     * @return automatically generated
300     */
301    public static Mat imread(String filename) {
302        return new Mat(imread_1(filename));
303    }
304
305
306    //
307    // C++:  bool cv::imreadmulti(String filename, vector_Mat& mats, int flags = IMREAD_ANYCOLOR)
308    //
309
310    /**
311     * Loads a multi-page image from a file.
312     *
313     * The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects.
314     * @param filename Name of file to be loaded.
315     * @param mats A vector of Mat objects holding each page.
316     * @param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.
317     * SEE: cv::imread
318     * @return automatically generated
319     */
320    public static boolean imreadmulti(String filename, List<Mat> mats, int flags) {
321        Mat mats_mat = new Mat();
322        boolean retVal = imreadmulti_0(filename, mats_mat.nativeObj, flags);
323        Converters.Mat_to_vector_Mat(mats_mat, mats);
324        mats_mat.release();
325        return retVal;
326    }
327
328    /**
329     * Loads a multi-page image from a file.
330     *
331     * The function imreadmulti loads a multi-page image from the specified file into a vector of Mat objects.
332     * @param filename Name of file to be loaded.
333     * @param mats A vector of Mat objects holding each page.
334     * SEE: cv::imread
335     * @return automatically generated
336     */
337    public static boolean imreadmulti(String filename, List<Mat> mats) {
338        Mat mats_mat = new Mat();
339        boolean retVal = imreadmulti_1(filename, mats_mat.nativeObj);
340        Converters.Mat_to_vector_Mat(mats_mat, mats);
341        mats_mat.release();
342        return retVal;
343    }
344
345
346    //
347    // C++:  bool cv::imreadmulti(String filename, vector_Mat& mats, int start, int count, int flags = IMREAD_ANYCOLOR)
348    //
349
350    /**
351     * Loads a of images of a multi-page image from a file.
352     *
353     * The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects.
354     * @param filename Name of file to be loaded.
355     * @param mats A vector of Mat objects holding each page.
356     * @param start Start index of the image to load
357     * @param count Count number of images to load
358     * @param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.
359     * SEE: cv::imread
360     * @return automatically generated
361     */
362    public static boolean imreadmulti(String filename, List<Mat> mats, int start, int count, int flags) {
363        Mat mats_mat = new Mat();
364        boolean retVal = imreadmulti_2(filename, mats_mat.nativeObj, start, count, flags);
365        Converters.Mat_to_vector_Mat(mats_mat, mats);
366        mats_mat.release();
367        return retVal;
368    }
369
370    /**
371     * Loads a of images of a multi-page image from a file.
372     *
373     * The function imreadmulti loads a specified range from a multi-page image from the specified file into a vector of Mat objects.
374     * @param filename Name of file to be loaded.
375     * @param mats A vector of Mat objects holding each page.
376     * @param start Start index of the image to load
377     * @param count Count number of images to load
378     * SEE: cv::imread
379     * @return automatically generated
380     */
381    public static boolean imreadmulti(String filename, List<Mat> mats, int start, int count) {
382        Mat mats_mat = new Mat();
383        boolean retVal = imreadmulti_3(filename, mats_mat.nativeObj, start, count);
384        Converters.Mat_to_vector_Mat(mats_mat, mats);
385        mats_mat.release();
386        return retVal;
387    }
388
389
390    //
391    // C++:  size_t cv::imcount(String filename, int flags = IMREAD_ANYCOLOR)
392    //
393
394    /**
395     * Returns the number of images inside the give file
396     *
397     * The function imcount will return the number of pages in a multi-page image, or 1 for single-page images
398     * @param filename Name of file to be loaded.
399     * @param flags Flag that can take values of cv::ImreadModes, default with cv::IMREAD_ANYCOLOR.
400     * @return automatically generated
401     */
402    public static long imcount(String filename, int flags) {
403        return imcount_0(filename, flags);
404    }
405
406    /**
407     * Returns the number of images inside the give file
408     *
409     * The function imcount will return the number of pages in a multi-page image, or 1 for single-page images
410     * @param filename Name of file to be loaded.
411     * @return automatically generated
412     */
413    public static long imcount(String filename) {
414        return imcount_1(filename);
415    }
416
417
418    //
419    // C++:  bool cv::imwrite(String filename, Mat img, vector_int params = std::vector<int>())
420    //
421
422    /**
423     * Saves an image to a specified file.
424     *
425     * The function imwrite saves the image to the specified file. The image format is chosen based on the
426     * filename extension (see cv::imread for the list of extensions). In general, only 8-bit
427     * single-channel or 3-channel (with 'BGR' channel order) images
428     * can be saved using this function, with these exceptions:
429     *
430     * <ul>
431     *   <li>
432     *  16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats
433     *   </li>
434     *   <li>
435     *  32-bit float (CV_32F) images can be saved in PFM, TIFF, OpenEXR, and Radiance HDR formats;
436     *   3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding
437     *   (4 bytes per pixel)
438     *   </li>
439     *   <li>
440     *  PNG images with an alpha channel can be saved using this function. To do this, create
441     * 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels
442     * should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).
443     *   </li>
444     *   <li>
445     *  Multiple images (vector of Mat) can be saved in TIFF format (see the code sample below).
446     *   </li>
447     * </ul>
448     *
449     * If the image format is not supported, the image will be converted to 8-bit unsigned (CV_8U) and saved that way.
450     *
451     * If the format, depth or channel order is different, use
452     * Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O
453     * functions to save the image to XML or YAML format.
454     *
455     * The sample below shows how to create a BGRA image, how to set custom compression parameters and save it to a PNG file.
456     * It also demonstrates how to save multiple images in a TIFF file:
457     * INCLUDE: snippets/imgcodecs_imwrite.cpp
458     * @param filename Name of the file.
459     * @param img (Mat or vector of Mat) Image or Images to be saved.
460     * @param params Format-specific parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::ImwriteFlags
461     * @return automatically generated
462     */
463    public static boolean imwrite(String filename, Mat img, MatOfInt params) {
464        Mat params_mat = params;
465        return imwrite_0(filename, img.nativeObj, params_mat.nativeObj);
466    }
467
468    /**
469     * Saves an image to a specified file.
470     *
471     * The function imwrite saves the image to the specified file. The image format is chosen based on the
472     * filename extension (see cv::imread for the list of extensions). In general, only 8-bit
473     * single-channel or 3-channel (with 'BGR' channel order) images
474     * can be saved using this function, with these exceptions:
475     *
476     * <ul>
477     *   <li>
478     *  16-bit unsigned (CV_16U) images can be saved in the case of PNG, JPEG 2000, and TIFF formats
479     *   </li>
480     *   <li>
481     *  32-bit float (CV_32F) images can be saved in PFM, TIFF, OpenEXR, and Radiance HDR formats;
482     *   3-channel (CV_32FC3) TIFF images will be saved using the LogLuv high dynamic range encoding
483     *   (4 bytes per pixel)
484     *   </li>
485     *   <li>
486     *  PNG images with an alpha channel can be saved using this function. To do this, create
487     * 8-bit (or 16-bit) 4-channel image BGRA, where the alpha channel goes last. Fully transparent pixels
488     * should have alpha set to 0, fully opaque pixels should have alpha set to 255/65535 (see the code sample below).
489     *   </li>
490     *   <li>
491     *  Multiple images (vector of Mat) can be saved in TIFF format (see the code sample below).
492     *   </li>
493     * </ul>
494     *
495     * If the image format is not supported, the image will be converted to 8-bit unsigned (CV_8U) and saved that way.
496     *
497     * If the format, depth or channel order is different, use
498     * Mat::convertTo and cv::cvtColor to convert it before saving. Or, use the universal FileStorage I/O
499     * functions to save the image to XML or YAML format.
500     *
501     * The sample below shows how to create a BGRA image, how to set custom compression parameters and save it to a PNG file.
502     * It also demonstrates how to save multiple images in a TIFF file:
503     * INCLUDE: snippets/imgcodecs_imwrite.cpp
504     * @param filename Name of the file.
505     * @param img (Mat or vector of Mat) Image or Images to be saved.
506     * @return automatically generated
507     */
508    public static boolean imwrite(String filename, Mat img) {
509        return imwrite_1(filename, img.nativeObj);
510    }
511
512
513    //
514    // C++:  bool cv::imwritemulti(String filename, vector_Mat img, vector_int params = std::vector<int>())
515    //
516
517    public static boolean imwritemulti(String filename, List<Mat> img, MatOfInt params) {
518        Mat img_mat = Converters.vector_Mat_to_Mat(img);
519        Mat params_mat = params;
520        return imwritemulti_0(filename, img_mat.nativeObj, params_mat.nativeObj);
521    }
522
523    public static boolean imwritemulti(String filename, List<Mat> img) {
524        Mat img_mat = Converters.vector_Mat_to_Mat(img);
525        return imwritemulti_1(filename, img_mat.nativeObj);
526    }
527
528
529    //
530    // C++:  Mat cv::imdecode(Mat buf, int flags)
531    //
532
533    /**
534     * Reads an image from a buffer in memory.
535     *
536     * The function imdecode reads an image from the specified buffer in the memory. If the buffer is too short or
537     * contains invalid data, the function returns an empty matrix ( Mat::data==NULL ).
538     *
539     * See cv::imread for the list of supported formats and flags description.
540     *
541     * <b>Note:</b> In the case of color images, the decoded images will have the channels stored in <b>B G R</b> order.
542     * @param buf Input array or vector of bytes.
543     * @param flags The same flags as in cv::imread, see cv::ImreadModes.
544     * @return automatically generated
545     */
546    public static Mat imdecode(Mat buf, int flags) {
547        return new Mat(imdecode_0(buf.nativeObj, flags));
548    }
549
550
551    //
552    // C++:  bool cv::imencode(String ext, Mat img, vector_uchar& buf, vector_int params = std::vector<int>())
553    //
554
555    /**
556     * Encodes an image into a memory buffer.
557     *
558     * The function imencode compresses the image and stores it in the memory buffer that is resized to fit the
559     * result. See cv::imwrite for the list of supported formats and flags description.
560     *
561     * @param ext File extension that defines the output format. Must include a leading period.
562     * @param img Image to be written.
563     * @param buf Output buffer resized to fit the compressed image.
564     * @param params Format-specific parameters. See cv::imwrite and cv::ImwriteFlags.
565     * @return automatically generated
566     */
567    public static boolean imencode(String ext, Mat img, MatOfByte buf, MatOfInt params) {
568        Mat buf_mat = buf;
569        Mat params_mat = params;
570        return imencode_0(ext, img.nativeObj, buf_mat.nativeObj, params_mat.nativeObj);
571    }
572
573    /**
574     * Encodes an image into a memory buffer.
575     *
576     * The function imencode compresses the image and stores it in the memory buffer that is resized to fit the
577     * result. See cv::imwrite for the list of supported formats and flags description.
578     *
579     * @param ext File extension that defines the output format. Must include a leading period.
580     * @param img Image to be written.
581     * @param buf Output buffer resized to fit the compressed image.
582     * @return automatically generated
583     */
584    public static boolean imencode(String ext, Mat img, MatOfByte buf) {
585        Mat buf_mat = buf;
586        return imencode_1(ext, img.nativeObj, buf_mat.nativeObj);
587    }
588
589
590    //
591    // C++:  bool cv::haveImageReader(String filename)
592    //
593
594    /**
595     * Returns true if the specified image can be decoded by OpenCV
596     *
597     * @param filename File name of the image
598     * @return automatically generated
599     */
600    public static boolean haveImageReader(String filename) {
601        return haveImageReader_0(filename);
602    }
603
604
605    //
606    // C++:  bool cv::haveImageWriter(String filename)
607    //
608
609    /**
610     * Returns true if an image with the specified filename can be encoded by OpenCV
611     *
612     *  @param filename File name of the image
613     * @return automatically generated
614     */
615    public static boolean haveImageWriter(String filename) {
616        return haveImageWriter_0(filename);
617    }
618
619
620
621
622    // C++:  Mat cv::imread(String filename, int flags = IMREAD_COLOR)
623    private static native long imread_0(String filename, int flags);
624    private static native long imread_1(String filename);
625
626    // C++:  bool cv::imreadmulti(String filename, vector_Mat& mats, int flags = IMREAD_ANYCOLOR)
627    private static native boolean imreadmulti_0(String filename, long mats_mat_nativeObj, int flags);
628    private static native boolean imreadmulti_1(String filename, long mats_mat_nativeObj);
629
630    // C++:  bool cv::imreadmulti(String filename, vector_Mat& mats, int start, int count, int flags = IMREAD_ANYCOLOR)
631    private static native boolean imreadmulti_2(String filename, long mats_mat_nativeObj, int start, int count, int flags);
632    private static native boolean imreadmulti_3(String filename, long mats_mat_nativeObj, int start, int count);
633
634    // C++:  size_t cv::imcount(String filename, int flags = IMREAD_ANYCOLOR)
635    private static native long imcount_0(String filename, int flags);
636    private static native long imcount_1(String filename);
637
638    // C++:  bool cv::imwrite(String filename, Mat img, vector_int params = std::vector<int>())
639    private static native boolean imwrite_0(String filename, long img_nativeObj, long params_mat_nativeObj);
640    private static native boolean imwrite_1(String filename, long img_nativeObj);
641
642    // C++:  bool cv::imwritemulti(String filename, vector_Mat img, vector_int params = std::vector<int>())
643    private static native boolean imwritemulti_0(String filename, long img_mat_nativeObj, long params_mat_nativeObj);
644    private static native boolean imwritemulti_1(String filename, long img_mat_nativeObj);
645
646    // C++:  Mat cv::imdecode(Mat buf, int flags)
647    private static native long imdecode_0(long buf_nativeObj, int flags);
648
649    // C++:  bool cv::imencode(String ext, Mat img, vector_uchar& buf, vector_int params = std::vector<int>())
650    private static native boolean imencode_0(String ext, long img_nativeObj, long buf_mat_nativeObj, long params_mat_nativeObj);
651    private static native boolean imencode_1(String ext, long img_nativeObj, long buf_mat_nativeObj);
652
653    // C++:  bool cv::haveImageReader(String filename)
654    private static native boolean haveImageReader_0(String filename);
655
656    // C++:  bool cv::haveImageWriter(String filename)
657    private static native boolean haveImageWriter_0(String filename);
658
659}