Lecture 02 Point Based Image Processing Lecture 02 Point Based Image Processing Mata kuliah: T0283 - Computer Vision Tahun: 2010

Embed Size (px)

DESCRIPTION

January 20, 2010T Computer Vision3 After carefullylistening this lecture, students will be able to do the following : After carefully listening this lecture, students will be able to do the following : understand spatial information based image operation such as point-based processing understand spatial information based image operation such as point-based processing demonstrate how point-based image processing is performed (i.e. contrast enhancement and histogram equalization. demonstrate how point-based image processing is performed (i.e. contrast enhancement and histogram equalization. Learning Objectives

Citation preview

Lecture 02 Point Based Image Processing Lecture 02 Point Based Image Processing Mata kuliah: T Computer Vision Tahun: 2010 January 20, 2010T Computer Vision3 After carefullylistening this lecture, students will be able to do the following : After carefully listening this lecture, students will be able to do the following : understand spatial information based image operation such as point-based processing understand spatial information based image operation such as point-based processing demonstrate how point-based image processing is performed (i.e. contrast enhancement and histogram equalization. demonstrate how point-based image processing is performed (i.e. contrast enhancement and histogram equalization. Learning Objectives January 20, 2010T Computer Vision4 For computer representation, function (e.g. intensity) must be sampled at discrete intervals. Sampling map the intensity values into discrete intervals. Points at which an image is sampled are called picture elements or pixels. Resolution specifies the distance between points - accuracy. Digital Image Representation (Review Last Lecture) January 20, 2010T Computer Vision5 Spatial Digitization (Sampling) x y f(x,y) s(x,y) grid I(x,y) = f (x,y). s(x,y) where s(x,y) = 1 for every value of x and y January 20, 2010T Computer Vision6 Spatial Digitization (Sampling) 24 x x x x 72 January 20, 2010T Computer Vision7 3 rd level 2 nd level 1st level 0 th level Input Intensity 5 th level 4 th level Output Intensity Image Quantization January 20, 2010T Computer Vision8 Image Quantization 1 bit/piksel 3 bit/piksel 2 bit/piksel 8 bit/piksel January 20, 2010T Computer Vision9 Digital Image Representation A digital image is represented by a matrix of numeric values each representing a quantized intensity value. I(r,c) - intensity value at position corresponding to row r and column c of the matrix. Intensity value can be represented by 1 bit for black and white images (binary valued images), 8 bits for monochrome imagery to encode color or grayscale levels, 24 bits (color-RGB). c r 0,0 M-1,N-1 I(r,c) January 20, 2010T Computer Vision10 Spatial Domain Methods Point processing transformations Area/Mask processing transformations Geometric transformations Frame processing transformations Frequency Domain Methods Classification of Image Operations January 20, 2010T Computer Vision11 Point Processing Methods The most primitive, yet essential, image processing operations. Intensity transformations that convert an old pixel into a new pixel based on some predefined function They operate on a pixel based solely on that pixels value Used primarily for contrast enhancement January 20, 2010T Computer Vision12 Comparing an image I(m,n) with threshold T Separate light object from dark background If I[m,n] TI[m,n] = object = 1 elseI[m,n] = background = 0 Separate dark object from light background If I[m,n] TI[m,n] = object = 1 elseI[m,n] = background = 0 Binary Images & Thresholding January 20, 2010T Computer Vision13 January 20, 2010T Computer Vision14 Fixed threshold independently chosen Histogram derived threshold automatically determined using histogram Determining Threshold T January 20, 2010T Computer Vision15 Triangle algorithm January 20, 2010T Computer Vision16 Contrast Stretching/Compression Stretch gray-level ranges where we desire more information January 20, 2010T Computer Vision17 Negative Transformations January 20, 2010T Computer Vision18 Intensity-Level Slicing Highlight a specific range of gray-level only Thresholding January 20, 2010T Computer Vision19 Non-Linear Transformations We may use any function, provided that is gives a one-to-one or many-to-one mapping LogarithmicExponential January 20, 2010T Computer Vision20 Histogram Equalization Low contrast images usually mostly dark, mostly light, or mostly gray High contrast images have large regions of dark and large regions of white (e.g. standing in front of a window on a sunny day) Good contrast images exhibit a wide range of pixel values (i.e. no single gray level dominates the image) January 20, 2010T Computer Vision21 January 20, 2010T Computer Vision22 Histogram Equalization (contd) Histogram equalization is a transformation that stretches the contrast by redistributing the gray-level values uniformly January 20, 2010T Computer Vision23 Histogram Equalization (contd) In practice, the histogram might not become totally flat ! January 20, 2010T Computer Vision24 I x I = I/7 (scaled) nInInInIP(I)(freq.) F x (x I ) (CDF)JOutputP(J)(freq.) Histogram Equalization Procedures January 20, 2010T Computer Vision Histogram Equalized Image January 20, 2010T Computer Vision J = int [7(Fx 0.125)/ ] After Scaling January 20, 2010T Computer Vision27 for i=0 :maxgval ihist(i+1) = sum(I(:)==i)/(rows*cols); end icdf(1)= ihist(1); for i=2: 1: 256 icdf(i) = ihist(i) + icdf(i-1); end for i=1:1:rows for j=1: 1: cols k = I(i,j)+1; ieq(i,j) = round(255*(icdf(k)-icdfmin)/(1.00-icdfmin)+0.5); end Histogram Equalization Procedures January 20, 2010T Computer Vision28 January 20, 2010T Computer Vision29 for i=0 : maxgval ihist(i+1) = sum(I(:)==i); end icdf(1)= ihist(1); for i=2: 1: 256 icdf(i) = ihist(i) + icdf(i-1); end ideal(:) = uint16((rows*cols)/256); for i=2: 1: 256 ideal(i) = ideal(i) + ideal(i-1); end Histogram Equalization Procedures (Improvement) January 20, 2010T Computer Vision30 for i = 1:1:256 map(i) = i-1; end j=1; i=1; while(j