Transcript Slide 1
DREAM IDEA PLAN IMPLEMENTATION 1 2 Introduction to Image Processing Present to: Amirkabir University of Technology (Tehran Polytechnic) & Semnan University Dr. Kourosh Kiani Email: [email protected] Email: [email protected] Email: [email protected] Web: www.kouroshkiani.com 3 Lecture 03 4 POINT OPERATIONS g x, y M f x, y Point Operations Overview Point operations are zero-memory operations where a given gray level x[0,L] is mapped to another gray level y[0,L] according to a transformation y f (x) y L L L=255: for grayscale images x POINT OPERATIONS A point operation can be defined as a mapping function: vnew M vold where v stands for gray values. M(v) takes any value v in the source image into vnew in the destination image. Simplest case - Linear Mapping: M v v M(v) q’ p’ p q v q' p' q p ; p'p LAZY MAN OPERATION yx y L L x No influence on visual quality at all Digital Negative L y Lx 0 L x THE NEGATIVE MAPPING M(v) 255 M v 255 v v 255 THE NEGATIVE MAPPING POINT OPERATIONS AND THE HISTOGRAM Given a point operation: M(va) takes any value va in image A and maps it into vb in image B. Requirement: the mapping M is a non descending function (M-1 exists). In this case, the area under Ha between 0 and va is equal to the area under Hb between 0 and vb vb M va • The area under Ha between 0 and va is equal to the area under Hb between 0 and vb=M(va) v M(v) v Hb Ha v Q: Is it possible to obtain Hb directly from Ha and M(v)? A: Since M(v) is monotonic, Ca(va)=Cb(vb) therefore: Cb vb Ca M 1 vb v M(v) v Cb Ca v Contrast Stretching x y ( x a ) ya ( x b) y b 0 xa a xb bxL yb ya 0 a b a 50, b 150, 0.2, 2, 1, ya 30, yb 200 L x Clipping 0 xa 0 y ( x a) a x b (b a) b x L 0 a b L a 50, b 150, 2 x Range Compression y c log10 (1 x) 0 L c=100 x Images taken from Gonzalez & Woods, Digital Image Processing (2002) POINT PROCESSING EXAMPLE: THRESHOLDING Thresholding transformations are particularly useful for segmentation in which we want to isolate an object of interest from a background s= 1.0 r > threshold 0.0 r <= threshold POINT PROCESSING EXAMPLE: THRESHOLDING Original Image y Image f (x, y) s= Enhanced Image x y Image f (x, y) 1.0 r > threshold 0.0 r <= threshold x CONTRAST STRETCHING THROUGH HISTOGRAM If rmax and rmin are the maximum and minimum gray level of the input image and L is the total gray levels of output image The transformation function for contrast stretching will be CONTRAST STRETCHING THROUGH HISTOGRAM One can take an image with a narrow contrast range and expand it to cover the entire range of black to white in a process known as contrast stretching. CONTRAST STRETCHING EXAMPLE CONTRAST STRETCHING EXAMPLE CONTRAST STRETCHING EXAMPLE CONTRAST STRETCHING EXAMPLE BASIC GREY LEVEL TRANSFORMATIONS There are many different kinds of grey level transformations Three of the most common are shown here Linear Negative/Identity Logarithmic Log/Inverse log Power law nth power/nth root LOGARITHMIC TRANSFORMATIONS The general form of the log transformation is s = c * log(1 + r) The log transformation maps a narrow range of low input grey level values into a wider range of output values The inverse log transformation performs the opposite transformation LOGARITHMIC TRANSFORMATIONS Log functions are particularly useful when the input grey level values may have an extremely large range of values In the following example the Fourier transform of an image is put through a log transform to reveal more detail s = log(1 + r) LOGARITHMIC TRANSFORMATIONS Original Image y Enhanced Image x Image f (x, y) y Image f (x, y) s = log(1 + r) We usually set c to 1 Grey levels must be in the range [0.0, 1.0] x POWER LAW TRANSFORMATIONS Power law transformations have the following form s=c*rγ Map a narrow range of dark input values into a wider range of output values or vice versa Varying γ gives a whole family of curves POWER LAW TRANSFORMATIONS Original Image y Enhanced Image x y Image f (x, y) Image f (x, y) s=rγ We usually set c to 1 Grey levels must be in the range [0.0, 1.0] x POWER LAW EXAMPLE POWER LAW EXAMPLE Transformed Intensities γ = 0.6 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 Old Intensities 0.8 1 POWER LAW EXAMPLE Transformed Intensities γ = 0.4 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 Original Intensities 0.8 1 POWER LAW EXAMPLE Transformed Intensities γ = 0.3 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 Original Intensities 0.8 1 POWER LAW EXAMPLE s = r 0.6 s = r 0.4 The images to the right show a MR image of a fractured human spine Different curves highlight different detail POWER LAW EXAMPLE POWER LAW EXAMPLE Transformed Intensities γ = 5.0 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 Original Intensities 0.8 1 POWER LAW TRANSFORMATIONS s = r 3.0 s = r 4.0 An aerial photo of a runway is shown This time power law transforms are used to darken the image Different curves highlight different detail GAMMA CORRECTION Many of you might be familiar with gamma correction of computer monitors Problem is that display devices do not respond linearly to different intensities Can be corrected using a log transform GAMMA CORRECTION New Image pixel = (Original Image pixel ) -γ Original image New Image Gamma correction= 1.5 New Image pixel = (Original Image pixel )^-1.5 GAMMA CORRECTION EXAMPLES Here is an example at different gammas. L0, gamma= 1 L0 2.2, gamma = 1/(2.2) L01/2.2 , gamma = 2.2 This is the best gamma MORE CONTRAST ISSUES PIECEWISE LINEAR TRANSFORMATION FUNCTIONS Rather than using a well defined mathematical function we can use arbitrary user-defined transforms The images below show a contrast stretching linear transform to add contrast to a poor quality image GRAY LEVEL SLICING Highlights a specific range of grey levels Similar to thresholding Other levels can be suppressed or maintained Useful for highlighting features in an image BIT PLANE SLICING Often by isolating particular bits of the pixel values in an image we can highlight interesting aspects of that image Higher-order bits usually contain most of the significant visual information Lower-order bits contain subtle details BIT PLANE SLICING [10000000] [01000000] [00100000] [00001000] [00010000] [00000100] [00000001] [00000010] BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING BIT PLANE SLICING Reconstructed image using only bit planes 8 and 7 Reconstructed image using only bit planes 8, 7 and 6 Reconstructed image using only bit planes 7, 6 and 5 POINT PROCESSING Simple gray level transformations Image negatives Log transformations Power-law transformations Contrast stretching Gray-level slicing Bit-plane slicing Histogram processing Histogram equalization Histogram matching (specification) Arithmetic/logic operations Image averaging Questions? Discussion? Suggestions ? 63