Image Processing 2. Point Processes Computer Engineering, Sejong University Dongil Han Spatial domain processing g(x,y) = T[f(x,y)] f(x,y) : input image g(x,y) : processed image T[.] : operator on f, defined over some neighborhood of (x, y) 2/6
Point Processes The simplest form of T[.] processed output depends only on the value of f at (x, y) s = T(r) r : gray-level of f(x,y) s : gray-level of g(x,y) T[.] : operator on f, becomes a gray-level mapping function 3/6 Point Processes Some basic point processing techniques Arithmetic operations Look-up table processing Histogram Contrast stretching Intensity transform 4/6
Arithmetic Operations Addition, Subtraction, Multiplication, Division operations over pixels by a constant value g(x,y) = f(x,y) + c multiplication, division operations : adjusting the contrast g(x,y) = a * f(x,y) 5/6 Arithmetic Operations Addition, Subtraction Operations Subtracting to a pixel : darkens the image Nothing to increase/decrease the local contrast e.g.) g(x,y) = f(x,y) + 5, g(x,y) = f(x,y) - 6 <Original> <Original+5> <Original-6> 6/6
Arithmetic Operations Multiplication, Division Operations Multiplication : increase the local contrast Division : decrease the local contrast e.g.) g(x,y) =.5 * f(x,y), g(x,y) = f(x,y)/.5 <Original> <Original *.5> <Original/.5> 7/6 Arithmetic Operations Problems Subtraction : : can exceeds the min. value of image range Multiplication : can exceeds the max. value of image range => simple solution: clamping e.g.) negative value : set to, greater than 255: set to 255 => may generates saturated image original 8/6 saturated
Logical Operations XOR (Exclusive OR) Operation A XOR B A = A = B = B = AND Operation A AND B A = A = B = B = OR Operation A OR B A = A = B = B = 9/6 Logical Operations XOR operation in image processing used to find all pixels of a certain value if f(x,y) = c then g(x,y) = else g(x,y) = f(x,y) application example - generates cursor - extracts certain value in an image - Pseudo-color image processing /6
Logical Operations <ORIGINAL> <ORIGINAL XOR 28> /6 <ORIGINAL XOR 25> Pseudo color image processing 2/6
Look-up Table Look-up Table(LUT) array index : current pixel value array output : generated new pixel value advantage easy to use(software : array, Hardware : Memory) complex mathematical expression : just LUT programming (e.g.: y = sin x, y = log x) 3/6 Look-up Table Graphical representation of LUT x axis : index of array (input pixel value) y axis : LUT output (processed pixel value) output image y 7 6 5 4 3 2 x 2 3 4 5 6 7 input image 4/6
Look-up Table LUT example : Gamma correction 5/6 Gamma correction CRT devices have a non-linear intensity-to-voltage response low voltage region : darker than intended gamma correction : the process used to correct this response brightness Look-up Table display characteristics of CRT 6/6 voltage (gray-level)
Gamma correction Look-up Table ( V.99) L.99 V L 4.5 for V for.82 V.82 Inverse response curve is adapted in camera system (L : luminance, V : output voltage of camera, : determines the gain) V.99 L (/ ).99 for.8 L V 4.5 L for L.8 7/6 Look-up Table Gamma correction variations of response dependent on the gamma value Camera gamma Final display characteristics Display gamma 8/6
Look-up Table Gamma correction Gamma > : darker image => Gamma < : brighter image => intentionally adjusted characteristics of Camera Gamma = : normal image => final display image Gamma > darker image Gamma = normal image 9/6 Gamma < brighter image Look-up Table Gamma correction original image display before gamma correction gamma correction (Camera) display after gamma correction 2/6
Look-up Table Broadcasting block diagram using gamma correction 2/6 Look-up Table separate gamma correction for R, G, B signal in color TV incorrect gamma correction may generate unintended color signal for gray images 22/6
Look-up Table Problems of gamma correction Each display device has different gamma characteristics => PDP : linear curve between input voltage and output luminance camera signal renders gamma corrected signal : PDP needs inverse gamma response luminance CRT luminance PDP input voltage 23/6 input voltage Look-up Table Image enhancement using gamma curve 24/6
Look-up Table Image enhancement using LUT 25/6 Look-up Table Image enhancement using LUT 26/6
Histogram Mathematical definition graphical representation of the distribution data Histogram in image processing graphical representation used to view the intensity profile of an image - X-axis : possible pixel intensity values - Y-axis : number of occurrences for each intensity image 27/6 histogram Histogram Mathematical representation of histogram n k = h(r k ), r k : k th level, < k < 255 Here, n k can have values between < n k < 64x64(496) Histogram Normalization histogram is divided by the total number of pixels If we let the total number of pixels be n n k /n = p(r k ), r k : k th level, < k < 255 Here, p(r k ) can be considered probability density function 28/6
Histogram Properties of Histogram renders the intensity profile of an image can estimate the contrast information of an image brightness image : Histograms are right shifted contrast is low: Histograms are crowded in a narrow area contrast is high: Histograms are extended out in a wide area 29/6 Histogram Histogram vs. Arithmetic Operation addition operation: brightens the image => subtraction operation : darkens the image => Histogram : shift left Original + 4 original Original - 4 3/6
Histogram Histogram vs. Arithmetic Operation multiplication operation : increase the local contrast => division operation : decrease the local contrast => Histogram : shrink narrower Original *.2 original Original /.2 3/6 Histogram Color image histogram histogram processing is conducted in each R, G, B signal 32/6
Histogram Cumulative Distribution Function(CDF: 누적분포함수 ) s r T ( r) pr(w) dw, r w : dummy variable for integration r : random variable of CDF Mathematical Properties of CDF T(r) monotone increasing function in r region T(r) for r T( ) may not have an inverse function 33/6 Histogram Properties of CDF T(r) dark image => histogram CDF curve bright image => bends downwards histogram CDF curve 34/6
Histogram Image correction using CDF use CDF as a LUT 35/6 Histogram Image correction using CDF dark image => LUT => histogram CDF curve bright image => LUT => increase the dark portion histogram CDF curve 36/6
Histogram Equalization Histogram Equalization(HE) goal : obtain a uniform histogram by redistribution of original histogram -HE example 37/6 Histogram Equalization Histogram Equalization process. 2. calculate normalized sum of histogram(cdf) 3. transform input image to output image using CDF 2 3 38/6
Histogram Equalization 39/6 Histogram Equalization 4/6
Histogram Equalization 4/6 Histogram Equalization Properties of HE mostly, generates images with maximum contrast work well on images with fine details in dark region can not change the frequency of each luminance level Automatic!! : Good quality images can be degraded by HE 42/6
Histogram Equalization 43/6 Histogram Specification Histogram Specification The method used to generate a processed image that has a specified histogram can lighten or darken an image or make more contrast of an image histogram equalization + inverse histogram equalization also called Histogram matching desired histogram 44/6
Histogram Specification The procedure of Histogram Specification. 2. calculate normalized sum of histogram(cdf) T(r) s T ( r) r p r ( w) dw. 3. calculate normalized sum of desired histogram G(z) that it has G(z) - v G ( z) z p z ( w) dw. 4. perform histogram equalization using an input image, after that, perform inverse histogram equalization using the CDF of the desired histogram ( s z G ) z G [ T ( r )] 45/6 Histogram Specification 46/6
Histogram Specification 47/6 Contrast Stretching Contrast Contrast high low high low Contrast stretching stretch a histogram to fill the full dynamic range of image good contrast image exhibits a wide range of pixel values low contrast 48/6 high contrast
Contrast Stretching Basic contrast stretching works best on images that have all pixels concentrated in one part of the histogram 49/6 Contrast Stretching End-In-Search must specify that a certain percentage of the pixels must be saturated to full white or full black High : converted to full white 5/6
Contrast Stretching Original Image Basic Contrast Stretching Original Image End-in Search 5/6 Contrast Stretching Piecewise-Linear Stretching transform function is divided into several piecewise linear function parameter setting: clamping, thresholding, etc. clamping : thresholding : a b t u [ a, b] v f ( u) u [, L], v [, L] v u, ( u a) v ( u b) vb a a b u u u a b L 52/6
Contrast Stretching Piecewise-Linear Stretching.5.5.5.5.5.5.5.5.5 Contrast Stretching, a = 8, b= 6 53/6 Contrast Stretching Piecewise-Linear Stretching 54/6
Intensity Transform Intensity Transform converts an old pixel into a new pixel based on some predefined function Simple intensity transform example null transform y = x negative transform y = 255 - x gamma correction stretching 55/6 Intensity Transform 56/6
Intensity Transform Intensity transform example compression - - reduce the dynamic range of an image posterizing - reduce the number of gray levels in an image - can reduce the size of an image thresholding - posterizing with the number of gray levels is reduced 2 - generates binary images 57/6 Intensity Transform 58/6
Intensity Transform Intensity transform example bounded thresholding - - treats the other input pixels as null transforms iso-intensity contouring - sets particular input intensity values to black or white - uses to find certain intensity level solarizing - negative transform for the bright part of an image 59/6 Intensity Transform 6/6