INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Some color images on this slide
Last Lecture 2D filtering frequency domain The magnitude of the 2D DFT gives the amplitudes of the sinusoids and determines the intensities in the image These sinusoids combine to form the resulting image. At any given frequency in the DFT image, a large amplitude implies a greater prominence of a sinusoid of that frequency in the image. 2
Last Lecture 2D filtering frequency domain The phase is a measure of the displacement of the various sinusoids with respect to their origin. The phase specifies the angles (displacements) of the sinusoids and where objects are in the image (where the edges are) 3
Last Lecture 2D filtering frequency domain 2012-10-15 E0005E 4
INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Color Image Processing Matthew Thurley E0005E Industrial Image Analysis 5
This Lecture Color fundamentals Color model - RGB - HSI - Normalised RGB Some Color Image Processing - Segmentation - Image enhancement 6
Color Fundamentals Color spectrum may be divided into 6 different broad regions: 7
Color Fundamentals When the color spectrum is viewed in full color no color ends abruptly 8
Color Fundamentals We perceive objects as having certain colors due to that fact that they reflects incoming light differently. 9
Three-Color Theory Human visual system has two types of sensors Rods: grayscale, highly sensitive to intensity, superior at night & peripheral vision Cones - Color sensitive - Three types of cone - Only three values (the tristimulus values) are sent to the brain Need only match these three values Need only three primary colors Speaking Notes Initial processing of light in most optical systems is based on the human visual system, however, the human visual system has a back end far more complex than any camera. The optic nerves are connected to the rods and cones in an extremely complex arrangement with many of the characteristics of a sophisticated signal processor. The sensors in the eye do not react uniformly to light energy of different wavelengths (colors) Define intensity as the physical measure of light energy Define brightness as the measure of how intense we percieve the light to be. 2012-10-15 10
Color and monochromatic representation Chromatic light (color) White light Prism Monochromatic light Intensity of red light Intensity of green light Intensity of blue light White light Intensity of white light (or grey level) 2012-10-15 E0005E, Digital images 11
Color Fundamentals This brings us to talk about color models. A color model is a specification of a coordinate system and a subspace within that system where each color is represented by a single point. There are several but can be divided into two categories - Hardware oriented (color monitors and printers) - User manipulation (color graphics for animation etc.) 12
RGB color model (Almost) all physical colors can be represented as a point (R,G,B) in a Cartesian coordinate system 24-bit color cube (2 8 ) 3 = 16777216 colors 13
RGB color model An original color image separated into its three components in the RGB color space Blue buffer Red buffer Green buffer 14
RGB color model The RGB color system has many good properties, e.g. for presenting color on TV's and computer monitors It is not, however, very well suited for describing colors in terms that are practical for human interpretation. 15
HSI / HSV Color Model Color has perceptional attributes of hue, saturation, and lightness HSI / HSV color space encapsulates color information in a way that is familiar to humans - Hue what color is it? (red 0 o, green 120 o, blue 240 o, red 360 o ) - Saturation how vibrant is it, how much has the pure color been diluted by white light? - Intensity / Value how light or dark it is? A measure of the amount of incoming light - www.wikipedia.org/wiki/hsv_color_space MATLAB commands; rgb2hsv(), hsv2rgb() 2012-10-15 E0005E 16
HSI / HSV Color Model Magenta Blue White Cyan Take the RGB color cube Turn it on its black apex Red Yellow Green Consider the top view Consider the shaded plane defined by the black,white and cyan apexes All colors in the shaded plane have the same Hue (in this case cyan), with varying amounts of cyan (Saturation), and varying black-white Intensity Top View 2012-10-15 E0005E 17
HSI / HSV Color Model Top View The black dot is an arbitrary color Hue is the rotational angle with Red = 0 degrees Saturation is the distance from centre to the color point (magnitude of vector S) Intensity defined by vertical axis position Hexagonal representation can be transformed to a circle 2012-10-15 E0005E 18
HSV Color Model 2012-10-15 E0005E 19
HSI color model (textbook) 20
An example: the color pink We consider pink as a color but cant find it in the color spectrum. Pink is not a true spectral color. It is the result of mixing a number of spectral colors. 21
An example: the color pink in RGB color space In RGB notation the above color is c = 1*R + 0.68*G + 0.68*B. That is, we consider pink to be the true spectral color red mixed with white (i.e. all spectral colors). 22
An example: the color pink in HSI color space Here the hue is Red The saturation is 0.13 (measure of the degree to which a pure color is diluted by white light) The intensity is: 1 0.75 23
RGB to HSI You do not need to memorise these equations H = θ if B G 360 θ if B > G θ = cos 1 R G + (R B) 2[(R G)^2 + (R G)(G B)] 1/2 S = 1 [min R, G, B ] 3 (R + G + B) I = R + G + B 3 2012-10-15 E0005E 24
Normalised RGB (RG Chromacity) Mathematically simpler than HSI Remove distortions by lights and shadows R = R / (R+G+B) G = G / (R+G+B) B = B / (R+G+B) But you can represent B in terms of R and G B = 1 - R - G A 2D color space, not invertible Note the key changes - Shadows and white edges removed - Black and white circles look the same http://www.aishack.in/2010/01/normalized-rgb/ 2012-10-15 E0005E 25
RG Chromaticity (Wikipedia) Original Image Chromacity image Average RGB values (discarded) Each pixel rescaled so R+G+B=1 Can use the average value image with RG chromaticity image to reconstruct the original 2012-10-15 E0005E 26
Color image processing Color image processing requires thinking about what color space in which to process the image. Processing each channel separately R,G,B will likely have an affect on the colors of the combined image Processing the Inensity channel of HSI/HSV will not affect color - Smoothing & Sharpening: Discuss (Textbook 6.6) - Edge detection : Possible to do in an RGB vector space (6.7.3) Advanced topic (not covered in this course) Segmentation Image enhancement - Low saturation, Low contrast, Unsharp, Noise 27
Segmentation Let us try to segment out the red cap using the RGB buffers. This should be easy since the cap is red and we have a red buffer. This cap should appear as the brightest object in this buffer, right? Red buffer 28
Segmentation Answer: No, not necessarily. The situation below may very well be true, and the yellow cap is the brightest object in the red buffer. The fact that an object reflects a large amount of the incoming red light is not the only factor. Also the total amount of incoming red light will of course matter Higher absorption of red light but also higher total amount of reflected red light (due to more incoming light) Lower absorption of red light but also lower total amount of reflected red light (due to less incoming light) 29
Segmentation This is clearly seen if we try to choose a high threshold value and make a binary image 30
Segmentation Let us try to segment out the yellow cap using the HSI buffers We know which Hue values that represent yellow, so let s find the yellow cap by thresholding the Hue buffer Hue buffer Histogram of hue buffer 31
Segmentation Hue buffer 35 < H < 55 It appears that parts of the wall area predominantly yellow also. It s made of wood, so that seems reasonable 32
Segmentation But wood isn t really yellow. It is more like yellowish-brownishgrayish or something, while the cap is a clear pastel yellow. Let s look at the saturation buffer. High values = Pure color Low values = Impure (mixed) color Saturation buffer Histogram of saturation buffer 33
Segmentation Let s combine the two results (Hue ~ 45 & Saturation = high) A = 35 < H < 55 A & B B = S > 170 Morphological filtering 34
Image enhancement (low saturation) Due to ambient (background) light the colors in the image has a very low saturation (i.e. high mixture with white light) Histogram of saturation buffer Image with low saturation 35
Image enhancement (low saturation) Use a simple contrast stretching operation, multiplying the saturation buffer with a constant > 1. The result can be understood by studying the resulting histogram Histogram of enhanced saturation buffer Image with enhanced saturation 36
Image enhancement (low contrast) The color image have low contrast and this is also easy to see from the intensity histogram. This situation is more or less identical to the one for gray level images that you have seen in labs 1 and 2 Histogram of intensity buffer Image with low contrast 37
Image enhancement (low contrast) The remedy is anyone of the methods for contrast enhancement that we used in the labs, applied to the intensity buffer. In this case we choose histogram equalization Intensity buffer Equalized histogram Histogram equalized intensity buffer 38
Image enhancement (low contrast) Image with low contrast Contrast enhanced image Original image (for comparison) 39
Image enhancement (unsharp images) The image appears unsharp (blurred). This can be seen clearly in the intensity buffer Image that appears unsharp Intensity buffer 40
Image enhancement (unsharp images) We can always (by using highpass- and lowpassfilters) separate a low frequency component and a high frequency component from the intensity buffer Low frequencies Intensity buffer High frequencies 41
Sharpening of blurred images We form a new intensity image by taking the weighted sum LF + c*hf, where the constant c > 1. The result is an edge enhanced intensity buffer Low frequencies LF + c*hf High frequencies 42
Image enhancement (unsharp images) Image that appears unsharp Edge enhanced image Original image (for comparison) 43
Noise can cause severely degraded HIS/HSV-buffers Noisy R,G,B channels Blue buffer Red buffer Green buffer 44
Noise can cause severely degraded HIS/HSV-buffers Red buffer Green buffer Blue buffer H HSV = tan 1 R B 2G R B H HSI = cos 1 R G + (R B) 2[(R G)^2 + (R G)(G B)] 1/2 45
One option is to remove noise in the R,G,B channels Red filtered buffer Green filtered buffer Blue filtered buffer H HSV = tan 1 R B 2G R B H HSI = cos 1 R G + (R B) 2[(R G)^2 + (R G)(G B)] 1/2 WARNING: But smoothing RGB channels will modify some of the colors 46
Psuedo Color Imaging Creating a color image from a greyscale Intensity slicing : allocate a color to specific grayvalues and interpolate Combine 3 different monochrome images - Combine 3 images of the same scene taken at different times - Process each pixel with 3 different operations to create 3 images + different filters + different intensity transformations (stretching) 2012-10-15 E0005E 47
Further Reading Digital Image Processing textbook Ch 6-6.1, 6.2, 6.5-6.8 2012-10-15 E0005E 48
Summing Up Consider the following three questions; - What do I need to work on? - What have I learnt today? - What was the main point left unanswered today? Write your answers in the provided journal. Write the lecture number on top of the page. 2012-10-15 E0005E Industrial Image Analysis 49