Class ColorYuv
- java.lang.Object
-
- boofcv.alg.color.ColorYuv
-
public class ColorYuv extends java.lang.ObjectColor conversion between YUV and RGB, and YCbCr and RGB. YUV is color encoding which takes in account a human perception model and is commonly used in cameras/video with analog signals. YCbCr is the digital equivalent color space of YUV that is scaled and offset. YCbCr is also commonly referred to as YUV, even though it is a different format.
Y component encodes luma (B&W gray scale) and U,V encodes color. The same is true for Y,Cb,Cr, respectively. In the functions below, if the input is floating point then YUV is used, otherwise YCbCr is used. How these color formats are encoded varies widely. For YCbCr, Y is "defined to have a nominal 8-bit range of 16-235, Cb and Cr are defined to have a nominal range of 16-240", see [3].
Sources for equations:
- http://en.wikipedia.org/wiki/YUV
- http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi_ch6/ch6_color_models.html
- Keith Jack, "Video Demystified" 5th ed 2007
-
-
Constructor Summary
Constructors Constructor and Description ColorYuv()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidrgbToYCbCr(int r, int g, int b, byte[] yuv)Conversion from RGB to YCbCr.static voidrgbToYuv_F32(Planar<GrayF32> rgb, Planar<GrayF32> yuv)Convert a 3-channelPlanarimage from RGB into YUV.static voidrgbToYuv(double r, double g, double b, double[] yuv)Conversion from RGB to YUV using same equations as Intel IPP.static voidrgbToYuv(float r, float g, float b, float[] yuv)Conversion from RGB to YUV using same equations as Intel IPP.static voidycbcrToRgb_U8(Planar<GrayU8> yuv, Planar<GrayU8> rgb)Conversion from YCbCr to RGB.static voidycbcrToRgb(int y, int cb, int cr, byte[] rgb)Conversion from YCbCr to RGB.static voidyuvToRgb_F32(Planar<GrayF32> yuv, Planar<GrayF32> rgb)Convert a 3-channelPlanarimage from YUV into RGB.static voidyuvToRgb(double y, double u, double v, double[] rgb)Conversion from YUV to RGB using same equations as Intel IPP.static voidyuvToRgb(float y, float u, float v, float[] rgb)Conversion from YUV to RGB using same equations as Intel IPP.
-
-
-
Method Detail
-
rgbToYuv
public static void rgbToYuv(double r, double g, double b, double[] yuv)Conversion from RGB to YUV using same equations as Intel IPP.
-
rgbToYuv
public static void rgbToYuv(float r, float g, float b, float[] yuv)Conversion from RGB to YUV using same equations as Intel IPP.
-
yuvToRgb
public static void yuvToRgb(double y, double u, double v, double[] rgb)Conversion from YUV to RGB using same equations as Intel IPP.
-
yuvToRgb
public static void yuvToRgb(float y, float u, float v, float[] rgb)Conversion from YUV to RGB using same equations as Intel IPP.
-
rgbToYCbCr
public static void rgbToYCbCr(int r, int g, int b, byte[] yuv)Conversion from RGB to YCbCr. See [Jack07].- Parameters:
r- Red [0 to 255]g- Green [0 to 255]b- Blue [0 to 255]
-
ycbcrToRgb
public static void ycbcrToRgb(int y, int cb, int cr, byte[] rgb)Conversion from YCbCr to RGB. See [Jack07].- Parameters:
y- Y [0 to 255]cb- Cb [0 to 255]cr- Cr [0 to 255]
-
yuvToRgb_F32
public static void yuvToRgb_F32(Planar<GrayF32> yuv, Planar<GrayF32> rgb)
Convert a 3-channelPlanarimage from YUV into RGB.- Parameters:
rgb- (Input) RGB encoded imageyuv- (Output) YUV encoded image
-
rgbToYuv_F32
public static void rgbToYuv_F32(Planar<GrayF32> rgb, Planar<GrayF32> yuv)
Convert a 3-channelPlanarimage from RGB into YUV. NOTE: Input and output image can be the same instance.- Parameters:
rgb- (Input) RGB encoded imageyuv- (Output) YUV encoded image
-
-
DataMelt 3.0 © DataMelt by jWork.ORG