ClassesClassesClassesClasses | | | | Operators

trans_from_rgbtrans_from_rgbTransFromRgbtrans_from_rgbTransFromRgbTransFromRgb (Operator)

Name

trans_from_rgbtrans_from_rgbTransFromRgbtrans_from_rgbTransFromRgbTransFromRgb — Transform an image from the RGB color space to an arbitrary color space.

Signature

trans_from_rgb(ImageRed, ImageGreen, ImageBlue : ImageResult1, ImageResult2, ImageResult3 : ColorSpace : )

Herror trans_from_rgb(const Hobject ImageRed, const Hobject ImageGreen, const Hobject ImageBlue, Hobject* ImageResult1, Hobject* ImageResult2, Hobject* ImageResult3, const char* ColorSpace)

Herror T_trans_from_rgb(const Hobject ImageRed, const Hobject ImageGreen, const Hobject ImageBlue, Hobject* ImageResult1, Hobject* ImageResult2, Hobject* ImageResult3, const Htuple ColorSpace)

Herror trans_from_rgb(Hobject ImageRed, Hobject ImageGreen, Hobject ImageBlue, Hobject* ImageResult1, Hobject* ImageResult2, Hobject* ImageResult3, const HTuple& ColorSpace)

HImage HImage::TransFromRgb(const HImage& ImageGreen, const HImage& ImageBlue, HImage* ImageResult2, HImage* ImageResult3, const HTuple& ColorSpace) const

HImageArray HImageArray::TransFromRgb(const HImageArray& ImageGreen, const HImageArray& ImageBlue, HImageArray* ImageResult2, HImageArray* ImageResult3, const HTuple& ColorSpace) const

void TransFromRgb(const HObject& ImageRed, const HObject& ImageGreen, const HObject& ImageBlue, HObject* ImageResult1, HObject* ImageResult2, HObject* ImageResult3, const HTuple& ColorSpace)

HImage HImage::TransFromRgb(const HImage& ImageGreen, const HImage& ImageBlue, HImage* ImageResult2, HImage* ImageResult3, const HString& ColorSpace) const

HImage HImage::TransFromRgb(const HImage& ImageGreen, const HImage& ImageBlue, HImage* ImageResult2, HImage* ImageResult3, const char* ColorSpace) const

void HOperatorSetX.TransFromRgb(
[in] IHUntypedObjectX* ImageRed, [in] IHUntypedObjectX* ImageGreen, [in] IHUntypedObjectX* ImageBlue, [out] IHUntypedObjectX*ImageResult1, [out] IHUntypedObjectX*ImageResult2, [out] IHUntypedObjectX*ImageResult3, [in] VARIANT ColorSpace)

IHImageX* HImageX.TransFromRgb(
[in] IHImageX* ImageGreen, [in] IHImageX* ImageBlue, [out] IHImageX*ImageResult2, [out] IHImageX*ImageResult3, [in] BSTR ColorSpace)

static void HOperatorSet.TransFromRgb(HObject imageRed, HObject imageGreen, HObject imageBlue, out HObject imageResult1, out HObject imageResult2, out HObject imageResult3, HTuple colorSpace)

HImage HImage.TransFromRgb(HImage imageGreen, HImage imageBlue, out HImage imageResult2, out HImage imageResult3, string colorSpace)

Description

trans_from_rgbtrans_from_rgbTransFromRgbtrans_from_rgbTransFromRgbTransFromRgb transforms an image from the RGB color space to an arbitrary color space (ColorSpaceColorSpaceColorSpaceColorSpaceColorSpacecolorSpace). The three channels of the image are passed as three separate images on input and output.

The operator trans_from_rgbtrans_from_rgbTransFromRgbtrans_from_rgbTransFromRgbTransFromRgb supports the image types byte, uint2, int4, and real. In the case of real images, all values should lay within 0 and 1. If not, the results of the transformation may not be reasonable.

Certain scalings are performed accordingly to the image type:

Supported are the transformations listed below. Note, all domains are based on RGB values scaled to [0; 1]. To obtain the domain of a certain image type, they must be scaled accordingly with the value range. Due to different precisions the values obtained using the given equations may slightly differ from the values returned by the operator.

'yiq'

Range of values:

'yuv'

Note, this implies that , , and are not independent of each other.

Range of values:

'argyb'

Range of values:

'ciexyz'

The primary colors used correspond to sRGB respectively CIE Rec. 709. D65 is used as white point.

Used primary colors (x, y, z):

Range of values:

'hls'

  Min := min([R, G, B])
  Max := max([R, G, B])
  L := (Min + Max) / 2
  if (Max == Min)
     H := 0
     S := 0
  else
     if (L > 0.5)
        S := (Max - Min) / (2 - Max - Min)
     else
        S := (Max - Min) / (Max + Min)
     endif
     if (R == Max)
        H := ((G - B) / (Max - Min)) * rad(60)
     elseif (G == Max)
        H := (2 + (B - R) / (Max - Min)) * rad(60)
     elseif (B == Max)
        H := (4 + (R - G) / (Max - Min)) * rad(60)
     endif
  endif

Range of values:

'hsi'

Range of values:

'hsv'

  Min := min([R, G, B])
  Max := max([R, G, B])
  V := Max
  if (Max == Min)
     S := 0
     H := 0
  else
     S := (Max - Min) / Max
     if (R == Max)
        H := ((G - B) / (Max - Min)) * rad(60)
     elseif (G == Max)
        H := (2 + (B - R) / (Max - Min)) * rad(60)
     elseif (B == Max)
        H := (4 + (R - G) / (Max - Min)) * rad(60)
     endif
  endif

Range of values:

'ihs'

   Min := min([R, G, B])
   Max := max([R, G, B])
   I := (R + G + B) / 3
   if (I == 0)
      H := 0
      S := 1
   else
      S := 1 - Min / I
      if (S == 0)
           H := 0
      else
         X := (R + R - G - B) / 2
         Y := (R - G) * (R - G) + (R - B) * (G - B)
         Z := sqrt(Y)
         if (Z == 0)
            H := 0
         else
            H := acos(X / Z)
         endif
         if (B > G)
            H := rad(360) - H
         endif
      endif
   endif
 

Range of values:

'cielab'

where

     f(t) = t^(1/3),           t > (24/116)^3
     f(t) = (841/108)*t + 16/116,  otherwise.

     Black point B: (Rb, Gb, Bb) = (0, 0, 0)
     White point W = (Rw, Gw, Bw), according to image type:
       byte:=(255, 255, 255), uint2:=(2^16-1, 2^16-1, 2^16-1),
       int4:=(2^31-1, 2^31-1, 2^31-1), real:=(1.0, 1.0, 1.0)
   

Range of values:

(Scaled to the maximum gray value in the case of byte and uint2. In the case of int4 L and a are scaled to the maximum gray value, b is scaled to the minimum gray value, such that the origin stays at 0.)

'cielchab'

where

     f(t) = t^(1/3),           t > (24/116)^3
     f(t) = (841/108)*t + 16/116,  otherwise.

     h_ab lies between 0° and 90° if a and b are both positive,
     between 90° and 180° if a is negative and b is positive,
     between 180° and 270° if a and b are both negative, and
     between 270° and 360° if a is positive and b is negative.

     Black point B: (Rb, Gb, Bb) = (0, 0, 0)
     White point W = (Rw, Gw, Bw), according to image type:
       byte:=(255, 255, 255), uint2:=(2^16-1, 2^16-1, 2^16-1),
       int4:=(2^31-1, 2^31-1, 2^31-1), real:=(1.0, 1.0, 1.0)
   

Range of values:

(Scaled to the maximum gray value in the case of byte and uint2. In the case of int4, L and C are scaled to the maximum gray value, while h is given in seconds of arc.)

'cieluv'

where

     f(t) = t^(1/3),           t > (24/116)^3
     f(t) = (841/108)*t + 16/116,  otherwise.

     Black point B: (Rb, Gb, Bb) = (0, 0, 0)
     White point W = (Rw, Gw, Bw), according to image type:
       byte:=(255, 255, 255), uint2:=(2^16-1, 2^16-1, 2^16-1),
       int4:=(2^31-1, 2^31-1, 2^31-1), real:=(1.0, 1.0, 1.0)
   

Range of values:

(Scaled to the maximum gray value in the case of byte and uint2. In the case of int4 L and u are scaled to the maximum gray value, v is scaled to the minimum gray value, such that the origin stays at 0.)

'cielchuv'

where

     f(t) = t^(1/3),           t > (24/116)^3
     f(t) = (841/108)*t + 16/116,  otherwise.

     h_uv lies between 0° and 90° if u and v are both positive,
     between 90° and 180° if u is negative and v is positive,
     between 180° and 270° if u and v are both negative, and
     between 270° and 360° if u is positive and v is negative.

     Black point B: (Rb, Gb, Bb) = (0, 0, 0)
     White point W = (Rw, Gw, Bw), according to image type:
       byte:=(255, 255, 255), uint2:=(2^16-1, 2^16-1, 2^16-1),
       int4:=(2^31-1, 2^31-1, 2^31-1), real:=(1.0, 1.0, 1.0)
   

Range of values:

(Scaled to the maximum gray value in the case of byte and uint2. In the case of int4, L and C are scaled to the maximum gray value, while h is given in seconds of arc.)

'i1i2i3'

Range of values:

'ciexyz2'