Documentation of 'boofcv.io.image.UtilImageIO' Java class
UtilImageIO
boofcv.io.image

Class UtilImageIO



  • public class UtilImageIO
    extends java.lang.Object
    Class for loading and saving images.
    • Constructor Summary

      Constructors 
      Constructor and Description
      UtilImageIO() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static <T extends ImageBase>
      T
      loadImage(java.io.File image, boolean orderRgb, ImageType<T> imageType) 
      static java.awt.image.BufferedImage loadImage(java.lang.String fileName)
      A function that load the specified image.
      static <T extends ImageGray>
      T
      loadImage(java.lang.String fileName, java.lang.Class<T> imageType)
      Loads the image and converts into the specified image type.
      static java.awt.image.BufferedImage loadImage(java.lang.String directory, java.lang.String fileName) 
      static <T extends ImageGray>
      T
      loadImage(java.lang.String directory, java.lang.String fileName, java.lang.Class<T> imageType) 
      static java.awt.image.BufferedImage loadImage(java.net.URL fileName)
      A function that load the specified image.
      static java.util.List<java.awt.image.BufferedImage> loadImages(java.lang.String directory, java.lang.String regex)
      Loads all the image in the specified directory which match the provided regex
      static GrayU8 loadPGM_U8(java.io.InputStream inputStream, GrayU8 storage)
      Loads a PGM image from an InputStream.
      static GrayU8 loadPGM_U8(java.lang.String fileName, GrayU8 storage)
      Loads a PGM image from an InputStream.
      static java.awt.image.BufferedImage loadPGM(java.io.InputStream inputStream, java.awt.image.BufferedImage storage)
      Loads a PGM image from an InputStream.
      static java.awt.image.BufferedImage loadPGM(java.lang.String fileName, java.awt.image.BufferedImage storage)
      Loads a PGM image from a file.
      static Planar<GrayU8> loadPPM_U8(java.io.InputStream inputStream, Planar<GrayU8> storage, GrowQueue_I8 temp)
      Reads a PPM image file directly into a Planar image.
      static Planar<GrayU8> loadPPM_U8(java.lang.String fileName, Planar<GrayU8> storage, GrowQueue_I8 temp)
      Reads a PPM image file directly into a Planar image.
      static java.awt.image.BufferedImage loadPPM(java.io.InputStream inputStream, java.awt.image.BufferedImage storage)
      Loads a PPM image from an InputStream.
      static java.awt.image.BufferedImage loadPPM(java.lang.String fileName, java.awt.image.BufferedImage storage)
      Loads a PPM image from a file.
      static void saveImage(java.awt.image.BufferedImage img, java.lang.String fileName)
      Saves the BufferedImage to the specified file.
      static void saveImage(ImageBase image, java.lang.String fileName)
      Saves the BoofCV formatted image.
      static void savePGM(GrayU8 gray, java.lang.String fileName)
      Saves an image in PGM format.
      static void savePPM(Planar<GrayU8> rgb, java.lang.String fileName, GrowQueue_I8 temp)
      Saves an image in PPM format.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UtilImageIO

        public UtilImageIO()
    • Method Detail

      • loadImage

        public static java.awt.image.BufferedImage loadImage(java.lang.String fileName)
        A function that load the specified image. If anything goes wrong it returns a null.
      • loadImage

        public static java.awt.image.BufferedImage loadImage(java.lang.String directory,
                                                             java.lang.String fileName)
      • loadImages

        public static java.util.List<java.awt.image.BufferedImage> loadImages(java.lang.String directory,
                                                                              java.lang.String regex)
        Loads all the image in the specified directory which match the provided regex
        Parameters:
        directory - File directory
        regex - Regex used to match file names
        Returns:
        List of found images.
      • loadImage

        public static java.awt.image.BufferedImage loadImage(java.net.URL fileName)
        A function that load the specified image. If anything goes wrong it returns a null.
      • loadImage

        public static <T extends ImageGray> T loadImage(java.lang.String fileName,
                                                        java.lang.Class<T> imageType)
        Loads the image and converts into the specified image type.
        Parameters:
        fileName - Path to image file.
        imageType - Type of image that should be returned.
        Returns:
        The image or null if the image could not be loaded.
      • loadImage

        public static <T extends ImageGray> T loadImage(java.lang.String directory,
                                                        java.lang.String fileName,
                                                        java.lang.Class<T> imageType)
      • loadImage

        public static <T extends ImageBase> T loadImage(java.io.File image,
                                                        boolean orderRgb,
                                                        ImageType<T> imageType)
      • saveImage

        public static void saveImage(java.awt.image.BufferedImage img,
                                     java.lang.String fileName)
        Saves the BufferedImage to the specified file. The image type of the output is determined by the name's extension. By default the file is saved using ImageIO.write(RenderedImage, String, File)} but if that fails then it will see if it can save it using BoofCV native code for PPM and PGM.
        Parameters:
        img - Image which is to be saved.
        fileName - Name of the output file. The type is determined by the extension.
      • saveImage

        public static void saveImage(ImageBase image,
                                     java.lang.String fileName)

        Saves the BoofCV formatted image. This is identical to the following code:

         BufferedImage out = ConvertBufferedImage.convertTo(image,null,true);
         saveImage(out,fileName);
         
        Parameters:
        image - Image which is to be saved.
        fileName - Name of the output file. The type is determined by the extension.
      • loadPPM

        public static java.awt.image.BufferedImage loadPPM(java.lang.String fileName,
                                                           java.awt.image.BufferedImage storage)
                                                    throws java.io.IOException
        Loads a PPM image from a file.
        Parameters:
        fileName - Location of PPM image
        storage - (Optional) Storage for output image. Must be the width and height of the image being read. Better performance of type BufferedImage.TYPE_INT_RGB. If null or width/height incorrect a new image will be declared.
        Returns:
        The read in image
        Throws:
        java.io.IOException
      • loadPGM

        public static java.awt.image.BufferedImage loadPGM(java.lang.String fileName,
                                                           java.awt.image.BufferedImage storage)
                                                    throws java.io.IOException
        Loads a PGM image from a file.
        Parameters:
        fileName - Location of PGM image
        storage - (Optional) Storage for output image. Must be the width and height of the image being read. Better performance of type BufferedImage.TYPE_BYTE_GRAY. If null or width/height incorrect a new image will be declared.
        Returns:
        The read in image
        Throws:
        java.io.IOException
      • loadPPM

        public static java.awt.image.BufferedImage loadPPM(java.io.InputStream inputStream,
                                                           java.awt.image.BufferedImage storage)
                                                    throws java.io.IOException
        Loads a PPM image from an InputStream.
        Parameters:
        inputStream - InputStream for PPM image
        storage - (Optional) Storage for output image. Must be the width and height of the image being read. Better performance of type BufferedImage.TYPE_INT_RGB. If null or width/height incorrect a new image will be declared.
        Returns:
        The read in image
        Throws:
        java.io.IOException
      • loadPGM

        public static java.awt.image.BufferedImage loadPGM(java.io.InputStream inputStream,
                                                           java.awt.image.BufferedImage storage)
                                                    throws java.io.IOException
        Loads a PGM image from an InputStream.
        Parameters:
        inputStream - InputStream for PGM image
        storage - (Optional) Storage for output image. Must be the width and height of the image being read. Better performance of type BufferedImage.TYPE_BYTE_GRAY. If null or width/height incorrect a new image will be declared.
        Returns:
        The read in image
        Throws:
        java.io.IOException
      • loadPPM_U8

        public static Planar<GrayU8> loadPPM_U8(java.lang.String fileName,
                                                Planar<GrayU8> storage,
                                                GrowQueue_I8 temp)
                                         throws java.io.IOException
        Reads a PPM image file directly into a Planar image. To improve performance when reading many images, the user can provide work space memory in the optional parameters
        Parameters:
        fileName - Location of PPM file
        storage - (Optional) Where the image is written in to. Will be resized if needed. If null or the number of bands isn't 3, a new instance is declared.
        temp - (Optional) Used internally to store the image. Can be null.
        Returns:
        The image.
        Throws:
        java.io.IOException
      • loadPPM_U8

        public static Planar<GrayU8> loadPPM_U8(java.io.InputStream inputStream,
                                                Planar<GrayU8> storage,
                                                GrowQueue_I8 temp)
                                         throws java.io.IOException
        Reads a PPM image file directly into a Planar image. To improve performance when reading many images, the user can provide work space memory in the optional parameters
        Parameters:
        inputStream - InputStream for PPM image
        storage - (Optional) Where the image is written in to. Will be resized if needed. If null or the number of bands isn't 3, a new instance is declared.
        temp - (Optional) Used internally to store the image. Can be null.
        Returns:
        The image.
        Throws:
        java.io.IOException
      • loadPGM_U8

        public static GrayU8 loadPGM_U8(java.lang.String fileName,
                                        GrayU8 storage)
                                 throws java.io.IOException
        Loads a PGM image from an InputStream.
        Parameters:
        fileName - InputStream for PGM image
        storage - (Optional) Storage for output image. Must be the width and height of the image being read. If null a new image will be declared.
        Returns:
        The read in image
        Throws:
        java.io.IOException
      • loadPGM_U8

        public static GrayU8 loadPGM_U8(java.io.InputStream inputStream,
                                        GrayU8 storage)
                                 throws java.io.IOException
        Loads a PGM image from an InputStream.
        Parameters:
        inputStream - InputStream for PGM image
        storage - (Optional) Storage for output image. Must be the width and height of the image being read. If null a new image will be declared.
        Returns:
        The read in image
        Throws:
        java.io.IOException
      • savePPM

        public static void savePPM(Planar<GrayU8> rgb,
                                   java.lang.String fileName,
                                   GrowQueue_I8 temp)
                            throws java.io.IOException
        Saves an image in PPM format.
        Parameters:
        rgb - 3-band RGB image
        fileName - Location where the image is to be written to.
        temp - (Optional) Used internally to store the image. Can be null.
        Throws:
        java.io.IOException
      • savePGM

        public static void savePGM(GrayU8 gray,
                                   java.lang.String fileName)
                            throws java.io.IOException
        Saves an image in PGM format.
        Parameters:
        gray - Gray scale image
        fileName - Location where the image is to be written to.
        Throws:
        java.io.IOException

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.