380 likes | 609 Views
Lecture 02 Point Based Image Processing. Mata kuliah : T0283 - Computer Vision Tahun : 2010. Learning Objectives. After carefully listening this lecture, students will be able to do the following : understand spatial information based image operation such as point-based processing
E N D
Lecture 02Point Based Image Processing Mata kuliah : T0283 - Computer Vision Tahun : 2010
Learning Objectives • After carefullylistening this lecture, students will be able to do the following : • 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. T0283 - Computer Vision
Digital Image Representation (Review Last Lecture) • 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. T0283 - Computer Vision
Spatial Digitization (Sampling) y f(x,y) s(x,y) grid x I(x,y) = f (x,y) . s(x,y) where s(x,y) = 1 for every value of x and y T0283 - Computer Vision
Spatial Digitization (Sampling) 24 x 36 48 x 72 400 x 267 96 x 144 T0283 - Computer Vision
Image Quantization Output Intensity 5 th level 4 th level 3 rd level 2 nd level 1st level 0 th level Input Intensity T0283 - Computer Vision
Image Quantization 1 bit/piksel 2 bit/piksel 8 bit/piksel 3 bit/piksel T0283 - Computer Vision
Digital Image Representation 0,0 c I(r,c) • 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). r M-1,N-1 T0283 - Computer Vision
Classification of Image Operations • Spatial Domain Methods • Point processing transformations • Area/Mask processing transformations • Geometric transformations • Frame processing transformations • Frequency Domain Methods T0283 - Computer Vision
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 pixel’s value • Used primarily for contrast enhancement T0283 - Computer Vision
Binary Images & Thresholding • Comparing an image I(m,n) with threshold T • Separate light object from dark background If I[m,n] T I[m,n] = object = 1 else I[m,n] = background = 0 • Separate dark object from light background • If I[m,n] T I[m,n] = object = 1 else I[m,n] = background = 0 T0283 - Computer Vision
Determining Threshold T • Fixed threshold – independently chosen • Histogram derived threshold – automatically • determined using histogram T0283 - Computer Vision
Triangle algorithm T0283 - Computer Vision
Contrast Stretching/CompressionStretch gray-level ranges where we desire more information T0283 - Computer Vision
Negative Transformations T0283 - Computer Vision
Intensity-Level SlicingHighlight a specific range of gray-level only Thresholding T0283 - Computer Vision
Non-Linear TransformationsWe may use any function, provided that is gives a one-to-one or many-to-one mapping Logarithmic Exponential T0283 - Computer Vision
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) T0283 - Computer Vision
Histogram Equalization (cont’d) • Histogram equalization is a transformation that stretches the contrast by redistributing the gray-level values uniformly T0283 - Computer Vision
Histogram Equalization (cont’d) • In practice, the histogram might not become totally flat ! T0283 - Computer Vision
Histogram Equalization Procedures T0283 - Computer Vision
Histogram Equalized Image T0283 - Computer Vision
After Scaling J = int [7(Fx – 0.125)/0.875 + 0.5] T0283 - Computer Vision
Histogram Equalization Procedures 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 end T0283 - Computer Vision
Histogram Equalization Procedures(Improvement) 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 T0283 - Computer Vision
for i = 1:1:256 map(i) = i-1; end j=1; i=1; while(j<256) while(icdf(i) < ideal(j)) i=i+1; map(i) = j; end j=j+1; end for i=1:1:rows for j=1:1:cols pxval = I(i,j)+1; ieq(i,j) = map(pxval)-1; end end T0283 - Computer Vision