Package boofcv.core.encoding
Class ConvertNV21
java.lang.Object
boofcv.core.encoding.ConvertNV21
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
nv21ToBoof
(byte[] data, int width, int height, ImageBase output) Converts a NV21 encoded byte array into a BoofCV formatted image.static GrayF32
nv21ToGray
(byte[] data, int width, int height, GrayF32 output) Converts an NV21 image into a gray scale F32 image.static GrayU8
nv21ToGray
(byte[] data, int width, int height, GrayU8 output) Converts an NV21 image into a gray scale U8 image.static <T extends ImageGray<T>>
Tnv21ToGray
(byte[] data, int width, int height, T output, Class<T> outputType) Converts an NV21 image into a gray scale image.static InterleavedF32
nv21ToInterleaved
(byte[] data, int width, int height, InterleavedF32 output) Converts an NV21 image into aInterleavedF32
RGB image.static InterleavedU8
nv21ToInterleaved
(byte[] data, int width, int height, InterleavedU8 output) Converts an NV21 image into aInterleavedU8
RGB image.nv21ToPlanarRgb_F32
(byte[] data, int width, int height, Planar<GrayF32> output) Converts an NV21 image into aPlanar
RGB image with F32 bands.nv21ToPlanarYuv
(byte[] data, int width, int height, Planar<T> output, Class<T> outputType) Converts an NV21 image into aPlanar
YUV image.nv21ToPlanarYuv_U8
(byte[] data, int width, int height, Planar<GrayU8> output) Converts an NV21 image into aPlanar
YUV image with U8 bands.nv21TPlanarRgb_U8
(byte[] data, int width, int height, Planar<GrayU8> output) Converts an NV21 image into aPlanar
RGB image with U8 bands.nv21TPlanarYuv_F32
(byte[] data, int width, int height, Planar<GrayF32> output) Converts an NV21 image into aPlanar
YUV image with F32 bands.
-
Constructor Details
-
ConvertNV21
public ConvertNV21()
-
-
Method Details
-
nv21ToBoof
Converts a NV21 encoded byte array into a BoofCV formatted image.- Parameters:
data
- (input) NV21 byte arraywidth
- (input) image widthheight
- (input) image heightoutput
- (output) BoofCV image
-
nv21ToGray
public static <T extends ImageGray<T>> T nv21ToGray(byte[] data, int width, int height, T output, 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 datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.outputType
- Output: Type of output image- Returns:
- Gray scale image
-
nv21ToGray
Converts an NV21 image into a gray scale U8 image.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.- Returns:
- Gray scale image
-
nv21ToGray
Converts an NV21 image into a gray scale F32 image.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.- Returns:
- Gray scale image
-
nv21ToPlanarYuv
public static <T extends ImageGray<T>> Planar<T> nv21ToPlanarYuv(byte[] data, int width, int height, Planar<T> output, Class<T> outputType) Converts an NV21 image into aPlanar
YUV image.- Type Parameters:
T
- Output image type- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.outputType
- Output: Type of output image
-
nv21ToPlanarYuv_U8
public static Planar<GrayU8> nv21ToPlanarYuv_U8(byte[] data, int width, int height, Planar<GrayU8> output) Converts an NV21 image into aPlanar
YUV image with U8 bands.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.
-
nv21TPlanarRgb_U8
public static Planar<GrayU8> nv21TPlanarRgb_U8(byte[] data, int width, int height, Planar<GrayU8> output) Converts an NV21 image into aPlanar
RGB image with U8 bands.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.
-
nv21ToInterleaved
public static InterleavedU8 nv21ToInterleaved(byte[] data, int width, int height, InterleavedU8 output) Converts an NV21 image into aInterleavedU8
RGB image.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.
-
nv21TPlanarYuv_F32
public static Planar<GrayF32> nv21TPlanarYuv_F32(byte[] data, int width, int height, Planar<GrayF32> output) Converts an NV21 image into aPlanar
YUV image with F32 bands.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.
-
nv21ToPlanarRgb_F32
public static Planar<GrayF32> nv21ToPlanarRgb_F32(byte[] data, int width, int height, Planar<GrayF32> output) Converts an NV21 image into aPlanar
RGB image with F32 bands.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.
-
nv21ToInterleaved
public static InterleavedF32 nv21ToInterleaved(byte[] data, int width, int height, InterleavedF32 output) Converts an NV21 image into aInterleavedF32
RGB image.- Parameters:
data
- Input: NV21 image datawidth
- Input: NV21 image widthheight
- Input: NV21 image heightoutput
- Output: Optional storage for output image. Can be null.
-