Skip to content

trans_to_rgbtrans_to_rgbTransToRgbTransToRgbtrans_to_rgbtrans_to_rgb🔗

Short description🔗

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

Signature🔗

trans_to_rgb( image ImageInput1, image ImageInput2, image ImageInput3, out image ImageRed, out image ImageGreen, out image ImageBlue, string ColorSpace )trans_to_rgb( ImageInput1, ImageInput2, ImageInput3 : ImageRed, ImageGreen, ImageBlue : ColorSpace : )void TransToRgb( const HObject& ImageInput1, const HObject& ImageInput2, const HObject& ImageInput3, HObject* ImageRed, HObject* ImageGreen, HObject* ImageBlue, const HTuple& ColorSpace )static void HOperatorSet.TransToRgb( HObject imageInput1, HObject imageInput2, HObject imageInput3, out HObject imageRed, out HObject imageGreen, out HObject imageBlue, HTuple colorSpace )def trans_to_rgb( image_input_1: HObject, image_input_2: HObject, image_input_3: HObject, color_space: str ) -> Tuple[HObject, HObject, HObject]

Herror trans_to_rgb( const Hobject ImageInput1, const Hobject ImageInput2, const Hobject ImageInput3, Hobject* ImageRed, Hobject* ImageGreen, Hobject* ImageBlue, const char* ColorSpace )

Herror T_trans_to_rgb( const Hobject ImageInput1, const Hobject ImageInput2, const Hobject ImageInput3, Hobject* ImageRed, Hobject* ImageGreen, Hobject* ImageBlue, const Htuple ColorSpace )

HImage HImage::TransToRgb( const HImage& ImageInput2, const HImage& ImageInput3, HImage* ImageGreen, HImage* ImageBlue, const HString& ColorSpace ) const

HImage HImage::TransToRgb( const HImage& ImageInput2, const HImage& ImageInput3, HImage* ImageGreen, HImage* ImageBlue, const char* ColorSpace ) const

HImage HImage::TransToRgb( const HImage& ImageInput2, const HImage& ImageInput3, HImage* ImageGreen, HImage* ImageBlue, const wchar_t* ColorSpace ) const (Windows only)

HImage HImage.TransToRgb( HImage imageInput2, HImage imageInput3, out HImage imageGreen, out HImage imageBlue, string colorSpace )

Description🔗

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

The operator trans_to_rgbTransToRgb supports the image types byte, uint2, int4, and real. The domain of the input images must match the domain provided by a corresponding transformation with trans_from_rgbTransFromRgb. If not, the results of the transformation may not be reasonable.

This includes some scalings in the case of certain image types and transformations:

  • Considering byte and uint2 images, the domain of color space values is expected to be spread to the full domain of [0..255] or [0..65535], respectively. This includes a shift in the case of signed values, such that the origin of signed values (e.g., CIELab) may not be at the center of the domain.

  • Hue values are represented by angles of [0..2\(\pi\)[ and are coded for the particular image types differently:

    • byte-images map the angle domain on \([0..255]\).

    • uint2/int4-images are coded in minutes of arc \([0..21600[\), except for the transformations 'cielchab'"cielchab" and 'cielchuv'"cielchuv" for int4-images, where they are coded in seconds of arc \([0..1296000[\).

    • real-images are coded in radians [0..2\(\pi\)[, except for the transformations 'cielchab'"cielchab" and 'cielchuv'"cielchuv", where the standards ISO 11664-4:2008 and ISO 11664-5:2009 require the hue to be specified in degrees.

  • Saturation values are represented by percentages of \([0..100]\) and are coded for the particular image type differently:

    • byte-images map the saturation values to \([0..255]\).

    • uint2/int4-images map the saturation values to \([0..10000]\).

    • real-images map the saturation values to \([0..1]\).

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 precision the values obtained using the given equations may slightly differ from the values returned by the operator.

  • ‘yiq’

    \[\begin{eqnarray*} \left( \begin{array}{c} R \\ G \\ B \end{array} \right) = \left( \begin{array}{rrr} 1.0 & 0.946882217 & 0.623556582 \\ 1.0 & -0.267024956 & -0.649523352 \\ 1.0 & -1.108545035 & 1.709006928 \end{array} \right) \left( \begin{array}{c} Y \\ I \\ Q \end{array} \right) \end{eqnarray*}\]

    Value range: \(Y\in[0; 1]\), \(I\in[-0.59947; 0.59947]\), \(Q\in[-0.52243; 0.52243]\)

  • ‘yuv’

    \[\begin{eqnarray*} \begin{array}{ccl} R & = & Y + \frac{1.0}{0.877} V\\ G & = & Y - \frac{0.114}{0.493*0.587} U - \frac{0.299 }{ 0.877 * 0.587 }V\\ B & = & Y + \frac{1.0}{ 0.493} U \end{array} \end{eqnarray*}\]

    Note, this implies that \(Y\), \(U\), and \(V\) are not independent of each other.

    Value range: \(Y \in [0.0; 1.0]\) \(U \in [-0.436798; 0.436798]\) \(V \in [-0.614777; 0.614777]\)

  • ‘argyb’

    \[\begin{eqnarray*} \left( \begin{array}{c} R \\ G \\ B \end{array} \right) = \left( \begin{array}{rrr} 1.00 & 1.29 & 0.22 \\ 1.00 & -0.71 & 0.22 \\ 1.00 & 0.29 & -1.78 \end{array} \right) \left( \begin{array}{c} A \\ Rg \\ Yb \end{array} \right) \end{eqnarray*}\]

    Value range: \(A\in[0; 1]\), \(Rg\in[-0.5; 0.5]\), \(Yb\in[-0.5; 0.5]\)

  • ‘ciexyz’

    \[\begin{eqnarray*} \left( \begin{array}{c} R \\ G \\ B \end{array} \right) = \left( \begin{array}{rrr} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311 \end{array} \right) \left( \begin{array}{c} X \\ Y \\ Z \end{array} \right) \end{eqnarray*}\]

    Value range: \(X\in[0; 0.950456]\) \(Y\in[0; 1]\) \(Z\in[0; 1.088754]\)

  • ‘cielab’

    \[\begin{eqnarray*} \begin{array}{ccl} f_{y} & = & (L + 16) / 116\\ f_{x} & = & a/500 + f_{y} \\ f_{z} & = & b/200 - f_{y} \\ \\ X & = & \left\{ \begin{array}{c l} X_{w} * f_{x}^3 , & \quad \textrm{if } f_{x} > \frac{6}{29} \\ (f_{x} - \frac{4}{29}) * X_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ \\ Y & = & \left\{ \begin{array}{c l} Y_{w} * f_{y}^3, & \quad \textrm{if } f_{y} > \frac{6}{29} \\ (f_{y} - \frac{4}{29}) * Y_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ \\ Z & = & \left\{ \begin{array}{c l} Z_{w} * f_{z}^3, & \quad \textrm{if } f_{z} > \frac{6}{29} \\ (f_{z} - \frac{4}{29}) * Z_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ \\ \left( \begin{array}{c} R \\ G \\ B \end{array} \right) & = & \left( \begin{array}{rrr} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311 \end{array} \right) \left( \begin{array}{c} X \\ Y \\ Z \end{array} \right) \end{array} \end{eqnarray*}\]

    Black point B: (\(R_{B}\), \(G_{B}\), \(B_{B}\)) = (0, 0, 0)

    White point W (according to image type):

    • byte: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (255, 255, 255)

    • uint2: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{16}-1\), \(2^{16}-1\), \(2^{16}-1\))

    • int4: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{31}-1\), \(2^{31}-1\), \(2^{31}-1\))

    • real: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (1.0, 1.0, 1.0)

    Value range: \(L\in[0; 100]\), \(a\in[-86.1813; 98.2352]\), \(b\in[-107.8617; 94.4758]\) (byte and uint2: scaled to the maximum gray value. int4: \(L\) is scaled to the maximum gray value, \(a\) and \(b\) is scaled to the minimum gray value, such that the origin stays at 0.)

  • ‘cielchab’

    \[\begin{eqnarray*} \begin{array}{ccl} a & = & C_{ab} \cos h_{ab}\\ b & = & C_{ab} \sin h_{ab}\\ f_{y} & = & (L + 16) / 116\\ f_{x} & = & a/500 + f_{y} \\ f_{z} & = & b/200 - f_{y} \\ \\ X & = & \left\{ \begin{array}{c l} X_{w} * f_{x}^3 , & \quad \textrm{if } f_{x} > \frac{6}{29} \\ (f_{x} - \frac{4}{29}) * X_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ \\ Y & = & \left\{ \begin{array}{c l} Y_{w} * f_{y}^3, & \quad \textrm{if } f_{y} > \frac{6}{29} \\ (f_{y} - \frac{4}{29}) * Y_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ \\ Z & = & \left\{ \begin{array}{c l} Z_{w} * f_{z}^3, & \quad \textrm{if } f_{z} > \frac{6}{29} \\ (f_{z} - \frac{4}{29}) * Z_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ \\ \left( \begin{array}{c} R \\ G \\ B \end{array} \right) & = & \left( \begin{array}{rrr} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311 \end{array} \right) \left( \begin{array}{c} X \\ Y \\ Z \end{array} \right) \end{array} \end{eqnarray*}\]

    Black point B: (\(R_{B}\), \(G_{B}\), \(B_{B}\)) = (0, 0, 0)

    White point W (according to image type):

    • byte: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (255, 255, 255)

    • uint2: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{16}-1\), \(2^{16}-1\), \(2^{16}-1\))

    • int4: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{31}-1\), \(2^{31}-1\), \(2^{31}-1\))

    • real: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (1.0, 1.0, 1.0)

    Value range: \(L\in[0; 100]\), \(C\in[0; 133.8086]\), \(h\in[0; 360[\) (byte: scaled to the maximum gray value. uint2: \(L\) and \(C\) are scaled to the maximum gray value, \(h\) is given in minutes of arc. int4: \(L\) and \(C\) are scaled to the maximum gray value, \(h\) is given in seconds of arc.)

  • ‘cieluv’

    \[\begin{eqnarray*} \begin{array}{ccl} f_{y} & = & (L + 16) / 116\\ Y & = & \left\{ \begin{array}{c l} Y_{w} * f_{y}^3, & \quad \textrm{if } f_{y} > \frac{6}{29} \\ (f_{y} - \frac{4}{29}) * Y_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ u' & = & \frac{u}{13 L} + u_{w}' \\ v' & = & \frac{v}{13 L} + v_{w}' \\ x & = & \frac{9 u'}{6 u' - 16 v' + 12} \\ y & = & \frac{4 v'}{6 u' - 16 v' + 12} \\ X & = & \frac{x Y}{y} \\ Z & = & (1-x-y) \frac{Y}{y} \\ \\ \left( \begin{array}{c} R \\ G \\ B \end{array} \right) & = & \left( \begin{array}{rrr} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311 \end{array} \right) \left( \begin{array}{c} X \\ Y \\ Z \end{array} \right) \end{array} \end{eqnarray*}\]

    Black point B: (\(R_{B}\), \(G_{B}\), \(B_{B}\)) = (0, 0, 0)

    White point W (according to image type):

    • byte: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (255, 255, 255)

    • uint2: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{16}-1\), \(2^{16}-1\), \(2^{16}-1\))

    • int4: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{31}-1\), \(2^{31}-1\), \(2^{31}-1\))

    • real: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (1.0, 1.0, 1.0)

    Value range: \(L\in[0; 100]\), \(u\in[-83.0774; 175.0148]\), \(v\in[-134.1008; 107.3923]\) (byte and uint2: scaled to the maximum gray value. int4: \(L\) are scaled to the maximum gray value, \(u\) and \(v\) are scaled to the minimum gray value, such that the origin stays at 0.)

  • ‘cielchuv’

    \[\begin{eqnarray*} \begin{array}{ccl} u & = & C_{uv} \cos h_{uv} \\ v & = & C_{uv} \sin h_{uv} \\ f_{y} & = & (L + 16) / 116 \\ Y & = & \left\{ \begin{array}{c l} Y_{w} * f_{y}^3, & \quad \textrm{if } f_{y} > \frac{6}{29} \\ (f_{y} - \frac{4}{29}) * Y_{w} * \frac{108}{841}, & \quad \textrm{otherwise}\\ \end{array} \right.\\ u' & = & \frac{u}{13 L} + u_{w}' \\ v' & = & \frac{u}{13 L} + v_{w}' \\ x & = & \frac{9 u'}{6 u' - 16 v' + 12} \\ y & = & \frac{4 v'}{6 u' - 16 v' + 12} \\ X & = & \frac{x Y}{y} \\ Z & = & (1-x-y) \frac{Y}{y} \\ \\ \left( \begin{array}{c} R \\ G \\ B \end{array} \right) & = & \left( \begin{array}{rrr} 3.240479 & -1.53715 & -0.498535 \\ -0.969256 & 1.875991 & 0.041556 \\ 0.055648 & -0.204043 & 1.057311 \end{array} \right) \left( \begin{array}{c} X \\ Y \\ Z \end{array} \right) \end{array} \end{eqnarray*}\]

    Black point B: (\(R_{B}\), \(G_{B}\), \(B_{B}\)) = (0, 0, 0)

    White point W (according to image type):

    • byte: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (255, 255, 255)

    • uint2: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{16}-1\), \(2^{16}-1\), \(2^{16}-1\))

    • int4: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (\(2^{31}-1\), \(2^{31}-1\), \(2^{31}-1\))

    • real: (\(R_{W}\), \(G_{W}\), \(B_{W}\)) = (1.0, 1.0, 1.0)

    Value range: \(L\in[0; 100][\), \(C\in[0; 179.0402]\), \(h\in[0; 360[\) (byte: scaled to the maximum gray value. uint2: \(L\) and \(C\) are scaled to the maximum gray value, \(h\) is given in minutes of arc. int4: \(L\) and \(C\) are scaled to the maximum gray value, \(h\) is given in seconds of arc.)

  • ‘hls’

            Hi := floor(H/rad(60))
            Hf := H/rad(60) - Hi
            if (L <= 0.5)
               Max := L * (S + 1)
            else
               Max := L + S - (L * S)
            endif
            Min := 2 * L - Max
            if (S == 0)
               R := L
               G := L
               B := L
            else
              if (Hi == 0)
                 R := Max
                 G := Min + Hf * (Max - Min)
                 B := Min
              elseif (Hi == 1)
                 R := Min + (1 - Hf) * (Max - Min)
                 G := Max
                 B := Min
              elseif (Hi == 2)
                 R := Min
                 G := Max
                 B := Min + Hf * (Max - Min)
              elseif (Hi == 3)
                 R := Min
                 G := Min + (1 - Hf) * (Max - Min)
                 B := Max
              elseif (Hi == 4)
                 R := Min + Hf * (Max - Min)
                 G := Min
                 B := Max
              elseif (Hi == 5)
                 R := Max
                 G := Min
                 B := Min + (1 - Hf) * (Max - Min)
              endif
            endif
        

    Value range: \(H\in[0; 2\pi[\), \(L\in[0; 1]\), \(S\in[0; 1]\)

  • ‘hsi’

    \[\begin{eqnarray*} \begin{array}{l l l} M1 & = & S * \cos{H} \\ M2 & = & S * \sin{H} \\ I1 & = & I * \sqrt{3} \\ \\ \left( \begin{array}{c} R \\ G \\ B \end{array} \right) & = & \left( \begin{array}{rrr} \frac{2}{\sqrt{6}} & 0 & \frac{1}{\sqrt{3}} \\ \frac{-1}{\sqrt{6}} & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{3}} \\ \frac{-1}{\sqrt{6}} & \frac{-1}{\sqrt{2}} & \frac{1}{\sqrt{3}} \end{array} \right) \left( \begin{array}{c} M1 \\ M2 \\ I1 \end{array} \right) \end{array} \end{eqnarray*}\]

    Value range: \(H\in[0; 2\pi[\), \(S\in[0; \sqrt{\frac{2}{3}}]\), \(I\in[0; 1]\)

  • ‘hsv’

            if (S == 0)
               R := V
               G := V
               B := V
            else
               Hi := floor(H/rad(60))
               Hf := H/rad(60) - Hi
               if (Hi == 0)
                  R := V
                  G := V * (1 - (S * (1 - Hf)))
                  B := V * (1 - S)
               elseif (Hi == 1)
                  R := V * (1 - (S * Hf))
                  G := V
                  B := V * (1 - S)
               elseif (Hi == 2)
                  R := V * (1 - S)
                  G := V
                  B := V * (1 - (S * (1 - Hf)))
               elseif (Hi == 3)
                  R := V * (1 - S)
                  G := V * (1 - (S * Hf))
                  B := V
               elseif (Hi == 4)
                  R := V * (1 - (S * (1 - Hf)))
                  G := V * (1 - S)
                  B := V
               elseif (Hi == 5)
                  R := V
                  G := V * (1 - S)
                  B := V * (1 - (S * Hf))
               endif
            endif
        

    Value range: \(H\in[0; 2\pi[\), \(S\in[0; 1]\), \(V\in[0; 1]\)

  • ‘ciexyz4’

    \[\begin{eqnarray*} \left( \begin{array}{c} R \\ G \\ B \end{array} \right) = \left( \begin{array}{rrr} 2.750 & -1.149 & -0.426 \\ -1.118 & 2.026 & 0.033 \\ 0.138 & -0.333 & 1.104 \end{array} \right) \left( \begin{array}{c} X \\ Y \\ Z \end{array} \right) \end{eqnarray*}\]

    Value range: \(X\in[0; 0.95]\), \(Y\in[0; 1]\), \(Z\in[0; 1.09]\)

  • ‘lms’

    \[\begin{eqnarray*} \left( \begin{array}{c} R \\ G \\ B \end{array} \right) = \left( \begin{array}{rrr} 2.858334 & -1.628721 & -0.024820 \\ -0.210432 & 1.158402 & 0.000321 \\ -0.041894 & -0.118163 & 1.068973 \end{array} \right) \left( \begin{array}{c} L \\ M \\ S \end{array} \right) \end{eqnarray*}\]

    Value range: \(L\in[0; 0.949280]\), \(M\in[0; 1.035401]\), \(S\in[0; 1.087132]\)

Attention🔗

As the calculations are made with a different numerical precision, the OpenCL implementation of the cielab transformation for images of type int4 is slightly less accurate than the pure C version.

Execution information🔗

Execution information
  • Supports OpenCL compute devices.

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on domain level.

Parameters🔗

ImageInput1imageInput1image_input_1 (input_object) singlechannelimage(-array) → object (byte / uint2 / int4 / real)object (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)HImage (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)Hobject (byte / uint2 / int4 / real)

Input image (channel 1).

ImageInput2imageInput2image_input_2 (input_object) singlechannelimage(-array) → object (byte / uint2 / int4 / real)object (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)HImage (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)Hobject (byte / uint2 / int4 / real)

Input image (channel 2).

ImageInput3imageInput3image_input_3 (input_object) singlechannelimage(-array) → object (byte / uint2 / int4 / real)object (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)HImage (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)Hobject (byte / uint2 / int4 / real)

Input image (channel 3).

ImageRedimageRedimage_red (output_object) singlechannelimage(-array) → object (byte / uint2 / int4 / real)object (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)HImage (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)Hobject * (byte / uint2 / int4 / real)

Red channel.

ImageGreenimageGreenimage_green (output_object) singlechannelimage(-array) → object (byte / uint2 / int4 / real)object (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)HImage (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)Hobject * (byte / uint2 / int4 / real)

Green channel.

ImageBlueimageBlueimage_blue (output_object) singlechannelimage(-array) → object (byte / uint2 / int4 / real)object (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)HImage (byte / uint2 / int4 / real)HObject (byte / uint2 / int4 / real)Hobject * (byte / uint2 / int4 / real)

Blue channel.

ColorSpacecolorSpacecolor_space (input_control) string → (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Color space of the input image.

Default: 'hsv'"hsv"
List of values: 'argyb', 'cielab', 'cielchab', 'cielchuv', 'cieluv', 'ciexyz', 'ciexyz4', 'hls', 'hsi', 'hsv', 'lms', 'yiq', 'yuv'"argyb", "cielab", "cielchab", "cielchuv", "cieluv", "ciexyz", "ciexyz4", "hls", "hsi", "hsv", "lms", "yiq", "yuv"
List of values (for compute devices): 'cielab', 'cielchab', 'cielchuv', 'cieluv', 'hsi', 'hsv'"cielab", "cielchab", "cielchuv", "cieluv", "hsi", "hsv"

Example🔗

(HDevelop)


* Transformation from rgb to hsv and conversely
read_image(Image,'patras')
dev_display(Image)
decompose3(Image, Image1, Image2, Image3)
trans_from_rgb(Image1,Image2,Image3,ImageH,ImageS,ImageV,'hsv')
trans_to_rgb(ImageH,ImageS,ImageV,ImageR,ImageG,ImageB,'hsv')
compose3(ImageR,ImageG,ImageB,Multichannel)
dev_display(Multichannel)
(C)
/* Transformation from rgb to hsv and conversely */
read_image(Image,"patras")\;
disp_color(Image,WindowHandle)\;
decompose3(Image,&Rimage,&Gimage,&Bimage)\;
trans_from_rgb(Rimage,Gimage,Bimage,&Image1,&Image2,&Image3,"hsv")\;
trans_to_rgb(Image1,Image2,Image3,&ImageRed,&ImageGreen,&ImageBlue,"hsv")\;
compose3(ImageRed,ImageGreen,ImageBlue,&Multichannel)\;
disp_color(Multichannel,WindowHandle)\;

Result🔗

trans_to_rgbTransToRgb returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system(::'no_object_result', <Result>:). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

decompose3Decompose3

Possible successors

compose3Compose3, disp_colorDispColor

Alternatives

linear_trans_colorLinearTransColor

See also

decompose3Decompose3, trans_from_rgbTransFromRgb

References🔗

ITU-R BT.470-6: “Conventional Television Systems”, 1998.

ISO 11664-4:2008: ``Colorimetry — Part 4: CIE 1976 Lab* Colour space’‘, 2008.

ISO 11664-5:2009: ``Colorimetry — Part 5: CIE 1976 Luv* Colour space and u’,v’ uniform chromaticity scale diagram’‘, 2009.

Module🔗

Foundation