• Save
S S08  D I P  Lec07  Pixel Operations
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

S S08 D I P Lec07 Pixel Operations

on

  • 1,071 views

 

Statistics

Views

Total Views
1,071
Views on SlideShare
1,069
Embed Views
2

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 2

http://www.slideshare.net 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

S S08 D I P Lec07 Pixel Operations Presentation Transcript

  • 1. Pixel Processing SS 2008 – Image Processing Multimedia Computing, Universität Augsburg Rainer.Lienhart@informatik.uni-augsburg.de www.multimedia-computing.{de,org}
  • 2. Reference Bernd Jähne. Digital Image Processing. Springer Verlag. Chapter on Pixel Processing (chap 8 in 4th edition) Most Figures are taken from that book © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 2 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 3. Point Operations := modification of gray value at individual pixels dependent only on the gray value and possibly on the position of the pixel I ' ( x, y)  Px, y I ( x, y) © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 3 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 4. Homogeneous Point Operations := Point operation independent of position of pixel I ' ( x, y)  PI ( x, y) • Map set of gray values onto itself • Generally not invertible: – Example: Thresholding  0 q  threshold P(q)   255 q  threshold  Not invertible – Example: Invertion Pnegation(q)  255  q , q  I ( x, y)  Invertible © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 4 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 5. Image Thresholding Two principles • Fixed threshold; • Adaptive threshold; void cvThreshold( const CvArr* src, CvArr* dst, double threshold, double max_value, int threshold_type ); src = Source array (single-channel, 8-bit of 32-bit floating point). dst = Destination array; must be either the same type as src or 8-bit. threshold = threshold value. max_value = Maximum value to use with CV_THRESH_BINARY and CV_THRESH_BINARY_INV thresholding types. threshold_type = Thresholding type (see the discussion) © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 5 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 6. Adaptive Thresholding void cvAdaptiveThreshold( const CvArr* src, CvArr* The function cvAdaptiveThreshold transforms dst, double max_value, int grayscale image to binary image according adaptive_method=CV_ADAPTIVE_THRESH_MEA to the formulae: N_C, int threshold_type=CV_THRESH_BINARY, int block_size=3, double param1=5 ); threshold_type=CV_THRESH_BINARY: Src = source image. • dst(x,y) = max_value, if src(x,y)>T(x,y) 0, Dst = Destination image. otherwise max_value = Maximum value that is used with CV_THRESH_BINARY and CV_THRESH_BINARY_INV. threshold_type=CV_THRESH_BINARY_INV: adaptive_method = Adaptive thresholding algorithm to • dst(x,y) = 0, if src(x,y)>T(x,y) max_value, use: CV_ADAPTIVE_THRESH_MEAN_C or otherwise where T is a threshold calculated CV_ADAPTIVE_THRESH_GAUSSIAN_C (see the individually for each pixel. discussion). threshold_type = Thresholding type; must be one of CV_THRESH_BINARY, CV_THRESH_BINARY_INV For the method block_size = The size of a pixel neighborhood that is CV_ADAPTIVE_THRESH_MEAN_C it is a used to calculate a threshold value for the pixel: 3, 5, 7, ... mean of block_size × block_size pixel Param1 = The method-dependent parameter. For the neighborhood, subtracted by param1. methods CV_ADAPTIVE_THRESH_MEAN_C and For the method CV_ADAPTIVE_THRESH_GAUSSIAN_C it is a CV_ADAPTIVE_THRESH_GAUSSIAN_C it constant subtracted from mean or weighted mean is a weighted sum (gaussian) of block_size (see the discussion), though it may be negative. × block_size pixel neighborhood, subtracted by param1. © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 6 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 7. LUT Operations := Look-up tables operations  efficient way to implement homogeneous point operations on large images Example: – Homogeneous point operation on 1920x1080 8u_C1 image  Need an LUT array of size 256. – P(q) := log (q)  only 256 log operations with LUT vs. 1920*1080 log operations with out LUT void cvLUT( const CvArr* src, CvArr* dst, const CvArr* lut );  Performs look-up table transform of array src = Source array of 8-bit elements. dst = Destination array of arbitrary depth and of the same number of channels as the source array. lut = Look-up table of 256 elements; should have the same depth as the destination array. The function cvLUT fills the destination array with values from the look-up table. Indices of the entries are taken from the source array. That is, the function processes each element of src as following: dst(I)=lut[src(I)+DELTA] where DELTA=0 if src has depth CV_8U, and DELTA=128 if src has depth CV_8S. © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 7 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 8. LUT Example © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 8 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 9. Evaluating & Optimizing Illumination Doesn’t reveal spatial variance Histogram Histogram equalization equalization & quantization © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 9 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 10. Detection of Under-/Overflow © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 10 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 11. Contrast Enhancement © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 11 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 12. Contrast Enhancement (2) Example 1: Void NormalizeImageTo255 ( IplImage *in, IplImage *out ) { double InputMin, InputMax; cvMinMaxLoc( in, &InputMin, &InputMax ); cvConvertScale ( in, in, 1, -InputMin); cvConvertScale ( in, out, 255.0 / (InputMax - InputMin), 0); } Example 2: Void NormalizeImageTo255 ( IplImage *in, IplImage *out, double cutOffPercent=2.5) { Ipp8u InputMin=0, InputMax=255; Ipp32u sum=0, sumT= in->width * (in->height * cutOffPercent); Ipp32u histo[256] = {0}; calcHisto( in, histo ); for (sum=0 ; InputMin<256 && sum<sumT; InputMin++) sum+=histo[i]; InputMin--; for (sum=0 ; InputMax>=0 && sum<sumT; InputMax--) sum+=histo[i]; InputMax++; cvConvertScale ( in, in, 1, -InputMin); cvConvertScale ( in, out, 255.0 / (InputMax - InputMin), 0); } © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 12 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 13. Inhomogeneous Point Op. := Point operation dependent of position of pixel I ' ( x, y)  Px, y I ( x, y) • Mostly related to calibration procedures • Example: – Subtraction of a background image without objects I ' ( x, y)  Px, y I ( x, y)  I ( x, y)  B( x, y) – Temporal image averaging  I ' ( x, y, t )  Px , y I ( x, y, t )    w( )I ( x, y, )  © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 13 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 14. Temporal Image Averaging © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 14 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 15. Illumination Correction Where is always – Uneven illumination – Dust on lenses – Uneven spatial CCD sensitivity  Introduce systematic errors I ( x, y ) I ' ( x, y )  c Ref image taken R ( x, y ) with full illumination I ( x, y )  B( x, y ) I ' ( x, y )  c R( x, y )  B( x, y) BG image taken without illumination (fixed pattern noise on CCD) © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 15 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de
  • 16. Windowing © 2005-2008 Prof. Dr. R. Lienhart, Head of Multimedia Computing, Institut für Informatik, Universität Augsburg 16 Eichleitnerstr. 30, D-86135 Augsburg, Germany; email: Rainer.Lienhart@informatik.uni-augsburg.de