impRGBtoW(3)
impRGBtoW, impWtoRGB, impRGBtoK, impKtoRGB, impRGBtoCMY, impCMYtoRGB, impRGBtoYIQ, impYIQtoRGB, impRGBtoYUV, impYUVtoRGB, impRGBtoYCbCr, impYCbCrtoRGB, impRGBtoCMYK, impRGBtoDevCMYK, impCMYKtoRGB, impRGBtoHSV, impHSVtoRGB, impRGBtoHLS, impHLStoRGB - color space conversion
As shipped in IRIX 6.5.5. Unchanged since IRIX 6.5.
NAME impRGBtoW, impWtoRGB, impRGBtoK, impKtoRGB, impRGBtoCMY, impCMYtoRGB, impRGBtoYIQ, impYIQtoRGB, impRGBtoYUV, impYUVtoRGB, impRGBtoYCbCr, impYCbCrtoRGB, impRGBtoCMYK, impRGBtoDevCMYK, impCMYKtoRGB, impRGBtoHSV, impHSVtoRGB, impRGBtoHLS, impHLStoRGB - color space conversion SYNOPSIS #include <imp.h> W Conversions: void impRGBtoW(short *rbuf, short *gbuf, short *bbuf, short *wbuf, int n); void impWtoRGB(short *wbuf, short *rbuf, short *gbuf, short *bbuf, int n); K Conversions: void impRGBtoK(short *rbuf, short *gbuf, short *bbuf, short *kbuf, short unity, int n); void impKtoRGB(short *kbuf, short *rbuf, short *gbuf, short *bbuf, short unity, int n); CMY Conversions: void impRGBtoCMY(short *rbuf, short *gbuf, short *bbuf, short *cbuf, short *mbuf, short *ybuf, short unity, int n); void impCMYtoRGB(short *cbuf, short *mbuf, short *ybuf, short *rbuf, short *gbuf, short *bbuf, short unity, int n); YIQ Conversions: void impRGBtoYIQ(short *rbuf, short *gbuf, short *bbuf, short *ybuf, short *ibuf, short *qbuf, int n); void impYIQtoRGB(short *ybuf, short *ibuf, short *qbuf, short *rbuf, short *gbuf, short *bbuf, int n); YUV Conversions: void impRGBtoYUV(short *rbuf, short *gbuf, short *bbuf, short *ybuf, short *ubuf, short *vbuf, int n); void impYUVtoRGB(short *ybuf, short *ubuf, short *vbuf, short *rbuf, short *gbuf, short *bbuf, int n); YCbCr Conversions: void impRGBtoYCbCr(short *rbuf, short *gbuf, short *bbuf, short *ybuf, short *cbbuf, short *crbuf, int n); void impYCbCrtoRGB(short *ybuf, short *cbbuf, short *crbuf, short *rbuf, short *gbuf, short *bbuf, int n); CMYK Conversions: void impRGBtoCMYK(short *rbuf, short *gbuf, short *bbuf, short *cbuf, short *mbuf, short *ybug, short *kbuf, short unity, int n); void impRGBtoDevCMYK(short *rbuf, short *gbuf, short *bbuf, short *cbuf, short *mbuf, short *ybug, short *kbuf, IMPUCRFunc ucr, IMPBGFunc bg, short unity, int n); short (*IMPBGFunc)(short k); short (*IMPUCRFunc)(short k); void impCMYKtoRGB(short *cbuf, short *mbuf, short *ybuf, short *kbuf, short *rbuf, short *gbug, short *bbuf, short unity, int n); HSV Conversions: void impRGBtoHSV(short *rbuf, short *gbuf, short *bbuf, float *hbuf, float *sbuf, float *vbuf, int n); void impHSVtoRGB(float *hbuf, float *sbuf, float *vbuf, short *rbuf, short *gbuf, short *bbuf, int n); HLS Conversions: void impRGBtoHLS(short *rbuf, short *gbuf, short *bbuf, float *hbuf, float *lbuf, float *sbuf, short unity, int n); void impHLStoRGB(float *hbuf, float *lbuf, float *sbuf, short *rbuf, short *gbuf, short *bbuf, short unity, int n); DESCRIPTION The functions described here perform color space conversion between a given color space and RGB. The actual transformations performed are described below. Certain functions specify the parameter unity. unity should be set to the value of maximum possible intensity for the arrays specified. For example, if eight bit data is being converted, unity would be specified as 255. If the data makes use of the full sixteen bits available in each array element, unity would be specified as 65535. Note that the parameter n specifies the number of elements in the arrays and not the number of bytes. W Conversions: R W = | 0.299 0.587 0.114 | * G B | | R W G = W B W | | | | K Conversions: 1.0 - R K = | 0.299 0.587 0.114 | * 1.0 - G 1.0 - B | | R 1.0 - K G = 1.0 - K B 1.0 - K | | | | CMY Conversions: C 1.0 - R M = 1.0 - G Y 1.0 - B | | | | R 1.0 - C G = 1.0 - M B 1.0 - Y | | | | YIQ Conversions: Y 0.299 0.587 0.114 R I = 0.596 -0.274 -0.322 * G Q 0.212 -0.523 0.311 B | | | | | | R 1.000 0.955 0.622 Y G = 1.000 -0.271 -0.648 * I B 1.000 -1.107 1.702 Q | | | | | | | | | | | | YUV Conversions: Y 0.299 0.587 0.114 R U = -0.147 -0.289 0.436 * G V 0.615 -0.515 -0.100 B | | | | | | R 1.000 0.000 1.140 Y G = 1.000 -0.395 -0.581 * U B 1.000 2.032 0.000 V | | | | | | YCbCr Conversions: Y 0.299 0.587 0.114 R Cb = -0.169 -0.331 0.500 * G Cr 0.500 -0.419 -0.081 B | | | | | | R 1.000 -0.001 1.402 Y G = 1.000 -0.344 -0.714 * Cb B 1.000 1.772 0.001 Cr | | | | | | CMYK Conversions: Ci = 1.0 - R Mi = 1.0 - G Yi = 1.0 - B K = Min(Ci, Mi, Yi) C = Ci - K M = Mi - K Y = Yi - K Ci = 1.0 - R Mi = 1.0 - G Yi = 1.0 - B Ki = Min(Ci, Mi, Yi) Kucr = UCR(Ki) Device C = Min(1.0, Max(0.0, Ci - Kucr)) Device M = Min(1.0, Max(0.0, Mi - Kucr)) Device Y = Min(1.0, Max(0.0, Yi - Kucr)) Device K = BG(Ki) Ci = C + K Mi = M + K Yi = Y + K R = 1.0 - Min(1.0, Ci) G = 1.0 - Min(1.0, Mi) B = 1.0 - Min(1.0, Yi) For HSV conversions refer to Computer Graphics, Principals and Practice, Foley and Van Dam, 2nd. Edition, pp. 590-592. For HLS conversions refer to the citing above pp. 592-595. NOTE It is the caller's responsibility to allocate all buffer storage. SEE ALSO libimp(3)