240 likes | 250 Views
Learn about image enhancement procedures, such as point processing and histogram processing, to improve image quality. Explore methods like contrast stretching and mask processing for spatial domain image enhancement.
E N D
CSC 381/481 Quarter: Fall 03/04 Daniela Stan Raicu Email: draicu@cs.depaul.edu Homepage: http://facweb.cs.depaul.edu/dstan School of CTI, DePaul University Daniela Stan - CSC381/481
Outline • Chapter 3: Image Enhancement in the Spatial Domain • Introduction (Section 3.1) • Enhancement by point processing (Section 3.2): • Image negatives • Log transformations • Power-law transformations • Piecewise-linear transformations • Histogram Processing (Section 3.3) • Final Projects discussion Daniela Stan - CSC381/481
Introduction • Image Enhancement procedures are techniques used to achieve a subjective improvement in image “quality” for a specific application (problem-oriented). • Typical applications: • noise removal • geometric correction • smoothing • sharpening • edge enhancement or extraction. • Usually ad hoc procedures. • Image Enhancement: • in the Spatial Domain (pixel operators) • the Frequency Domain (frequency filtering). Daniela Stan - CSC381/481
Spatial Domain Methods • Procedures that operate directly on the aggregate/neighborhood of pixels composing an image • A neighborhood about (x,y) is defined by using a square (or rectangular) subimage area centered at (x,y). Daniela Stan - CSC381/481
Spatial Domain Methods • When the neighborhood is 1 x 1 then g depends only on the value of f at (x,y) and T becomes a gray-level transformation (also called an intensity or mapping) function: s=T(r) r,s: gray levels of f(x,y) and g(x,y) at any point (x,y) • r denotes the pixel intensity before processing • s denotes the pixel intensity after processing. • These intensity transformations are also called point processing techniques. Daniela Stan - CSC381/481
Enhancement by Point Processing • The following methods are based only on the intensity of single pixels. • Image negatives • Log transformations • Power-law transformations • Piecewise-Linear Transformation Functions: • Contrast stretching • Gray-level slicing • Bit-plane slicing Daniela Stan - CSC381/481
Image Enhancement in the Spatial Domain Linear: Negative, Identity Logarithmic: Log, Inverse Log Power-Law: nth power, nth root Daniela Stan - CSC381/481
Image Negatives • Are obtained by using the transformation function s=T(r). • Function T reverses the order from black to white so that the intensity of the output image decreases as the intensity of the input increases. [0,L-1] the range of gray levels S= L-1-r Daniela Stan - CSC381/481
Image Enhancement in the Spatial Domain Medical applications: much easier to analyze the breast tissue in the negative image Daniela Stan - CSC381/481
Log Transformations s = c log(1+r) c: constant, r >=0 • Compresses the dynamic range of images with large variations in pixel values Daniela Stan - CSC381/481
Piecewise-Linear Transformation Functions:Contrast Stretching • To increase the dynamic range of the gray levels in the image being processed. Daniela Stan - CSC381/481
Contrast Stretching • The locations of (r1,s1) and (r2,s2) control the shape of the transformation function. • If r1= s1 and r2= s2 the transformation is a linear function and produces no changes. • If r1=r2, s1=0 and s2=L-1, the transformation becomes a thresholding function that creates a binary image. Daniela Stan - CSC381/481
Image Enhancement in the Spatial Domain Contrast Stretching Thresholding Daniela Stan - CSC381/481
Contrast Stretching • More on function shapes: • Intermediate values of (r1,s1) and (r2,s2) produce various degrees of spread in the gray levels of the output image, thus affecting its contrast. • Generally, r1≤r2 and s1≤s2 is assumed. Daniela Stan - CSC381/481
Image Enhancement in the Spatial Domain Low contrast image High contrast image Daniela Stan - CSC381/481
Spatial Domain Methods • Mask processing or filtering: when the values of f in a predefined neighborhood of (x,y) determine the value of g at (x,y). • Through the use of masks (or kernels, templates, or windows, or filters). • More in the next lecture when we discuss about Basics of Spatial filtering (Section 3.5) Daniela Stan - CSC381/481
2 4 1 2 6 2 2 4 1 9 2 3 4 4 4 9 2 3 7 2 9 7 6 7 7 2 9 5 2 3 6 1 5 7 4 2 5 1 2 Example of the use of a mask Step 1: Move the window to the first location where we want to compute the average value and then select only pixels inside the window. Step 2: Compute the average value Sub image p Step 3: Place the result at the pixel in the output image Original image 4.3 Step 4: Move the window to the next location and go to Step 2 Output image Daniela Stan - CSC381/481
Histogram Processing • The histogram of a digital image with gray levels from 0 to L-1 is a discrete function h(rk)=nk, where: • rk is the kth gray level • nk is the # pixels in the image with that gray level • n is the total number of pixels in the image • k = 0, 1, 2, …, L-1 • Normalized histogram: p(rk)=nk/n • sum of all components = 1 To visualize the histogram of a digital image, we plot pr(rk) versus rk Daniela Stan - CSC381/481
Image Enhancement in the Spatial Domain The shape of the histogram of an image does provide useful info about the possibility for contrast enhancement. Daniela Stan - CSC381/481
Types of Histogram Processing • Histogram equalization • Histogram matching (specification) • Local enhancement Daniela Stan - CSC381/481
Histogram Equalization • As mentioned above, for gray levels that take on discrete values, we deal with probabilities: pr(rk)=nk/n, k=0,1,.., L-1 • The plot of pr(rk) versus rk is called a histogram and the technique used for obtaining a uniform histogram is known as histogram equalization (or histogram linearization). Daniela Stan - CSC381/481
Histogram Equalization (HE) • The technique used for obtaining a uniform histogram is known as histogram equalization (or histogram linearization). • Histogram equalization(HE) results are similar to contrast stretching but offer the advantage of full automation, since HE automatically determines a transformation function to produce a new image with a uniform histogram. where pr(rk)=nk/n, k=0,1,.., L-1 Daniela Stan - CSC381/481
Local Enhancement • When it is necessary to enhance details over smaller areas, then we need to devise transformation functions based on the gray-level distribution in the neighborhood of every pixel • The procedure is: • 1.Define a square (or rectangular) neighborhood and move the center of this area from pixel to pixel. • 2. At each location, the histogram of the points in the neighborhood is computed and either a histogram equalization or histogram specification transformation function is obtained. • 3. This function is finally used to map the gray level of the pixel centered in the neighborhood. The center is then moved to an adjacent pixel location and the procedure is repeated. Daniela Stan - CSC381/481