Pixel-to-Pixel Operations (Point-to-point Operations) Part 4 Color Image Processing

ORT Braude Engineering College, Course: Image Processing 31651, Lecturer: Dr. Samuel Kosolapov [email protected] The Spectral Range of Visible Light

2 Human Visual System: 3 basic Colors: RGB

3 The three light primaries: Red, Green, and Blue (RGB)

Each pixel on the computer monitor is made up of a triad of red, green, and blue “phosphors”

4 (Outdated) RGB CRT How Color Image is (WAS !!!) created (by howstuffworks & Wikipedia)

5 CRT: “Phosphor”: only 3 Colors needed

In a color screen, there are three phosphors arranged as dots or stripes that emit red, green and blue light.

There are also three electron beams to illuminate the three different colors together.

There are thousands of different phosphors that have been formulated.

They are characterized by their emission color and the length of time emission lasts after they are excited

6 Shadow mask

Used in cathode ray tube (CRT) televisions and computer displays Tiny holes in a metal plate separate the colored phosphors in the layer behind the front glass of the screen. The holes are placed in a manner ensuring that electrons from each of the tube's three cathode guns reach only the appropriately-colored phosphors on the display

All three beams pass through the same holes in the mask, but the angle of approach is different for each gun. The spacing of the holes, the spacing of the phosphors, and the placement of the guns is arranged so that for example the blue gun only has an unobstructed path to blue phosphors. The red, green, and blue phosphors for each pixel are generally arranged in a triangular shape (sometimes called a "triad"). This principle was first proposed by Werner Flechsig in a German patent in 1938.

7 Tension mask

An aperture grille (tension mask) used to manufacture color cathode ray tube (CRT) televisions and computer displays; Fine vertical wires behind the front glass of the display screen separate the different colors of phosphors into strips.

Advantages: Trinitron grille cuts off much less of the signal coming from the electron guns (25% - 85%) Trinitron systems are easier to focus than shadow masks, and generally had a sharper image. This was a major selling point of the Trinitron design for much of its history. In the 1990s new computer controlled real-time feedback focusing systems eliminated this advantage

8 Trinitron

The first patented aperture grille televisions were manufactured by Sony in the late 1960s under the Trinitron brand name.

Sony's patent on the Trinitron display ran out in 1996, after 20 years. After the expiration of Sony's Trinitron patent, manufacturers like Mitsubishi were free to use the Trinitron design for their own product line without license from Sony although they could not use the Trinitron name.

9 CRT: Color Fidelity Please compare and provide conclusions about Chances to achieve Color Fidelity

10 Spectrum/Color transformations (Integrals)

11 RGB : Basic Colors Value of Each color is integral Float units { 0..1.0 } (Scientific calculation: MATLAB)

12 How to process RGB Color Image: Option 1

Split Color Image to 3 Color Bands /Planes/“Images” And process each "color plane" independently

Problem: Possible color distortion + Slow : Split+ 3*Process + Combine

Key Word: Multi-band Color Processing (More than 3 colors: satellites) 13 RGB Color Space: Color Mix: Magenta, Cyan, Yellow

Color RGB Red {255,0,0} Yellow {255,255,0} Green {0,255,0 } Cyan {0,255,255} Blue {0,0,255} Magenta {255,0,255} White {255,255,255} Black {0,0,0}

14 Digital: Color : RGB Space 3 Basic colors 256 levels (good enough for Human Eye)

Number of possible colors = 256 Levels of Red * 256 Levels of Green * 256 Levels of Blue

= ~ 16 millions POSSIBLE colors

== 24 bit per pixel

== true color image

15 Analog Color Encoding

Standards Rationale: Eye “see” Changes in Intensity BETTER then to Changes in Color.

 to LESSEN ANALOG BANDVIDTH in Color TV

“trick is used”: Intensity Info (more bits/BW) + Information about Color (less bits/BW

PAL: Y – luminance vector - decode light intensity U and V – vectors – decodes “color”

16 “Old” Analog TV Matrix Transformation Tables: RGB, YUV (PAL), YIQ (NTSC), YDbDr (SECAM)

17 Digital Color Encoding: More Ideas: Color Circle: R-G-B on the circle  Mixed on the circle

18 Yet more mixing

19 HSV (Hue Saturation Value)

Yet more color mix: This process could continue, creating a solid ring of colors spanning all of the space between the primaries. This definition of color really describes just one dimension of color: hue. Hue is described with the words we normally think of as describing color: red, purple, blue, etc. It will be the first of three dimensions we use to describe color.

Last dimensions is lightness-darkness: Value Value is a linear axis running through the middle of the color wheel

20 HSV (Hue Saturation Value) Color Model

Saturation refers to the dominance of hue in the color. When you reach the center of the wheel, no hue dominates. These colors directly on the central axis are considered desaturated.

These desaturated colors constitute the grayscale 21 HSV  HSL / HSB Color Model

22 Lightness /Brightness / Intensity

Weights ( NTSC, PAL, etc … ) – Not relevant to Digital Systems, but many scientists/developer do not agree with this statement

23 Polite recommendation: Never play with Hue

"Hue" refers to a particular color within the spectrum, as defined by its dominant wavelength, or the central tendency of its combined wavelengths. For example, a light wave with a central tendency within 565-590 nm will be yellow.

In painting color theory, a hue refers to a pure color — one without added white (tint) or black (shade) pigment.

For us: A hue is a color on the Color wheel.

24 BTW: Origin of Color wheel: RGB cube as seen over the diagonal

25 Saturation

Saturation or purity is the intensity of a specific hue. A highly saturated hue has a vivid, intense color, while a less saturated hue appears more muted and grey.

With no saturation at all, the hue becomes a shade of grey.

26 How To Converting Colors Between RGB and HLS (HBS) {Microsoft, MSDN, Help: Full source} Original Version: Paul Borke, Feb 1994

27 Modern Code: How To Converting Colors Between RGB and HLS (HBS) (Microsoft Support – Google the phrase)

The code fragment below converts colors between RGB (Red, Green, Blue) and HLS/HBS (Hue, Lightness, Saturation/Hue, Brightness, Saturation).

A point of reference for the algorithms is Foley and Van Dam, "Fundamentals of Interactive Computer Graphics," Their algorithm is in floating point

There are potential round-off errors throughout this sample. ((0.5 + x)/y) without floating point is phrased ((x + (y/2))/y), yielding a very small round- off error. This makes many of the following divisions look strange.

Remark: Professional code is always “looks strange”

28 For advanced students: Try to understand the code… Find link to see FULL code 29 Practically: Colors in Windows (3.1!!!)

30 Real Windows values

31 Option: 360 Degrees for Hue 100% for saturation and Value

32 PHOTOSHOP: RGB  HSL / HSB / HSM (Non-linear conversion)

Photoshop:

Based on the human perception of color, the HSB model describes three fundamental characteristics of color: Hue is the color reflected from or transmitted through an object. It is measured as a location on the standard color wheel, expressed as a degree between 0° and 360°. In common use, hue is identified by the name of the color such as red, orange, or green.

Saturation, sometimes called chroma, is the strength or purity of the color. Saturation represents the amount of gray in proportion to the hue, measured as a percentage from 0% (gray) to 100% (fully saturated). On the standard color wheel, saturation increases from the center to the edge.

Brightness is the relative lightness or darkness of the color, usually measured as a percentage from 0% (black) to 100% (white).

33 So, what to do with colors: More options

When LUT applicable: Split RGB Image into Red/Gren/Blue sub-images (Bands, Planes) Isolate Lightness/Value and create GrayImage Process this GrayImage and create relevant LUT for Value Apply the same LUT for Red/Gren/Blue sub-images (Bands, Planes) Combine Bands/Planes into RGB image

Disclaimer: Not every Image Processing operations are pixel-to-pixel operations  LUT may not be applicable  color distortions possible

Discuss: Color recognition by a Hue, by using a scalar product (intensity is not important?) optimal Hue / Saturation, recoloring.

34