color image processing ii - dronacharyagn.dronacharya.info/.../unit-4/colorii.pdf · outline color...

48
Color Image Processing II

Upload: others

Post on 21-Jul-2020

36 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color Image Processing II

Page 2: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Outline

Color fundamentals

Color perception and color matching

Color models

Pseudo-color image processing

Basics of full-color image processing

Color transformations

Smoothing and sharpening

Page 3: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Pixel depth

Pixel depth: the number of bits used to represent each pixel in RGB space

Full-color image: 24-bit RGB color image

(R, G, B) = (8 bits, 8 bits, 8 bits)

Page 4: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Safe RGB colors

Subset of colors is enough for some application

Safe RGB colors (safe Web colors, safe browser colors)

(6)3 = 216

Page 5: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Safe RGB color (cont.)

Safe color cube Full color cube

Page 6: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

CMY model (+Black = CMYK)

CMY: secondary colors of light, or primary colors of pigments

Used to generate hardcopy output

B

G

R

Y

M

C

1

1

1

Page 7: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Why black ink is used?

http://en.wikipedia.org/wiki/CMYK

Page 8: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

HSI color model

Can you describe a color precisely using its R, G, B components?

Human describe a color by its hue, saturation, and brightness

Hue 色度: color attribute

Saturation: purity of color (white->0, primary color->1)

Brightness: achromatic notion of intensity

Page 9: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

HSI color model (cont.)

RGB -> HSI model

Intensity line

saturation

Colors on this triangle Have the same hue

Page 10: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

HSI model: hue and saturation

Page 11: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

HSI model

Page 12: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

HSI component images

R,G,B Hue

saturation intensity

Page 13: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Exercise#1: HSI

x=imread(‘lily.tif’); x(:,:,1) is R component

x(:,:,2) is G component

x(:,:,3) is B component

Exercise: 1. Apply color transform, rgb2hsv, show the H, S, V component 2. Apply rgb2hsv to your RGB circles image in exercise#2

Page 14: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Outline

Color fundamentals

Color perception and color matching

Color models

Pseudo-color image processing

Basics of full-color image processing

Color transformations

Smoothing and sharpening

Page 15: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Pseudo-color image processing

Assign colors to gray values based on a specified criterion

For human visualization and interpretation of gray-scale events

Intensity slicing

Gray level to color transformations

Page 16: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Intensity slicing

3-D view of intensity image

Image plane

Color 1

Color 2

Page 17: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Intensity slicing (cont.)

Alternative representation of intensity slicing

Page 18: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Intensity slicing (cont.)

More slicing plane, more colors

Page 19: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Application 1

8 color regions Radiation test pattern

* See the gradual gray-level changes

Page 20: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Application 2

X-ray image of a weld

焊接物

Page 21: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Application 3

Rainfall statistics

Page 22: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Exercise#2: Gray to color transformations

b=imread(‘blocks.tif’); imshow(b, colormap( jet(256) ));

colorbar

Exercise: Try any other 2 colormaps See doc colormap

Page 23: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Gray level to color transformation

Intensity slicing: piecewise linear transformation

General Gray level to color transformation

Page 24: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Gray level to color transformation

Page 25: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Application 1

Page 26: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Combine several monochrome images

Example: multi-spectral images

Page 27: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

R G

B

Near Infrared (sensitive to biomass)

R+G+B near-infrared+G+B

Washington D.C.

Page 28: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color slicing

Recall the pseudo-color intensity slicing

1-D intensity

Page 29: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color slicing

How to take a region of colors of interest?

prototype color

Sphere region

prototype color

Cube region

Page 30: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Application

cube sphere

Page 31: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Matlab: Color slicing

Exercise#3: Get strawberry image

(s1, s2, s3) = (r1, r2, r3)

if |r1–a1|<w & |r2–a2|<w & |r3–a3|<w

(s1, s2, s3) = (127, 127, 127) otherwise

Page 32: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Outline

Color fundamentals

Color perception and color matching

Color models

Pseudo-color image processing

Basics of full-color image processing

Color transformations

Smoothing and sharpening

Page 33: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color pixel

A pixel at (x,y) is a vector in the color space

RGB color space

),(

),(

),(

),(

yxB

yxG

yxR

yxc

c.f. gray-scale image

f(x,y) = I(x,y)

Page 34: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Example: spatial mask

Page 35: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

How to deal with color vector?

Per-color-component processing

Process each color component

Vector-based processing

Process the color vector of each pixel

When can the above methods be equivalent?

Process can be applied to both scalars and vectors

Operation on each component of a vector must be independent of the other component

Page 36: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Two spatial processing categories

Similar to gray scale processing studied before, we have to major categories

Pixel-wise processing: color transformation

Neighborhood processing: smoothing and sharpening filtering

Page 37: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Outline

Color fundamentals

Color perception and color matching

Color models

Pseudo-color image processing

Basics of full-color image processing

Color transformations

Smoothing and sharpening

Page 38: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color transformation

Similar to gray scale transformation

g(x,y)=T[f(x,y)]

Color transformation

nirrrTs nii ,...,2,1 , ),...,,(21

output vector input vector

s1

s2

… sn

r1

r2

… rn

T1

T2

… Tn

Page 39: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Use which color model in color transformation?

RGB CMY(K) HSI

Theoretically, any transformation can be performed in any color model

Practically, some operations are better suited to specific color model

Page 40: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Example: modify intensity of a color image

Example: g(x,y)=k f(x,y), 0<k<1

HSI color space

Intensity: s3 = k r3

RGB color space

For each R,G,B component: si = k ri

CMY color space

For each C,M,Y component: si = k ri +(1-k)

Processing results are the same. Which operations is the fastest?

Page 41: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

I H,S

k=0.7 (reduce intensity) Original image

Page 42: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Problem of using Hue component

dis-continuous

Un-defined over gray axis

Page 43: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Outline

Color fundamentals

Color perception and color matching

Color models

Pseudo-color image processing

Basics of full-color image processing

Color transformations

Smoothing and sharpening

Page 44: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color image smoothing

Neighborhood processing

Page 45: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Color image smoothing: averaging mask

xySyx

yxK

yx),(

),(1

),( cc

Neighborhood Centered at (x,y)

xy

xy

xy

Syx

Syx

Syx

yxBK

yxGK

yxRK

yx

),(

),(

),(

),(1

),(1

),(1

),(c

vector processing

per-component processing

Page 46: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

original R

G G

H S I

Page 47: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Example: 5x5 smoothing mask

Smooth each component in RGB model

Smooth I in HSI model difference

Page 48: Color Image Processing II - Dronacharyagn.dronacharya.info/.../Unit-4/colorII.pdf · Outline Color fundamentals Color perception and color matching Color models Pseudo-color image

Exercise#4: Smoothing color image

Download lena_RGB.tif

Smoothing with 10x10 average filter in

RGB domain

HSI domain (smoothing intensity only)