timag2020 color y textura - fing.edu.uy

58
Color y textura 1

Transcript of timag2020 color y textura - fing.edu.uy

Page 1: timag2020 color y textura - fing.edu.uy

Color y textura

1

Page 2: timag2020 color y textura - fing.edu.uy

¿Qué es el color?

2

[Goethe, 1810]

“El color es producto de la luz a ciertas longitudes de onda”

“El color es producto de la percepción del observador”

[Newton, 1686]

Page 3: timag2020 color y textura - fing.edu.uy

Proceso de visión

3

Page 4: timag2020 color y textura - fing.edu.uy

El color no existe por si mismo

• Igual SPD → Diferentes colores percibidos

• Iguales colores percibidos → Diferentes SPD

• Color appearance is strongly affected by other nearby colors, by adaptation to previous views, and by “state of mind”.

4

Hermann von Helmholtz Ewald Hering

“El color se percibe como la combinación de tres colores

primarios.”

“El color se percibe como la combinación de tres parejas de

colores opuestos.”(rojo, verde y azul) (rojo-verde, blanco-negro y azul-amarillo)

“Controversia Helmhotz-Hering”

… y los dos tenían razón.

Page 5: timag2020 color y textura - fing.edu.uy

Sistema Visual Humano: El ojo

8

Page 6: timag2020 color y textura - fing.edu.uy

Sistema Visual Humano: Fotoreceptores

9

% S

ensit

ivity

400 500 Nanometres 600 700

100-

90-

80-

70-

60-

50-

40-

30-

20-

10-

Human Visual System Color Sensitivity

[Adaptado de https://upload.wikimedia.org/wikipedia/commons/c/c0/Eyesensitivity.svg]https://upload.wikimedia.org/wikipedia/commons/9/94/1416_Color_Sensitivity.jpg

Page 7: timag2020 color y textura - fing.edu.uy

Sistema Visual Humano: La retina

10

Distribución de conos y bastones en la retina.

Page 8: timag2020 color y textura - fing.edu.uy

Enfocar el ojo izquierdo en la cruz, taparse el ojo derecho y colocarse a unos 30 cm de la imagen, hasta que “desaparece” el punto.

Page 9: timag2020 color y textura - fing.edu.uy

Representación del color

12

Experimentos de Wright (1928) y Guild (1931).

Page 10: timag2020 color y textura - fing.edu.uy

Representación del color

• El color es una característica de tres dimensiones.

• Muchos colores pueden representarse como la mezcla de tres “colores primarios” A, B y C. • Adición:

• Principio de tricromacia (tristimulus): con tres colores primarios se pueden generar otros colores (para la mayoría de las personas).

• En general un espacio de representación de color está generalmente asociado con un hardware (displays, impresoras, …)

13

D = waA+ wbB + wcC

D + waA = wbB + wcC ⇒ D = −waA+ wbB + wcC

RGB (aditivo, luz) CMY(K) (sustractivo, pigmentos)

Page 11: timag2020 color y textura - fing.edu.uy

RGB

• Aditivo

• Suma de tres luces sobre un papel.

• Muy simple. Usado en computadoras, monitores, cámaras, scanners, teléfonos, … • Calibración para colorimetría.

• No es ajustado para operaciones con colores (p.e. promedio colores).

14

186 8. Color Images

!"#

!"#

R

G

B

YG

C

B M

W

S

RR75

R50R25

PK

RGB ValuePoint Color R G B

S Black 0.00 0.00 0.00R Red 1.00 0.00 0.00Y Yellow 1.00 1.00 0.00G Green 0.00 1.00 0.00C Cyan 0.00 1.00 1.00B Blue 0.00 0.00 1.00M Magenta 1.00 0.00 1.00W White 1.00 1.00 1.00K 50% Gray 0.50 0.50 0.50

R75 75% Red 0.75 0.00 0.00R50 50% Red 0.50 0.00 0.00R25 25% Red 0.25 0.00 0.00P Pink 1.00 0.50 0.50

Figure 8.1 Representation of the RGB color space as a three-dimensional unit cube. Theprimary colors red (R), green (G), and blue (B) form the coordinate system. The “pure” redcolor (R), green (G), blue (B), cyan (C), magenta (M), and yellow (Y) lie on the vertices ofthe color cube. All the shades of gray, of which K is an example, lie on the diagonal betweenblack S and white W.

three beams of light—one red, one green, and one blue—on a sheet of white pa-per. To create different colors, you would modify the intensity of each of thesebeams independently. The distinct intensity of each primary color beam con-trols the shade and brightness of the resulting color. The colors gray and whiteare created by mixing the three primary color beams at the same intensity. Asimilar operation occurs on the screen of a color television or CRT1-based com-puter monitor, where tiny, close-lying dots of red, green, and blue phosphorousare simultaneously excited by a stream of electrons to distinct energy levels(intensities), creating a seemingly continuous color image.

The RGB color space can be visualized as a three-dimensional unit cube inwhich the three primary colors form the coordinate axis. The RGB values arepositive and lie in the range [0, Cmax]; for most digital images, Cmax = 255.Every possible color Ci corresponds to a point within the RGB color cube ofthe form

Ci = (Ri, Gi, Bi),

where 0 ≤ Ri, Gi, Bi ≤ Cmax. RGB values are often normalized to the interval[0, 1] so that the resulting color space forms a unit cube (Fig. 8.1). The pointS = (0, 0, 0) corresponds to the color black, W = (1, 1, 1) corresponds to thecolor white, and all the points lying on the diagonal between S and W areshades of gray created from equal color components R = G = B.

Figure 8.2 shows a color test image and its corresponding RGB color com-ponents, displayed here as intensity images. We will refer to this image in a1 Cathode ray tube.

<latexit sha1_base64="ZeoPqg89tYRldwOc4VFPc/U4jmU=">AAACvXicdVFRS9xAEN6kWjW19bSPvmwrB754JIK1IKKoYPtQsKWnlks4NnuTu8XNJuxOKkfIj+nv8Rf4Z8Tdu3uweg7s8PF9+80MM2kphcEwvPf8NwuLb5eWV4J3q+8/rLXWNy5NUWkOXV7IQl+nzIAUCrooUMJ1qYHlqYSr9ObU6Vd/QRtRqN84LiHJ2VCJTHCGluq3/sUSMuzFKQyFqpnWbNzUsglOaRwHP1z6E8SgBjMp1mI4wuTwFVfkDNM0x7XziuuXM5y7dDLH1W9thZ1wEvQliGZg6/js4VOz/f3uor/uLcSDglc5KOSSGdOLwhITWxUFl9AEcWWgZPyGDaFnoWI5mKSe7LKhbcsMaFZo+xTSCfvUUbPcmHGe2p85w5F5rjlyntarMPua1EKVFYLi00ZZJSkW1B2GDoQGjnJsAeNa2FkpHzHNONrzBe02fdqIczedsVWo6zSbVRYGtCvI8yqwe4ueb+kluNztRHud8Kdd4AGZxjLZJJ/JNonIPjkm38gF6RLuLXk73hdv3z/ywZe+mn71vZnnI/kv/NtHuMTZ0w==</latexit>

CMY

=

111

RGB

<latexit sha1_base64="dTTMSYoNZXaxmSdQa6zMWNTkthg=">AAACLHicbVDdSgJBGJ01K7O/tS69GRLBQGRXiIQIBG+CCAzyJ1Rkdhx1cGZ2mZkVRHyBnqHbuuxdgm4iuu05mlUvTPvgg8P5fs7heAGjSjvOpxXbim/v7Cb2kvsHh0fHduqkrvxQYlLDPvNl00OKMCpITVPNSDOQBHGPkYY3qkTzxphIRX3xoCcB6XA0ELRPMdKG6tr27XWbUwFzlTy8y8PH866dcQrOvOAmcJcgU04/lYpj/V7tpqx4u+fjkBOhMUNKtVwn0J0pkppiRmbJdqhIgPAIDUjLQIE4UZ3p3PoMZg3Tg31fmhYaztnViyniSk24ZzY50kO1PovI/2atUPdLnSkVQaiJwAuhfsig9mGUA+xRSbBmEwMQltR4hXiIJMLapJXMZuGqEMaRO2W+wEhp6ZX5isjoIeZh0uTmrqe0CerFgntRcO5NgFdgUQmQBmcgB1xwCcrgBlRBDWAwBs/gBbxab9aH9WV9L1Zj1vLmFPwp6+cXcdimYg==</latexit>

K = min(C,M, Y )<latexit sha1_base64="Tg6XdOcuhUTs//YqRtDGBdQgm0Y=">AAACa3icbVDbSsNAEN3Geou3Vt/Uh8VSiA/WRBQFKQh9EaSoYL3QlLLZTtulm03Y3Qgl9LP8GPFVH/0HNzXgdWDYw5mZM7MniDlT2nWfC9ZMcXZufmHRXlpeWV0rlddvVZRICi0a8UjeB0QBZwJammkO97EEEgYc7oJRI6vfPYJULBI3ehxDJyQDwfqMEm2obunSD2DAREqkJONJyid2o+409i528b7jZY/v28260/zJPNSdhy/G9kH0coVuqeLW3Gngv8DLQQXlcdUtF4p+L6JJCEJTTpRqe26sO0ZOM8phYvuJgpjQERlA20BBQlCddPrzCa4apof7kTQpNJ6y3ydSEio1DgPTGRI9VL9rGflfrZ3o/kknZSJONAj6uaifcKwjnNmIe0wC1XxsAKGSmVsxHRJJqDZm29Uq/r6I0uw6ZVRwtim/lUcKZCZIw8Q2vnm/XfoLbg9q3lHNvT6snJ3mDi6gLbSDHOShY3SGztEVaiGKntALekVvhXdrw9q0tj9brUI+s4F+hFX9ANcps9k=</latexit>

C = (C −K)/(1−K)M = (M −K)/(1−K)Y = (Y −K)/(1−K)

RGB a CMY:

CMY a CMYK:

Page 12: timag2020 color y textura - fing.edu.uy

8.2 Color Spaces and Color Conversion 203

(a)

(b)RGB

Figure 8.9 Examples of the color distribution of natural images. Original images: landscapephotograph with dominant green and blue components and sun-spot image with rich red andyellow components (a). Distribution of image colors in RGB-space (b).

Those recommended in ITU-BT.709 [20] for digital color encoding are

wR = 0.2125 , wG = 0.7154 , wB = 0.072 . (8.7)

If each color component is assigned the same weight, as in Eqn. (8.4), this is ofcourse just a special case of Eqn. (8.5).

Note that, although these weights were developed for use with TV sig-nals, they are optimized for linear RGB component values, i. e., signals withno gamma correction. In many practical situations, however, the RGB compo-nents are actually nonlinear, particularly when we work with sRGB images (seeVol. 2 [6, Sec. 6.3]). In this case, the RGB components must first be linearizedto obtain the correct luminance values with the above weights. An alternativeis to estimate the luminance without linearization by computing the weightedsum of the nonlinear component values and applying a different set of weights(for details see p. 109 of Vol. 2 [6, Sec. 6.3]).

[FIJI: Plugins > Color Inspector 3D]

Page 13: timag2020 color y textura - fing.edu.uy

[FIJI: Plugins > Color Inspector 3D]

Page 14: timag2020 color y textura - fing.edu.uy

Tipos de imágenes RGB

17

8.1 RGB Color Images 189

3 component arrays

IR

IG

IB

u

vIR(u, v)IG(u, v)

IB(u, v)

Figure 8.3 RGB color image in component ordering. The three color components are laidout in separate arrays IR, IG, IB of the same size.

RGB Pixel Array

R G B

u

v

I(u, v)

Figure 8.4 RGB-color image using packed ordering. The three color components R, G, andB are placed together in a single array element.

The access functions, Red(), Green(), Blue(), will depend on the specific imple-mentation used for encoding the color pixels.

Indexed images

Indexed images permit only a limited number of distinct colors and thereforeare used mostly for illustrations and graphics that contain large regions of thesame color. Often these types of images are stored in indexed GIF or PNG filesfor use on the Web. In these indexed images, the pixel array does not containcolor or brightness data but instead consists of integer numbers k that are usedto index into a color table or “palette”

P (k) = (rk, gk, bk) ,

for k = 0 . . .N−1 (Fig. 8.5). N is the size of the color table and therefore also

8.1 RGB Color Images 189

3 component arrays

IR

IG

IB

u

vIR(u, v)IG(u, v)

IB(u, v)

Figure 8.3 RGB color image in component ordering. The three color components are laidout in separate arrays IR, IG, IB of the same size.

RGB Pixel Array

R G B

u

v

I(u, v)

Figure 8.4 RGB-color image using packed ordering. The three color components R, G, andB are placed together in a single array element.

The access functions, Red(), Green(), Blue(), will depend on the specific imple-mentation used for encoding the color pixels.

Indexed images

Indexed images permit only a limited number of distinct colors and thereforeare used mostly for illustrations and graphics that contain large regions of thesame color. Often these types of images are stored in indexed GIF or PNG filesfor use on the Web. In these indexed images, the pixel array does not containcolor or brightness data but instead consists of integer numbers k that are usedto index into a color table or “palette”

P (k) = (rk, gk, bk) ,

for k = 0 . . .N−1 (Fig. 8.5). N is the size of the color table and therefore also

True Color

Component ordering Packed ordering

Indexed images (LUT: Look Up Table)

190 8. Color Images

Image Iidx(u,v)

Color Table P

Index PR PG PB

u

v

r0 g0 b0

r1 g1 b1

r2 g2 b2

rk gk bk

rN−1 gN−1 bN−1

0

1

2

k k

N−1

Figure 8.5 RGB indexed image. Instead of a full color value, each pixel in Iidx(u,v) containsan index k. The color value for each k is defined by an entry in the color table or “palette”P [k].

the maximum number of distinct image colors (typically N = 2 to 256). Sincethe color table can contain any RGB color value (rk, gk, bk), it must be savedas part of the image. The RGB component values of an indexed image Iidx atlocation (u, v) are obtained as

RGB

PR(k)PG(k)PB(k)

=

rk

gk

bk

, with k = Iidx(u, v). (8.3)

During the transformation from a true color image to an indexed image (forexample, from a JPEG image to a GIF image), the problem of optimal colorreduction, or color quantization, arises. Color quantization is the process ofdetermining an optimal color table and then mapping it to the original colors.This process is described in detail in Vol. 2 [6, Sec. 5].

8.1.2 Color Images in ImageJ

ImageJ provides two simple types of color images:

– RGB full-color images (24-bit “RGB color”)

– Indexed images (“8-bit color”)

RGB true color images

RGB color images in ImageJ use a packed order (see Sec. 8.1.1), where eachcolor pixel is represented by a 32-bit int value. As Fig. 8.6 illustrates, 8 bitsare used to represent each of the RGB components, which limits the range of

190 8. Color Images

Image Iidx(u,v)

Color Table P

Index PR PG PB

u

v

r0 g0 b0

r1 g1 b1

r2 g2 b2

rk gk bk

rN−1 gN−1 bN−1

0

1

2

k k

N−1

Figure 8.5 RGB indexed image. Instead of a full color value, each pixel in Iidx(u,v) containsan index k. The color value for each k is defined by an entry in the color table or “palette”P [k].

the maximum number of distinct image colors (typically N = 2 to 256). Sincethe color table can contain any RGB color value (rk, gk, bk), it must be savedas part of the image. The RGB component values of an indexed image Iidx atlocation (u, v) are obtained as

RGB

PR(k)PG(k)PB(k)

=

rk

gk

bk

, with k = Iidx(u, v). (8.3)

During the transformation from a true color image to an indexed image (forexample, from a JPEG image to a GIF image), the problem of optimal colorreduction, or color quantization, arises. Color quantization is the process ofdetermining an optimal color table and then mapping it to the original colors.This process is described in detail in Vol. 2 [6, Sec. 5].

8.1.2 Color Images in ImageJ

ImageJ provides two simple types of color images:

– RGB full-color images (24-bit “RGB color”)

– Indexed images (“8-bit color”)

RGB true color images

RGB color images in ImageJ use a packed order (see Sec. 8.1.1), where eachcolor pixel is represented by a 32-bit int value. As Fig. 8.6 illustrates, 8 bitsare used to represent each of the RGB components, which limits the range of

188 8. Color Images

Vol. 2 [6, Sec. 6].

8.1.1 Organization of Color ImagesColor images are represented in the same way as grayscale images, by usingan array of pixels in which different models are used to order the individualcolor components. In the next sections we will examine the difference betweentrue color images, which utilize colors uniformly selected from the entire colorspace, and so-called palleted or indexed images, in which only a select set ofdistinct colors are used. Deciding which type of image to use depends on therequirements of the application.

True color images

A pixel in a true color image can represent any color in its color space, as longas it falls within the (discrete) range of its individual color components. Truecolor images are appropriate when the image contains many colors with sub-tle differences, as occurs in digital photography and photo-realistic computergraphics. Next we look at two methods of ordering the color components intrue color images: component ordering and packed ordering.

Component ordering. In component ordering (also referred to as planarordering) the color components are laid out in separate arrays of identicaldimensions. In this case, the color image

I =(IR, IG, IB

)

can be thought of as a vector of related intensity images IR, IG, and IB

(Fig. 8.3), and the RGB component values of the color image I at position(u, v) are obtained by accessing all three intensity images as follows:

Ru,v

Gu,v

Bu,v

IR(u, v)IG(u, v)IB(u, v)

. (8.1)

Packed ordering. In packed ordering, the component values that representthe color of a particular pixel are packed together into a single element of theimage array (Fig. 8.4) so that

I(u, v) = (Ru,v, Gu,v, Bu,v).

The RGB value of a packed image I at the location (u, v) is obtained by ac-cessing the individual components of the color pixel as

Ru,v

Gu,v

Bu,v

Red(I(u, v))

Green(I(u, v))Blue(I(u, v))

. (8.2)

188 8. Color Images

Vol. 2 [6, Sec. 6].

8.1.1 Organization of Color ImagesColor images are represented in the same way as grayscale images, by usingan array of pixels in which different models are used to order the individualcolor components. In the next sections we will examine the difference betweentrue color images, which utilize colors uniformly selected from the entire colorspace, and so-called palleted or indexed images, in which only a select set ofdistinct colors are used. Deciding which type of image to use depends on therequirements of the application.

True color images

A pixel in a true color image can represent any color in its color space, as longas it falls within the (discrete) range of its individual color components. Truecolor images are appropriate when the image contains many colors with sub-tle differences, as occurs in digital photography and photo-realistic computergraphics. Next we look at two methods of ordering the color components intrue color images: component ordering and packed ordering.

Component ordering. In component ordering (also referred to as planarordering) the color components are laid out in separate arrays of identicaldimensions. In this case, the color image

I =(IR, IG, IB

)

can be thought of as a vector of related intensity images IR, IG, and IB

(Fig. 8.3), and the RGB component values of the color image I at position(u, v) are obtained by accessing all three intensity images as follows:

Ru,v

Gu,v

Bu,v

IR(u, v)IG(u, v)IB(u, v)

. (8.1)

Packed ordering. In packed ordering, the component values that representthe color of a particular pixel are packed together into a single element of theimage array (Fig. 8.4) so that

I(u, v) = (Ru,v, Gu,v, Bu,v).

The RGB value of a packed image I at the location (u, v) is obtained by ac-cessing the individual components of the color pixel as

Ru,v

Gu,v

Bu,v

Red(I(u, v))

Green(I(u, v))Blue(I(u, v))

. (8.2)

Page 15: timag2020 color y textura - fing.edu.uy

Representación de RGB

18

#9a2069 = (9a,20,69) Hexadecimal (154,32,105)

(0.6,0.12, 0.41)

[Image > Color > Color Picker] (ctrl + shift + K)

Page 16: timag2020 color y textura - fing.edu.uy

• Espacio de color CIE XYZ • Colores primarios imaginarios: X (red), Y (green), Z (blue). Y es la luminancia percibida.

• Basado en experimentos de percepción visual humana (tristimulus).

CIE XYZ colores primarios imaginarios.

C.I.E. 1931 Color Space

19

98 6. Colorimetric Color Spaces

X

Y

Z

0

1

1

ER

G

B

C

M

Y

S

W

X

Y

Z

0

1

1

1

(a) (b)

Figure 6.1 CIE XYZ color space. The XYZ color space is defined by the three imaginaryprimary colors X, Y , Z, where the Y dimension corresponds to the perceived luminance. Allvisible colors are contained inside an open, cone-shaped volume that originates at the blackpoint S (a), where E denotes the axis of neutral (gray) colors. The RGB color space mapsto the XYZ space as a linearly distorted cube (b).

6.1 CIE Color Spaces

The XYZ color system, developed by the CIE (Commission Internationaled’Èclairage)1 in the 1920s and standardized in 1931, is the foundation of mostcolorimetric color systems that are in use today [60, p. 22].

6.1.1 CIE XYZ color space

The CIE XYZ color scheme was developed after extensive measurements ofhuman visual perception under controlled conditions. It is based on threeimaginary primary colors X , Y , Z, which are chosen such that all visible colorscan be described as a summation of positive-only components, where the Ycomponent corresponds to the perceived lightness or luminosity of a color. Allvisible colors lie inside a three-dimensional cone-shaped region (Fig. 6.1 (a)),which interestingly enough does not include the primary colors themselves.

Some common color spaces, and the RGB color space in particular, conve-niently relate to XYZ space by a linear coordinate transformation, as describedin Sec. 6.3. Thus, as shown in Fig. 6.1 (b), the RGB color space is embedded in

1 International Commission on Illumination (www.cie.co.at).

Cono de colores visibles

Línea de los grises

Color negro

<latexit sha1_base64="FxXXnOyD6cnGGEkbpVD16islplE=">AAACLXicbVDLSsNAFJ3UqjW+Wl26GSwFoVASURREKLhxWcG+bEOZTCft0MmDmYkSQn7DnVtd+gf+haAgbvsHrp20XdTWCxcO5z7O4dgBo0IaxqeWWcmurq3nNvTNre2d3XxhryH8kGNSxz7zectGgjDqkbqkkpFWwAlybUaa9ugqnTfvCRfU925lFBDLRQOPOhQjqahevhBddh2OcNxO4la5Xb5LevmiUTEmBZeBOQPF6sn4440//tR6BS3b7fs4dIknMUNCdEwjkFaMuKSYkUTvhoIECI/QgHQU9JBLhBVPvCewpJg+dHyu2pNwws5fxMgVInJttekiORSLs5T8b9YJpXNuxdQLQkk8PBVyQgalD9MgYJ9ygiWLFECYU+UV4iFSUUgVl14qwXkhjFN3Qn2BqdLMK/MF4elD7Ia6ys1cTGkZNI4r5mnFuFEBXoBp5cABOARHwARnoAquQQ3UAQYP4Ak8gxftVXvXvrTv6WpGm93sgz+ljX8BbvWqjw==</latexit>

y =Y

X + Y + Z

<latexit sha1_base64="mbSVWydH/pLcJ9wfrDumdBdOTWw=">AAACLXicbVDLSsNAFJ1o1RpfrS7dDJaCUCiJKAoiFNy4rGAf9kGZTCft0MkkzEyUGvIb7tzq0j/wLwQFcds/cO2k7aK2XrhwOPdxDscJGJXKsj6NpeXUyupaet3c2Nza3slkd6vSDwUmFewzX9QdJAmjnFQUVYzUA0GQ5zBScwaXybx2R4SkPr9Rw4C0PdTj1KUYKU11MtmHi5YrEI4acVQv3BYacSeTs4rWuOAisKcgVzoefbyJx59yJ2ukWl0fhx7hCjMkZdO2AtWOkFAUMxKbrVCSAOEB6pGmhhx5RLajsfcY5jXTha4vdHMFx+zsRYQ8KYeeozc9pPpyfpaQ/82aoXLP2hHlQagIxxMhN2RQ+TAJAnapIFixoQYIC6q9QtxHOgql4zLzeTgrhHHiTuovMFGaemW+JCJ5iL3Q1LnZ8yktgupR0T4pWtc6wHMwqTTYBwfgENjgFJTAFSiDCsDgHjyBZ/BivBrvxpfxPVldMqY3e+BPGaNfcnuqkQ==</latexit>

z =Z

X + Y + Z

<latexit sha1_base64="JzMp6l0RF1ze5h7fVqh3ASs+bno=">AAACLXicbVBNSwJBGJ41K9u+tI5dhkQIBNmNoiACoUtHg9QtXWR2nNXB2Q9mZitZ9m9061rH/kH/IiiIrv6Dzs2qB9NeeOHheT+eh8cJGRXSMD61zFJ2eWU1t6avb2xubecLOw0RRByTOg5YwC0HCcKoT+qSSkaskBPkOYw0ncFFOm/eES5o4F/LYUhsD/V86lKMpKI6+cLDedvlCMdWElvlm/Jt0skXjYoxLrgIzCkoVo9GH2/88afWKWjZdjfAkUd8iRkSomUaobRjxCXFjCR6OxIkRHiAeqSloI88Iux47D2BJcV0oRtw1b6EY3b2IkaeEEPPUZsekn0xP0vJ/2atSLqndkz9MJLExxMhN2JQBjANAnYpJ1iyoQIIc6q8QtxHKgqp4tJLJTgrhHHqTqgvMFWaemWBIDx9iL1IV7mZ8yktgsZhxTyuGFcqwDMwqRzYA/vgAJjgBFTBJaiBOsDgHjyBZ/CivWrv2pf2PVnNaNObXfCntNEva2+qjQ==</latexit>

x =X

X + Y + Z

<latexit sha1_base64="m5MYigZYqWa5od8ZV0DK/Bh8boA=">AAACIXicbVBNSwJBGJ41K9u+tOjUZUiEQJBdIRIiELp0NMgP0EVmx1kdnNldZmalbfEPdOtax35Nt+oW/Zlm1YNpLww8PO/H88zjhoxKZVnfRmYju7m1ndsxd/f2Dw7zhaOWDCKBSRMHLBAdF0nCqE+aiipGOqEgiLuMtN3xTdpvT4iQNPDvVRwSh6OhTz2KkdJU+6Eclx+v7X6+aFWsWcF1YC9AsX7yVKtO1GejXzCyvUGAI058hRmSsmtboXISJBTFjEzNXiRJiPAYDUlXQx9xIp1k5ncKS5oZQC8Q+vkKztjljQRxKWPu6kmO1Eiu9lLyv143Ul7NSagfRor4eC7kRQyqAKafhwMqCFYs1gBhQbVXiEdIIKx0RGapBJeFME7dSX0FpkoLryyQRKQHMY9MnZu9mtI6aFUr9kXFutMBXoF55cApOAPnwAaXoA5uQQM0AQZj8AxewKvxZrwbH8bXfDRjLHaOwZ8yfn4BNnWj5g==</latexit>

x+ y + z = 1

Page 17: timag2020 color y textura - fing.edu.uy

C.I.E. 1931 Color Space

20

100 6. Colorimetric Color Spaces

X

Y

Z

0

1

1

1

G

B

C

M

Y

S

W

E

A = (Xa, Ya, Za)

a

X

Y

Z

0

1

1

1

x

y

(a) (b)

!"# $%

!&# $%

!'# $%

&## $%

&'#((()'# $%

*'# $%

"'# $%

!## $%

#(!

+(#

#(##(# #(! +(#

!,# $%

R

G

B

C

M

Y

E

x

y

(c)

Figure 6.2 CIE x, y chromaticity diagram. For an arbitrary XYZ color point A =(Xa, Ya, Za), the chromaticity values a = (xa, ya, za) are obtained by a central projectiononto the 3D plane X +Y +Z = 1 (a). The corner points of the RGB cube map to a triangle,and its white point W maps to the (colorless) neutral point E. The intersection points arethen projected onto the X/Y plane (b) by simply dropping the Z omponent, which producesthe familiar CIE chromaticity diagram shown in (c). The CIE diagram contains all visiblecolor tones (hues and saturations) but no luminance information, with wavelengths in therange 380–780 nanometers. A particular color space is specified by at least three primarycolors (tristimulus values; e. g., R, G, B), which define a triangle (linear hull) containing allrepresentable colors.

100 6. Colorimetric Color Spaces

X

Y

Z

0

1

1

1

G

B

C

M

Y

S

W

E

A = (Xa, Ya, Za)

a

X

Y

Z

0

1

1

1

x

y

(a) (b)

!"# $%

!&# $%

!'# $%

&## $%

&'#((()'# $%

*'# $%

"'# $%

!## $%

#(!

+(#

#(##(# #(! +(#

!,# $%

R

G

B

C

M

Y

E

x

y

(c)

Figure 6.2 CIE x, y chromaticity diagram. For an arbitrary XYZ color point A =(Xa, Ya, Za), the chromaticity values a = (xa, ya, za) are obtained by a central projectiononto the 3D plane X +Y +Z = 1 (a). The corner points of the RGB cube map to a triangle,and its white point W maps to the (colorless) neutral point E. The intersection points arethen projected onto the X/Y plane (b) by simply dropping the Z omponent, which producesthe familiar CIE chromaticity diagram shown in (c). The CIE diagram contains all visiblecolor tones (hues and saturations) but no luminance information, with wavelengths in therange 380–780 nanometers. A particular color space is specified by at least three primarycolors (tristimulus values; e. g., R, G, B), which define a triangle (linear hull) containing allrepresentable colors.

100 6. Colorimetric Color Spaces

X

Y

Z

0

1

1

1

G

B

C

M

Y

S

W

E

A = (Xa, Ya, Za)

a

X

Y

Z

0

1

1

1

x

y

(a) (b)

!"# $%

!&# $%

!'# $%

&## $%

&'#((()'# $%

*'# $%

"'# $%

!## $%

#(!

+(#

#(##(# #(! +(#

!,# $%

R

G

B

C

M

Y

E

x

y

(c)

Figure 6.2 CIE x, y chromaticity diagram. For an arbitrary XYZ color point A =(Xa, Ya, Za), the chromaticity values a = (xa, ya, za) are obtained by a central projectiononto the 3D plane X +Y +Z = 1 (a). The corner points of the RGB cube map to a triangle,and its white point W maps to the (colorless) neutral point E. The intersection points arethen projected onto the X/Y plane (b) by simply dropping the Z omponent, which producesthe familiar CIE chromaticity diagram shown in (c). The CIE diagram contains all visiblecolor tones (hues and saturations) but no luminance information, with wavelengths in therange 380–780 nanometers. A particular color space is specified by at least three primarycolors (tristimulus values; e. g., R, G, B), which define a triangle (linear hull) containing allrepresentable colors.

Chromaticity Diagram (Proyección al plano xy)

Page 18: timag2020 color y textura - fing.edu.uy

C.I.E. 1931 Color Space

21

Chromaticity Diagram

Page 19: timag2020 color y textura - fing.edu.uy

C.I.E. 1931 Color Space

22

6.1 CIE Color Spaces 103

!"#

$"!

!"!!"! !"# $"!

CIE L∗a∗b∗

Laser DisplayAdobe RGB

CMYK

sRGB

x

y

D65

Figure 6.3 Gamut regions for different color spaces and output devices inside the CIEdiagram.

requires adequately sized color spaces, such as the Adobe-RGB color space orL∗a∗b∗ (described below), which covers the entire visible portion of the CIEdiagram.

6.1.5 Variants of the CIE color space

The original CIEXYZ color space and the derived xy chromaticity diagramhave the disadvantage that color differences are not perceived equally in differ-ent regions of the color space. For example, large color changes are perceivedin the magenta region for a given shift in XYZ while the change is relativelysmall in the green region for the same coordinate distance. Several variants ofthe CIE color space have been developed for different purposes, primarily withthe goal of creating perceptually uniform color representations without sacri-ficing the formal qualities of the CIE reference system. Popular CIE-derivedcolor spaces include CIE YUV, YU′V′, L∗u∗v∗, YCbCr, and particularly L∗a∗b∗,which is described below.

In addition, CIE-compliant specifications exist for most common colorspaces (see Vol. 1 [14, Sec. 8.2]), which allow more or less dependable con-versions between almost any pair of color spaces.

Page 20: timag2020 color y textura - fing.edu.uy

¿De qué color son?

23

Page 21: timag2020 color y textura - fing.edu.uy

Tono (Hue)

24

Page 22: timag2020 color y textura - fing.edu.uy

¿De qué color son?

25

“Más verde”

“Menos verde”

Page 23: timag2020 color y textura - fing.edu.uy

Saturación

26

“Pureza” del color; “mezcla con blanco”.

Page 24: timag2020 color y textura - fing.edu.uy

¿De qué color son?

27

Más saturado

Menos saturado

Page 25: timag2020 color y textura - fing.edu.uy

Mismo tono, diferente saturación

28

Page 26: timag2020 color y textura - fing.edu.uy

Más claro

¿De qué color son?

29

Más oscuro

Mismo tono, misma saturación, ¿qué es diferente?

Brillo, intensidad, …

Page 27: timag2020 color y textura - fing.edu.uy

• RGB ⟷ HSB, HSV, HSI

• Son muy usados en edición gráfica para la elección de colores.

• Más eficientes que RGB/CMYK para seleccionar colores similares por tono y saturación.

• No lineal

HSV, HSI, HSB

30

8.2 Color Spaces and Color Conversion 209

HHSV SHSV VHSV

Figure 8.12 HSV components for the test image in Fig. 8.2. The darker areas in the hHSVcomponent correspond to the red and yellow colors, where the hue angle is near zero.

HS

V

YG

C

B M

W

S

R

R75

R50

R25

P

RGB/HSV ValuesPt. Color R G B H S V

S Black 0.00 0.00 0.00 — 0.00 0.00R Red 1.00 0.00 0.00 0 1.00 1.00Y Yellow 1.00 1.00 0.00 1/6 1.00 1.00G Green 0.00 1.00 0.00 2/6 1.00 1.00C Cyan 0.00 1.00 1.00 3/6 1.00 1.00B Blue 0.00 0.00 1.00 4/6 1.00 1.00M Magenta 1.00 0.00 1.00 5/6 1.00 1.00W White 1.00 1.00 1.00 — 0.00 1.00R75 75% Red 0.75 0.00 0.00 0 1.00 0.75R50 50% Red 0.50 0.00 0.00 0 1.00 0.50R25 25% Red 0.25 0.00 0.00 0 1.00 0.25

P Pink 1.00 0.50 0.50 0 0.5 1.00

Figure 8.13 HSV color space. The illustration shows the HSV color space as a cylinderwith the coordinates H (hue) as the angle, S (saturation) as the radius, and V (brightnessvalue) as the distance along the vertical axis, which runs between the black point S and thewhite point W. The table lists the (R, G, B) and (H, S, V ) values of the color points markedon the graphic. Pure colors (composed of only one or two components) lie on the outer wallof the cylinder (S = 1), as exemplified by the gradually saturated reds (R25, R50, R75, R).

completely across the cylinder’s base. Figure 8.12 shows the individual HSVcomponents (in grayscale) of the test image in Fig. 8.2. Figure 8.13 plots thelocation of some notable color points and compares them with their locationsin RGB space (see also Fig. 8.1).

Java implementation. In Java, the RGB-HSV conversion is implemented inthe class java.awt.Color by the method

float[] RGBtoHSB (int r, int g, int b, float[] hsv )

<latexit sha1_base64="Mfr0c16eCEZdklcy4gN34avhXXk=">AAACiXicdVHBbhMxEPVuC5Qt0BSOXEZEQVyIdqFABaKq6KE9Fom0leIo8jqziVXbu9iziGiVr+TEp/SGN91DaWEkS09vZt48PeeVVp7S9HcUb2zeu/9g62Gy/ejxk53e7tMzX9ZO4kiWunQXufColcURKdJ4UTkUJtd4nl8etf3zH+i8Ku03WlY4MWJuVaGkoEBNe+bkM9dYEG94jnNlG+GcWK4aKVcJpwWSgJfACX8SNKAKWMEXCAvf4Rg4T96+T1//Z+rgOOFoZ50ed2q+oOG010+H6brgLsg60GddnU53o00+K2Vt0JLUwvtxllY0CaqkpMbgsfZYCXkp5jgO0AqDftKsc1nBIDAzKEoXniVYszc3GmG8X5o8TBpBC3+715L/6o1rKvYnjbJVTWjl9aGi1kAltCHDTDmUpJcBCOlU8ApyIZyQFL4iGQzg5iEpW3c+qEB7qfOqS4+uFZSmTkJu2e2U7oKzN8Ps3TD9utc//NQluMWesxfsFcvYB3bITtgpGzHJfrGrKI424u04i/fjj9ejcdTtPGN/VXz0B3VvwUA=</latexit>

H =

{θ if B ≤ G

360− θ if B > G<latexit sha1_base64="BPAL0DS8XU7YpG2kKLKRMEQkAek=">AAAChnicbVFNbxMxEHWWAiF8NIUjF4soUirUsBtRFalCiuBQjgWRtlK8ibzObGLq/ZA9Wymy/B+58ke4gje7h9IykkfP7814Rs9JqaTBMPzVCR7sPXz0uPuk9/TZ8xf7/YOXF6aotICZKFShrxJuQMkcZihRwVWpgWeJgsvk+nOtX96ANrLIv+O2hDjj61ymUnD01LL/g+EGkH9kojB0YY8ixxSkyCxLNRdtjpyduPno29HZ4VufPx3Gzu7KGm7h1YYfnfnEtFxvMF7YiL6jE+eaO3PL/iAch7ug90HUggFp43x50Nljq0JUGeQoFDdmHoUlxpZrlEKB67HKQMnFNV/D3MOcZ2BiuzPF0aFnVjQttD850h17u8PyzJhtlvjKjOPG3NVq8n/avML0Q2xlXlYIuWgGpZWiWNDaYbqSGgSqrQdcaOl3pWLDvY/o/6E3HNLbg4SotzP+FVpPandVhQFdPyiyqud9i+66dB9cTMbR8Tj8+n4wPW0d7JLX5A0ZkYickCn5Qs7JjAjyk/wmfzok6Abj4Dg4aUqDTtvzivwTwfQvKejApA==</latexit>

θ = cos−1

{12 [(R−G) + (R−B)]

[(R−G)2 + (R−B)(G−B)]1/2

}

<latexit sha1_base64="mHAQWm81flPClYWt7BX38UlVQIQ=">AAACQXicbVDLSgMxFM1o1VpfrS7dBEuhUi0zPlAQodRFXdZHW6EdSibNaGiSGZKMUIZ+gV/jVpd+hZ/gTty6MVNnodYDgcM595XjhYwqbduv1sxsZm5+IbuYW1peWV3LF9bbKogkJi0csEDeeEgRRgVpaaoZuQklQdxjpOMNzxK/c0+kooG41qOQuBzdCupTjLSR+vnS1amz2/MlwvH+OC5fVhqV+va42+NUwPLlDmzswPq2288X7ao9AZwmTkqKIEWzX7AyvUGAI06Exgwp1XXsULsxkppiRsa5XqRIiPAQ3ZKuoQJxotx48p8xLBllAP1Amic0nKg/O2LElRpxz1RypO/UXy8R//O6kfaP3ZiKMNJE4O9FfsSgDmASDhxQSbBmI0MQltTcCvEdMuFoE2GuVII/F2GcXKfMFJhsSm9lgSIyGYh5lDO5OX9TmibtvapzWLUvDoq1kzTBLNgEW6AMHHAEauAcNEELYPAAHsETeLZerDfr3fr4Lp2x0p4N8AvW5xf1Uarb</latexit>

S = 1− 3

(R+G+B)[min(R,G,B)]

<latexit sha1_base64="pDT7hfrXPX05CG0h/1i/7VGRuRc=">AAACMHicbVDLSsNAFJ3UqjW+WnXnZrAUKoWS+EBBhKILdVfFPqANZTKdtEMnD2YmQg35F7e69Gt0JW79CidtFrX1woXDuY9zOHbAqJCG8alllrLLK6u5NX19Y3NrO1/YaQo/5Jg0sM983raRIIx6pCGpZKQdcIJcm5GWPbpO5q0nwgX1vUc5DojlooFHHYqRVFQvv3d32XU4wpEZR8dx+aFyU7k67OWLRtWYFFwEZgqKIK16r6Blu30fhy7xJGZIiI5pBNKKEJcUMxLr3VCQAOERGpCOgh5yibCiif0YlhTTh47PVXsSTtjZiwi5QoxdW226SA7F/Cwh/5t1QumcWxH1glASD0+FnJBB6cMkC9innGDJxgogzKnyCvEQqTSkSkwvleCsEMaJO6G+wEQp9cp8QXjyELuhrnIz51NaBM2jqnlaNe5PirWLNMEc2AcHoAxMcAZq4BbUQQNg8AxewCt40961D+1L+56uZrT0Zhf8Ke3nF0oepb4=</latexit>

I =1

3(R+G+B)

Page 28: timag2020 color y textura - fing.edu.uy

31

H S B

Page 29: timag2020 color y textura - fing.edu.uy

220 8. Color Images

(a)

(b)HSV

(c)YUV

Figure 8.18 Examples of the color distribution of natural images in different color spaces.Original images (a); color distribution in HSV- (b), and YUV-space (c). See Fig. 8.9 for thecorresponding distributions in RGB color space.

Page 30: timag2020 color y textura - fing.edu.uy

Conversión a escala de grises

• Imagen con el “equivalente” en grises o la “luminancia” Y.

• No hay una única forma • La más simple

• La percepción de los canales no es la misma

• Promedios ponderados

33

Y = R+G+B3

Y = wRR+ wGG+ wBB

202 8. Color Images

colors within the RGB space, it is important to remember that the metric, ormeasured distance within this color space, does not proportionally correspondto our perception of color (e. g., doubling the value of the red component doesnot necessarily result in a color which appears to be twice as red). In general,in this space, modifying different color points by the same amount can causevery different changes in color. In addition, brightness changes in the RGBcolor space are also perceived as nonlinear.

Since any coordinate movement modifies color tone, saturation, and bright-ness all at once, color selection in RGB space is difficult and quite non-intuitive.Color selection is more intuitive in other color spaces, such as the HSV space(see Sec. 8.2.3), since perceptual color features, such as saturation, are rep-resented individually and can be modified independently. Alternatives to theRGB color space are also used in applications such as the automatic separationof objects from a colored background (the blue box technique in television),encoding television signals for transmission, or in printing, and are thus alsorelevant in digital image processing.

Figure 8.9 shows the distribution of the colors from natural images in theRGB color space. The first half of this section introduces alternative colorspaces and the methods of converting between them and later discusses thechoices that need to be made to correctly convert a color image to grayscale.In addition to the classical color systems most widely used in programming,precise reference systems, such as the CIEXYZ color space, gain increasingimportance in practical color processing.

8.2.1 Conversion to GrayscaleThe conversion of an RGB color image to a grayscale image proceeds by com-puting the equivalent gray or luminance value Y for each RGB pixel. In itssimplest form, Y could be computed as the average

Y = Avg(R, G, B) =R + G + B

3(8.4)

of the three color components R, G, and B. Since we perceive both red andgreen as being substantially brighter than blue, the resulting image will appearto be too dark in the red and green areas and too bright in the blue ones.Therefore, a weighted sum of the color components

Y = Lum(R, G, B) = wR ·R + wG ·G + wB ·B (8.5)

is typically used to compute the equivalent luminance value. The weights mostoften used were originally developed for encoding analog color television signals(see Sec. 8.2.4):

wR = 0.299 , wG = 0.587 , wB = 0.114 . (8.6)

8.2 Color Spaces and Color Conversion 203

(a)

(b)RGB

Figure 8.9 Examples of the color distribution of natural images. Original images: landscapephotograph with dominant green and blue components and sun-spot image with rich red andyellow components (a). Distribution of image colors in RGB-space (b).

Those recommended in ITU-BT.709 [20] for digital color encoding are

wR = 0.2125 , wG = 0.7154 , wB = 0.072 . (8.7)

If each color component is assigned the same weight, as in Eqn. (8.4), this is ofcourse just a special case of Eqn. (8.5).

Note that, although these weights were developed for use with TV sig-nals, they are optimized for linear RGB component values, i. e., signals withno gamma correction. In many practical situations, however, the RGB compo-nents are actually nonlinear, particularly when we work with sRGB images (seeVol. 2 [6, Sec. 6.3]). In this case, the RGB components must first be linearizedto obtain the correct luminance values with the above weights. An alternativeis to estimate the luminance without linearization by computing the weightedsum of the nonlinear component values and applying a different set of weights(for details see p. 109 of Vol. 2 [6, Sec. 6.3]).

8 bits Lab RGB LuminanceOriginal RGB Y = R+G+B3

Page 31: timag2020 color y textura - fing.edu.uy

CIE L*a*b*

• Basado en un conjunto de colores base (imaginarios) CIE XYZ creados en 1931.

• Uniformidad cercana a la percepción visual humana.

• La distancia Euclidea entre dos colores es similar a la diferencia percibida entre ellos.

• Independientes del dispositivo de despliegue.

• Desacopla la intensidad del color • L* corresponde a la luminosidad

• a* corresponde a la variación de tono-saturación en el eje verde-rojo, y b* en el eje azul-amarillo.

34

<latexit sha1_base64="wkkQqtQqDzPj9UzYrwKH3hzFw9Y=">AAADfnicfVJbb9MwFHaWASNcduGRF4uqUwcsS8ZKK6GhSbzwwMOQ6NqtCZXjOq0152Y7SJWV/8df4E/wCo/YbZB6GRwpyqdzvvOdi0+UMyqk5/2wtuzte/cf7Dx0Hj1+8nR3b//gSmQlx6SHM5bxQYQEYTQlPUklI4OcE5REjPSj2w8m3v9GuKBZ+kXOchImaJLSmGIktWu0b6EgIhOaKsQ5mlWKVc6nry/Pff8tDF7DacBILFtBzBFW15W6Hql+VQWcTqby6NhwAgdpetvz5szhSsKgUoOVhP/KLX6hkYy05Omdkhs9rERvKnXzD8lpqzg6n3MDtTaxHjkQBZfDN6EqKngIi/ee63ndbns+X8ftdDuweKWnPYFmL5oAtVIB/7KcgKTjWm5R0l12jfYahmkMbgK/Bg1Q26V+lO1gnOEyIanEDAkx9L1chlpOUsyIbrcUJEf4Fk3IUMMUJUSEan4MFWxqzxjGGddfKuHcu5yhUCLELIk0M0FyKtZjxnlXbFjKuBsqmualJCleFIpLBmUGzWXBMeUESzbTAGFOda8QT5F+F6nvz2k24XIhjE13QqtAU6nulWWCcCOIk9LRe/PXt7QJrk5dv+16n88aF+/qDe6A5+AFaAEfdMAF+AguQQ9g67v10/pl/baBfWgf2ycL6pZV5zwDK2Z3/wDW7hkj</latexit>

L∗ = 116h(

YYW

)− 16

a∗ = 500[h(

XXW

)− h

(YYW

)]

b∗ = 200[h(

YYW

)− h

(Z

ZW

)]

h(q) =

{3√q q > 0.008856

7.787q + 16/116 q ≤ 0.008856<latexit sha1_base64="00MhCIjS9Gn+iT/mY1FPfxTio0c=">AAACLXicbVDLSsNAFJ3UqjW+Wl26GSwFF1ISURTcFNy4rGAf2oYwmU7boTOTMDNRSuinuNWlX+NCELf+hpM0i9p64V4O574OJ4gYVdpxPq3CWnF9Y7O0ZW/v7O7tlysHbRXGEpMWDlkouwFShFFBWppqRrqRJIgHjHSCyU3a7zwRqWgo7vU0Ih5HI0GHFCNtKL9c6fpJZ3b6kNXHtPrlqlN3soCrwM1BFeTR9CtWsT8IccyJ0JghpXquE2kvQVJTzMjM7seKRAhP0Ij0DBSIE+UlmfYZrBlmAIehNCk0zNjFjQRxpaY8MJMc6bFa7qXkf71erIdXXkJFFGsi8PzRMGZQhzA1Ag6oJFizqQEIS2q0QjxGEmFt7LJrNbj4CONUnTJXYPop18pCRWR6EPPYNr65yy6tgvZZ3b2oO3fn1cZ17mAJHIFjcAJccAka4BY0QQtg8AxewCt4s96tD+vL+p6PFqx85xD8CevnF/WUpbk=</latexit>

XW , YW , ZW son valores de referencia relacionados con el blanco en el estándar CIE D65.

Page 32: timag2020 color y textura - fing.edu.uy

L a b

Page 33: timag2020 color y textura - fing.edu.uy

Evolución de la representación del color

• Primera generación: colores físicos • RGB, XYZ, …

• Segunda generación: psicovisión • CIE Lab, Munsell, …

• Tercera generación: apariencia espacial del color • CAM, Retinex, ACE, …

36

Image> Color> Retinex

Page 34: timag2020 color y textura - fing.edu.uy

Evolución de la representación del color

• Primera generación: colores físicos • RGB, XYZ, …

• Segunda generación: psicovisión • CIE Lab, Munsell, …

• Tercera generación: apariencia espacial del color • CAM, Retinex, ACE, …

37

Image> Color> Retinex

Page 35: timag2020 color y textura - fing.edu.uy

Cuantización de colores

38

Original (24 bits) 256 colores (8 bits)

2 colores (1 bit)8 colores (3 bits)

Page 36: timag2020 color y textura - fing.edu.uy

Pseudo-color

• Uso de un mapa de colores para la visualización de imágenes monocromáticas.

• Mejor discernimiento de colores.

39

6.3 ! Pseudocolor Image Processing 419

FIGURE 6.22 (a) Gray-scale image in which intensity (in the lighter horizontal band shown) corresponds toaverage monthly rainfall. (b) Colors assigned to intensity values. (c) Color-coded image. (d) Zoom of theSouth American region. (Courtesy of NASA.)

Redtransformation

Greentransformation

Bluetransformation

fR(x, y)

fG(x, y)

fB(x, y)

f(x, y)

FIGURE 6.23Functional blockdiagram forpseudocolorimage processing.

and arefed into thecorrespondingred, green, andblue inputs of anRGB colormonitor.

fBfR, fG,

a bc d

Page 37: timag2020 color y textura - fing.edu.uy

Color segmentation

• “Color Segmentation: ImageJ plugin to cluster color pixel driven by the user input”

• Bajar e instalar ColorSegmentation_.jar*

• Abrir la imagen mandas.jpg • Con la herramienta POINTCROSS elegir los colores (A, B, C, …). Se pueden seleccionar

más de un punto por color. • Elegir Clustering Method • Elegir algoritmo: K-Means (faster one) or Hidden Markov Model (agrega restricciones

espaciales). • Run

40

* Daniel Sage EPFL Biomedical Imaging Group http://bigwww.epfl.ch/sage/soft/colorsegmentation/

Page 38: timag2020 color y textura - fing.edu.uy

Textura

41

Page 39: timag2020 color y textura - fing.edu.uy

WHAT IS TEXTURE?

Repetition of a basic pattern: •  Structural •  Statistical ! Non local property, subject to distortions.

¿Qué es la textura?

Page 40: timag2020 color y textura - fing.edu.uy

¿Qué es la textura?

• Concepto alto nivel.

• Suavidad, áspero, regularidad, patrón repetitivo, …

• No local.

• No hay una medida trivial, objetiva.

• Análisis basado en descriptores o características (features). • Estructural: primitivas de construcción de la imagen

• Estadístico: suave, granular, …

• Espectral: periodicidad, potencia en el espectro.

43

Page 41: timag2020 color y textura - fing.edu.uy

Dependencia con la escala

44

Page 42: timag2020 color y textura - fing.edu.uy

Dependencia con la escala

45Testículos ovinos (hematoxilina-eosina) 4x

Page 43: timag2020 color y textura - fing.edu.uy

Dependencia con la escala

46Testículos ovinos (hematoxilina-eosina) 10x

Page 44: timag2020 color y textura - fing.edu.uy

Dependencia con la escala

47Testículos ovinos (hematoxilina-eosina) 40x

Page 45: timag2020 color y textura - fing.edu.uy

Aplicaciones

• Clasificación: determinar el tipo (clase) a una nueva muestra • Segmentación: partir en regiones de textura similar • Síntesis: dada una muestra, generar otras de apariencia similar • Recuperación de pose y estructura: shape from texture

48

Page 46: timag2020 color y textura - fing.edu.uy

49

• Momentos estadísticos del histograma de intensidades.

• Primeros dos momentos

• Segundo momento (varianza) o desviación estándar

• Medida del contraste y la suavidad de la variación.

• Tercer momento (skewness) es una medida de la simetría del histograma

• Cuarto momento (flatness) es una medida de la “llanura”.

Métricas estadísticas

p(zi)µn(zi) =

L−1∑

i=0

(zi −m)np(zi)

m =L−1∑

i=0

zip(zi)

R = 1− 1

1 + σ2(z)

0 1 L - 1

R = 0

R → 1

zonas constantes

zonas mucha variación.

µ0 = 1, µ1 = 0

µ2 = σ2(zi)

µn(zi) =L−1∑

i=0

(zi −m)np(zi)

m =L−1∑

i=0

zip(zi)

R = 1− 1

1 + σ2(z)

σ(z)

µ3

Page 47: timag2020 color y textura - fing.edu.uy

50

• “Uniformidad”

• Entropía

• R (normalizada)

Métricas estadísticas

U(z) =L−1∑

i=0

p2(zi)

e(z) = −L−1∑

i=0

p(zi) log2 p(zi)

U(z) =L−1∑

i=0

p2(zi)

e(z) = −L−1∑

i=0

p(zi) log2 p(zi)

<latexit sha1_base64="tGZv3ZQI2xB/2hErU9EWQk35I+I=">AAACPHicbVBNSwJBGJ41K7MvrWOXIRGMSHaFqIhA6NLRIj9ATWbHWR2c2V1mZgNb9tpP6Fd0raO/o+7doqvnZtWDaS8MPDzP+77PO4/tMyqVaX4aiZXk6tp6aiO9ubW9s5vJ7tWkFwhMqthjnmjYSBJGXVJVVDHS8AVB3Gakbg+uY73+SISknnuvhj5pc9RzqUMxUprqZOBd4enoyjppOQLh0IpC67glaY+jh7AUaSnqZHJm0ZwUXAbWDOTKF72PkXgZVzpZI9nqejjgxFWYISmblumrdoiEopiRKN0KJPERHqAeaWroIk5kO5x8JYJ5zXSh4wn9XAUn7PxEiLiUQ27rTo5UXy5qMfmf1gyUc94OqesHirh4auQEDCoPxrnALhUEKzbUAGFB9a0Q95EORen00vk8nDfCOL5O6i0wdprdyjxJRLwQ8yCtc7MWU1oGtVLROi2atzrASzCtFDgAh6AALHAGyuAGVEAVYPAMXsEbeDdGxpfxbfxMWxPGbGYf/Clj/AsqJq8/</latexit>

R(z) = 1− 1

1 + σ2(z)

Page 48: timag2020 color y textura - fing.edu.uy

Métricas estadísticas

51

Smoo

th

Coa

rse

Reg

ular

11.3 ! Regional Descriptors 829

The third moment,

(11.3-7)

is a measure of the skewness of the histogram while the fourth moment is ameasure of its relative flatness. The fifth and higher moments are not so easilyrelated to histogram shape, but they do provide further quantitative discrimi-nation of texture content. Some useful additional texture measures based onhistograms include a measure of “uniformity,” given by

(11.3-8)

and an average entropy measure, which, you will recall from basic informationtheory, is defined as

(11.3-9)

Because the ps have values in the range [0, 1] and their sum equals 1, measureis maximum for an image in which all intensity levels are equal (maximally

uniform), and decreases from there. Entropy is a measure of variability and is0 for a constant image.

U

e(z) = -aL-1

i=0p(zi) log2 p(zi)

U(z) = aL-1

i=0p2(zi)

m3(z) = aL-1

i=0(zi - m)3p(zi)

EXAMPLE 11.10:Texture measuresbased onhistograms.

! Table 11.2 summarizes the values of the preceding measures for the threetypes of textures highlighted in Fig. 11.28.The mean just tells us the average in-tensity of each region and is useful only as a rough idea of intensity, not reallytexture. The standard deviation is much more informative; the numbers clear-ly show that the first texture has significantly less variability in intensity levels(it is smoother) than the other two textures.The coarse texture shows up clear-ly in this measure. As expected, the same comments hold for because itmeasures essentially the same thing as the standard deviation. The third mo-ment generally is useful for determining the degree of symmetry of histogramsand whether they are skewed to the left (negative value) or the right (positivevalue). This gives a rough idea of whether the intensity levels are biased to-ward the dark or light side of the mean. In terms of texture, the informationderived from the third moment is useful only when variations between mea-surements are large. Looking at the measure of uniformity, we again conclude

R,

Standard ThirdTexture Mean deviation R (normalized) moment Uniformity Entropy

Smooth 82.64 11.79 0.002 0.026 5.434Coarse 143.56 74.63 0.079 0.005 7.783Regular 99.72 33.73 0.017 0.750 0.013 6.674

-0.151-0.105

TABLE 11.2 Texture measuresfor the subimagesshown in Fig. 11.28.

Page 49: timag2020 color y textura - fing.edu.uy

Métricas estadísticas

• Los histogramas no tiene información de la posición de las intensidades, que es un aspecto clave para la textura.

• Matriz de co-ocurrencia

52

830 Chapter 11 ! Representation and Description

1 1 7 5 3 2

5 1 6 1 2 5

8 8 6 8 1 2

4 3 4 5 5 1

8 7 8 7 6 2

7 8 6 2 6 2

0 1 1 0 0

1 0 0 0 0

0 1 0 0 0

0 1 0 0 0

0 0 0 0 1

0 1 1

0 0

0 0 1 1 02 0

4 5 6 7 81 2 3

1 0

0 1

0 1

3 0

0 0 0 2

0 0 2

0

1

0

0

2

1

0

1

2

1

3

4

5

6

7

8 0 0 2 1

Image f Co-occurrence matrix G

FIGURE 11.29How to generatea co-occurrencematrix.

that the first subimage is smoother (more uniform than the rest) and that themost random (lowest uniformity) corresponds to the coarse texture.This is notsurprising. Finally, the entropy values are in the opposite order and thus leadus to the same conclusions as the uniformity measure did. The first subimagehas the lowest variation in intensity levels and the coarse image the most. Theregular texture is in between the two extremes with respect to both thesemeasures. !

Measures of texture computed using only histograms carry no informa-tion regarding the relative position of pixels with respect to each other. Thisis important when describing texture, and one way to incorporate this typeof information into the texture-analysis process is to consider not only thedistribution of intensities, but also the relative positions of pixels in animage.

Let be an operator that defines the position of two pixels relative toeach other, and consider an image, with possible intensity levels. Let Gbe a matrix whose element is the number of times that pixel pairs withintensities and occur in in the position specified by where

A matrix formed in this manner is referred to as a gray-level(or intensity) co-occurrence matrix. When the meaning is clear, G is referredto simply as a co-occurrence matrix.

Figure 11.29 shows an example of how to construct a co-occurrence matrixusing and a position operator defined as “one pixel immediately tothe right” (i.e., the neighbor of a pixel is defined as the pixel immediately toits right). The array on the left is a small image under consideration and thearray on the right is matrix G. We see that element (1, 1) of G is 1, becausethere is only one occurrence in of a pixel valued 1 having a pixel valued 1immediately to its right. Similarly, element (6, 2) of G is 3, because there arethree occurrences in of a pixel with a value of 6 having a pixel valued 2 im-mediately to its right. The other elements of G are computed in this manner.If we had defined as, say, “one pixel to the right and one pixel above,” thenQ

f

f

QL = 8

1 … i, j … L.Q,fzjzi

gijLf,

Q

Note that we are usingthe intensity range instead of our usual

This is doneso that intensity valueswill correspond with“traditional” matrix in-dexing (i.e., intensityvalue 1 corresponds tothe first row and columnindices of G).

[0, L - 1].

[1, L]

Imagen Matrix de co-ocurrencia G

Page 50: timag2020 color y textura - fing.edu.uy

Métricas estadísticas

53

834 Chapter 11 ! Representation and Description

FIGURE 11.31co-

occurrencematrices,andcorrespondingfrom left to rightto the images inFig. 11.30.

G3,G1, G2,

256 * 256

DescriptorNormalizedCo-occurrence Max

Matrix Probability Correlation Contrast Uniformity Homogeneity Entropy

0.00006 10838 0.00002 0.0366 15.750.01500 0.9650 570 0.01230 0.0824 6.430.06860 0.8798 1356 0.00480 0.2048 13.58G3>n3

G2>n2

-0.0005G1>n1

TABLE 11.4 Descriptorsevaluated usingthe co-occurrencematrices displayedin Fig. 11.31.

images is the number of times that pixels pairs with intensities and occur in in the position specified by so it is not surprising that Fig. 11.31(a) is arandom image, given the nature of the image from which it was obtained.

Figure 11.31(b) is more interesting. The first obvious feature is the symme-try about the main diagonal. Due to the symmetry of the sine wave, the num-ber of counts for a pair is the same as for the pair whichproduces a symmetric co-occurrence matrix. The non-zero elements of aresparse because value differences between horizontally adjacent pixels in ahorizontal sine wave are relatively small. It helps to remember in interpretingthese concepts that a digitized sine wave is a staircase, with the height andwidth of each step depending on frequency and the number of amplitude lev-els used in representing the function.

The structure of co-occurrence matrix in Fig. 11.31(c) is more complex.High count values are grouped along the main diagonal also, but their distrib-ution is more dense than for a property that is indicative of an image witha rich variation in intensity values, but few large jumps in intensity betweenadjacent pixels. Examining Fig. 11.30(c), we see that there are large areas char-acterized by low variability in intensities. The high transitions in intensityoccur at object boundaries, but these counts are low with respect to the mod-erate intensity transitions over large areas, so they are obscured by the abilityof an image display to show high and low values simultaneously, as we dis-cussed in Chapter 3.

The preceding observations are qualitative. To quantify the “content” of co-occurrence matrices we need descriptors such as those in Table 11.3. Table 11.4shows values of these descriptors computed for the three co-occurrence matrices

G2,

G3

G2

(zj, zi),(zi, zj)

Q,fzjzi

a b c

1 2 3

Page 51: timag2020 color y textura - fing.edu.uy

Métricas espectrales

• Con la TF se detectan: • Picos dominantes asociados a

direcciones principales de textura.

• Tamaño (frecuencia) de las repeticiones espaciales.

• Eliminando (filtrando) esas componentes dominantes queda la información no periódica que puede describirse con métricas estadísticas.

54

• Basadas en la Transformada de Fourier o variantes como la DCT.

• Ajustada para distinguir patrones repetitivos o periódicos.

• Patrones globales.

Page 52: timag2020 color y textura - fing.edu.uy

Métricas basadas en filtros

• Representan la imagen a partir de la respuesta a un conjunto de filtros

55

Conjunto de filtro de Gabor de diferente orientación y

escala.

Page 53: timag2020 color y textura - fing.edu.uy

Métricas basadas en filtros

56

Page 54: timag2020 color y textura - fing.edu.uy

Descriptores

• Las diferentes medidas, estadísticas, filtrados (procesamiento en general) nos permite obtener descriptores de una ROI, objeto, imagen, eventos, trayectoria, …

• Con estos descriptores es posibles aprender a diferenciar los casos de interés.

57

Page 55: timag2020 color y textura - fing.edu.uy

Pattern Recognition / Machine Learning

58

Page 56: timag2020 color y textura - fing.edu.uy

Pattern Recognition / Machine Learning

59

Page 57: timag2020 color y textura - fing.edu.uy

Pattern Recognition / Machine Learning

60

Page 58: timag2020 color y textura - fing.edu.uy

Referencias

• Digital Image Processing, An Algorithm Introduction to Java. Wilhelm Burger & Mark J. Burge. Springer, ISBN 978-1-84628-379-6 • Las trasparencias usan material del libro disponible en http://www.imagingbook.com/

• Digital Image Processing, Gonzalez & Woods. • Las trasparencias usan material del libro http://www.imageprocessingplace.com/

61