Class ConvertNV21


  • public class ConvertNV21
    extends java.lang.Object
    Used to convert NV21 image format used in Android into BoofCV standard image types. NV21 is an encoding of a YUV image [1] (more specifically YUV 4:2:0) where Y is encoded in the first block and UV are interlaced together. The UV planes are at 1/2 resolution.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConvertNV21()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void nv21ToBoof​(byte[] data, int width, int height, boofcv.struct.image.ImageBase output)
      Converts a NV21 encoded byte array into a BoofCV formatted image.
      static boofcv.struct.image.GrayF32 nv21ToGray​(byte[] data, int width, int height, boofcv.struct.image.GrayF32 output)
      Converts an NV21 image into a gray scale F32 image.
      static boofcv.struct.image.GrayU8 nv21ToGray​(byte[] data, int width, int height, boofcv.struct.image.GrayU8 output)
      Converts an NV21 image into a gray scale U8 image.
      static <T extends boofcv.struct.image.ImageGray<T>>
      T
      nv21ToGray​(byte[] data, int width, int height, T output, java.lang.Class<T> outputType)
      Converts an NV21 image into a gray scale image.
      static boofcv.struct.image.InterleavedF32 nv21ToInterleaved​(byte[] data, int width, int height, boofcv.struct.image.InterleavedF32 output)
      Converts an NV21 image into a InterleavedF32 RGB image.
      static boofcv.struct.image.InterleavedU8 nv21ToInterleaved​(byte[] data, int width, int height, boofcv.struct.image.InterleavedU8 output)
      Converts an NV21 image into a InterleavedU8 RGB image.
      static boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> nv21ToPlanarRgb_F32​(byte[] data, int width, int height, boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> output)
      Converts an NV21 image into a Planar RGB image with F32 bands.
      static <T extends boofcv.struct.image.ImageGray<T>>
      boofcv.struct.image.Planar<T>
      nv21ToPlanarYuv​(byte[] data, int width, int height, boofcv.struct.image.Planar<T> output, java.lang.Class<T> outputType)
      Converts an NV21 image into a Planar YUV image.
      static boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> nv21ToPlanarYuv_U8​(byte[] data, int width, int height, boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> output)
      Converts an NV21 image into a Planar YUV image with U8 bands.
      static boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> nv21TPlanarRgb_U8​(byte[] data, int width, int height, boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> output)
      Converts an NV21 image into a Planar RGB image with U8 bands.
      static boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> nv21TPlanarYuv_F32​(byte[] data, int width, int height, boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> output)
      Converts an NV21 image into a Planar YUV image with F32 bands.
      • Methods inherited from class java.lang.Object

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

      • ConvertNV21

        public ConvertNV21()
    • Method Detail

      • nv21ToBoof

        public static void nv21ToBoof​(byte[] data,
                                      int width,
                                      int height,
                                      boofcv.struct.image.ImageBase output)
        Converts a NV21 encoded byte array into a BoofCV formatted image.
        Parameters:
        data - (input) NV21 byte array
        width - (input) image width
        height - (input) image height
        output - (output) BoofCV image
      • nv21ToGray

        public static <T extends boofcv.struct.image.ImageGray<T>> T nv21ToGray​(byte[] data,
                                                                                int width,
                                                                                int height,
                                                                                T output,
                                                                                java.lang.Class<T> outputType)
        Converts an NV21 image into a gray scale image. Image type is determined at runtime.
        Type Parameters:
        T - Output image type
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
        outputType - Output: Type of output image
        Returns:
        Gray scale image
      • nv21ToGray

        public static boofcv.struct.image.GrayU8 nv21ToGray​(byte[] data,
                                                            int width,
                                                            int height,
                                                            boofcv.struct.image.GrayU8 output)
        Converts an NV21 image into a gray scale U8 image.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
        Returns:
        Gray scale image
      • nv21ToGray

        public static boofcv.struct.image.GrayF32 nv21ToGray​(byte[] data,
                                                             int width,
                                                             int height,
                                                             boofcv.struct.image.GrayF32 output)
        Converts an NV21 image into a gray scale F32 image.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
        Returns:
        Gray scale image
      • nv21ToPlanarYuv

        public static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.Planar<T> nv21ToPlanarYuv​(byte[] data,
                                                                                                                 int width,
                                                                                                                 int height,
                                                                                                                 boofcv.struct.image.Planar<T> output,
                                                                                                                 java.lang.Class<T> outputType)
        Converts an NV21 image into a Planar YUV image.
        Type Parameters:
        T - Output image type
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
        outputType - Output: Type of output image
      • nv21ToPlanarYuv_U8

        public static boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> nv21ToPlanarYuv_U8​(byte[] data,
                                                                                                int width,
                                                                                                int height,
                                                                                                boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> output)
        Converts an NV21 image into a Planar YUV image with U8 bands.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
      • nv21TPlanarRgb_U8

        public static boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> nv21TPlanarRgb_U8​(byte[] data,
                                                                                               int width,
                                                                                               int height,
                                                                                               boofcv.struct.image.Planar<boofcv.struct.image.GrayU8> output)
        Converts an NV21 image into a Planar RGB image with U8 bands.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
      • nv21ToInterleaved

        public static boofcv.struct.image.InterleavedU8 nv21ToInterleaved​(byte[] data,
                                                                          int width,
                                                                          int height,
                                                                          boofcv.struct.image.InterleavedU8 output)
        Converts an NV21 image into a InterleavedU8 RGB image.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
      • nv21TPlanarYuv_F32

        public static boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> nv21TPlanarYuv_F32​(byte[] data,
                                                                                                 int width,
                                                                                                 int height,
                                                                                                 boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> output)
        Converts an NV21 image into a Planar YUV image with F32 bands.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
      • nv21ToPlanarRgb_F32

        public static boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> nv21ToPlanarRgb_F32​(byte[] data,
                                                                                                  int width,
                                                                                                  int height,
                                                                                                  boofcv.struct.image.Planar<boofcv.struct.image.GrayF32> output)
        Converts an NV21 image into a Planar RGB image with F32 bands.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.
      • nv21ToInterleaved

        public static boofcv.struct.image.InterleavedF32 nv21ToInterleaved​(byte[] data,
                                                                           int width,
                                                                           int height,
                                                                           boofcv.struct.image.InterleavedF32 output)
        Converts an NV21 image into a InterleavedF32 RGB image.
        Parameters:
        data - Input: NV21 image data
        width - Input: NV21 image width
        height - Input: NV21 image height
        output - Output: Optional storage for output image. Can be null.