Dr. Z. R. Ghassabi Tehran shomal University Spring 2015 Digital Image Processing Session 3 1.

Slides:



Advertisements
Similar presentations
Digital Image Processing
Advertisements

Spatial Filtering (Chapter 3)
Image Processing Lecture 4
CS & CS Multimedia Processing Lecture 2. Intensity Transformation and Spatial Filtering Spring 2009.
Spatial Filtering.
Chapter 3 Image Enhancement in the Spatial Domain.
Lecture 6 Sharpening Filters
Chapter - 2 IMAGE ENHANCEMENT
Intensity Transformations (Chapter 3)
EE 4780 Image Enhancement. Bahadir K. Gunturk2 Image Enhancement The objective of image enhancement is to process an image so that the result is more.
Digital Image Processing
ECE 472/572 - Digital Image Processing
Image Enhancement in the Spatial Domain II Jen-Chang Liu, 2006.
Image Enhancement in the Spatial Domain
Image (and Video) Coding and Processing Lecture 5: Point Operations Wade Trappe.
Intensity Transformations
Digital Image Processing
Chapter 4: Image Enhancement
Digital Image Processing & Pattern Analysis (CSCE 563) Intensity Transformations Prof. Amr Goneid Department of Computer Science & Engineering The American.
Lecture 4 Digital Image Enhancement
Digital Image Processing In The Name Of God Digital Image Processing Lecture3: Image enhancement M. Ghelich Oghli By: M. Ghelich Oghli
Digital Image Processing
Chapter 3: Image Enhancement in the Spatial Domain
Face Recognition and Biometric Systems 2005/2006 Filters.
Image Enhancement To process an image so that the result is more suitable than the original image for a specific application. Spatial domain methods and.
6/9/2015Digital Image Processing1. 2 Example Histogram.
Digital Image Processing
Image Enhancement.
Lecture 2. Intensity Transformation and Spatial Filtering
Chapter 3 Image Enhancement in the Spatial Domain.
ECE 472/572 - Digital Image Processing Lecture 4 - Image Enhancement - Spatial Filter 09/06/11.
Lecture 4 Digital Image Enhancement
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 3 Intensity Transformations.
Chap2 Image enhancement (Spatial domain)
 Image Enhancement in Spatial Domain.  Spatial domain process on images can be described as g(x, y) = T[f(x, y)] ◦ where f(x,y) is the input image,
Introduction to Image Processing Grass Sky Tree ? ? Review.
Digital Image Processing
Digital Image Processing Image Enhancement Part IV.
CS654: Digital Image Analysis Lecture 17: Image Enhancement.
Chapter 3 Image Enhancement in the Spatial Domain.
DIGITAL IMAGE PROCESSING
CIS 601 Image ENHANCEMENT in the SPATIAL DOMAIN Dr. Rolf Lakaemper.
Image Enhancement in the Spatial Domain (MATLAB)
Digital Image Processing Image Enhancement in the Spatial Domain.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods  Process an image so that the result will be more suitable.
Chapter 5: Neighborhood Processing
Spatial Filtering.
Image Enhancement ارتقاء تصویر Enhancement Spatial Domain Frequency Domain.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 3 Intensity Transformations.
CIS 601 – 04 Image ENHANCEMENT in the SPATIAL DOMAIN Longin Jan Latecki Based on Slides by Dr. Rolf Lakaemper.
Image Subtraction Mask mode radiography h(x,y) is the mask.
İmage enhancement Prepare image for further processing steps for specific applications.
Image enhancement using MATLAB Digital Image Processing 2014 Fall NTU 1.
Lecture Reading  3.1 Background  3.2 Some Basic Gray Level Transformations Some Basic Gray Level Transformations  Image Negatives  Log.
EE 7730 Image Enhancement. Bahadir K. Gunturk2 Image Enhancement The objective of image enhancement is to process an image so that the result is more.
Digital Image Processing Image Enhancement in Spatial Domain
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 3 Image Enhancement in the Spatial Domain Chapter.
Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.
Image Enhancement in the Spatial Domain.
Fundamentals of Spatial Filtering:
IMAGE ENHANCEMENT TECHNIQUES
ECE 692 – Advanced Topics in Computer Vision
Intensity Transformations and Spatial Filtering
CIS 350 – 3 Image ENHANCEMENT SPATIAL DOMAIN
Image Enhancement in the Spatial Domain
Lecture 3 (2.5.07) Image Enhancement in Spatial Domain
Digital Image Processing
Image Enhancement – Simple Intensity Processing
The spatial domain processes discussed in this chapter are denoted by the expression
Image Enhancement in the Spatial Domain
Presentation transcript:

Dr. Z. R. Ghassabi Tehran shomal University Spring 2015 Digital Image Processing Session 3 1

Outline Introduction Digital Image Fundamentals Intensity Transformations and Spatial Filtering Filtering in the Frequency Domain Image Restoration and Reconstruction Color Image Processing Wavelets and Multi resolution Processing Image Compression Morphological Operation Object representation Object recognition 2

Outline of Chapter 3 Basic Intensity Transformation Functions Negative, Log, Gamma Piecewise-Linear Transformation Functions Contrast stretching, contrast slicing, bit-plane slicing Histogram Processing Histogram Stretching, Histogram Shrink, Histogram Sliding, Histogram equalization, adaptive local histogram, histogram matching, local histogram equalization, histogram statistics Fundamentals of Spatial Filtering Smoothing Spatial Filters, Sharpening Spatial Filters, Combining Spatial Enhancement Tools

Image Enhancement Methods – Spatial Domain: Linear Nonlinear – Frequency Domain: Linear Nonlinear

Image Enhancement Spatial Domain

Image Enhancement Example: Image Subtraction for enhancing Differences

Image Enhancement Frequency Domain

Image Transforms

Image Enhancement in spatial Domain (Transformation) For 1  1 neighborhood: – Contrast Enhancement/Stretching/Point process For w  w neighborhood: – Filtering/Mask/Kernel/Window/Template Processing

Image Enhancement in spatial Domain Input gray level, r Output gray level, s Negative Log nth root Identity nth power Inverse Log Some Basic Intensity Transformation Functions

Image Negatives Image Negatives: L x 0 L y y=L-x

Image Negatives

Log Transformation

c=100 L x 0 y

Log Transformation Range Compression

Power-Law(Gamma) Transformations

Gamma Correction:

Power-Law(Gamma) Transformations (Effect of decreasing gamma)

Power-Law(Gamma) Transformations (Effect of increasing gamma)

Power-Law(Gamma) Transformations Medical Example

Piecewise-Linear Transformation Functions Contrast Stretching Contrast slicing Bite-Plane slicing

Contrast Stretching L x 0 ab yaya ybyb y

Contrast stretching Original C. S. THR.

Contrast Stretching

L x 0ab y Clipping:

MATLAB Tutorial imadjust(I, [low-in, high-in],[low-out, high-out]) low-in high-in low-out high-out Output Image Input Image

مناسب ترین مقدار چیست؟ MATLAB Tutorial imadjust(I, [low-in, high-in],[low-out, high-out], gamma) imadjust(I, [0.1, 0.7],[0, 1], gamma) low-in high-in low-out high-out Output Image Input Image

MATLAB Tutorial Use Min and Max gray-levels – Low-in: Double(min(I(:))/255) – max-in: Double(max(I(:))/255) Use stretchlim(I) imadjust(I,stretchlim(I),[low-out, high-out], gamma)

MATLAB Tutorial low-in high-in low-out high-out Output Image Input Image

Gray-level Slicing

Gray-level Slicing

Gray-level Slicing

Bit-plane Slicing Highlighting the contribution made to total image appearance by specific bits Suppose each pixel is represented by 8 bits Higher-order bits contain the majority of the visually significant data Useful for analyzing the relative importance played by each bit of the image

Bit-plane Slicing

The (binary) image for bit-plane 7 can be obtained by processing the input image with a thresholding gray-level transformation. Map all levels between 0 and 127 to 0 Map all levels between 129 and 255 to 255

Bit-plane Slicing Fractal Image

Bit-plane 7Bit-plane 6 Bit-plane 5Bit-plane 4Bit-plane 3 Bit-plane 2Bit-plane 1Bit-plane 0

Bit-plane Slicing

Histogram Processing Enhancement based on statistical Properties: Local, Global Histogram Definition h(r k )=n k Where r k is the kth gray level and n k is the number of pixels in the image having gray level r k Normalized histogram: P(r k )=n k /n Histogram of an image represents the relative frequency of occurrence of various gray levels in the image

Histogram Example

MATLAB Tutorial Hist(double(I(:)),50) imhist(I)

Histogram Examples Histogram Visual Meaning: – Dark – Bright – Low Contrast – High Contrast

Histogram Modification Histogram Stretching Histogram Shrink Histogram Sliding

Histogram Stretching

Histogram Shrinking

Histogram Shrinking

Histogram Sliding

Histogram Equalization PDF تناظر بین x و U اکیدا صعودی بودن CDF هست. برای اکیدا صعودی بودن تابع CDF باید مشتق آن یعنی PDF همیشه بزرگتر از صفر باشد. F: X >[0,1] U=F(X) چون تابع یک به یک هست پس معکوس هم دارد. X=F -1 (U) x 1 0 CDF U متغیر تصادفی

Histogram Equalization

توزیع آماری u مستقل از مقدار x و همیشه یکنواخت بین 0 و یک هست. u~U(0,1) X های ورودی را بین 0 و یک توزیع میکند. هیستوگرام U

Histogram Equalization r 1 0 CDF S=T(r) PDF PrPr سطح زیر منحنی S~U(0,1) هیستوگرام U هیستوگرام تصویر ورودی روشنایی تصویر ورودی r

Histogram Equalization r 1 0 CDF S=T(r) PDF PrPr روشنایی تصویر ورودی r هیستوگرام تصویر ورودی

Histogram Equalization

Histogram Equalization

MATLAB Tutorial histeq(I)

Histogram Equalization

Adaptive Contrast Enhancement (ACE)

MATLAB Tutorial I2=adapthisteq( I,'clipLimit',0.015,'Distribution','rayleigh'); clear all; close all; clc; [f1, pp1] = uigetfile('*.jpg', 'Pick a image'); I1Name = sprintf('%s%s',pp1,f1); I=imread(I1Name); if ndims(I)==3 I1=rgb2gray(I); end I2=adapthisteq( I1,'clipLimit',0.015,'Distribution','rayleigh'); figure(); subplot(1,2,1); imshow(I1); subplot(1,2,2); imshow(I2);

Adaptive Histogram Equalization

Histogram Matching prpr pzpz Histeq(I,hgram)

Histogram matching: Obtain the histogram of the given image, s=T(r) Precompute a mapped level S k for each level r k Obtain the transformation function G from the given p z (z) Precompute Z k for each value of r k Map r k to its corresponding level S k ; then map level S k into the final level Z k Histogram Matching r S 0 CDF S=T(r) PDF PrPr r هیستوگرام تصویر ورودی 0 pzpz هیستوگرام دلخواه

Histogram Matching (Specification) برای یک تصویر 64*64 هیستوگرام طوری تبدیل شود که دارای مقادیر مشخص شده در شکل b باشد.

Histogram Matching (Specification) S 0 =1, G(z 3 )=1, s >z 3 هر پیکسلی که مقدارش در تصویر تعدیل هیستوگرام یک هست به مقداری برابر سه در هیستوگرام مشخص شده نگاشت می شود.

Image is dominated by large, dark areas, resulting in a histogram characterized by a large concentration of pixels in pixels in the dark end of the gray scale Histogram Matching (Specification)

Notice that the output histogram’s low end has shifted right toward the lighter region of the gray scale as desired. Histogram Matching (Specification)

Desired Initial CDF Modified CDF Histogram Matching (Specification)

Local Histogram Processing a)Original image b)global histogram equalization c)local histogram equalization using 7x7 neighborhood.

Histogram using a local 3*3 neighborhood Local Histogram Processing

Use of histogram statistics for image enhancement: r denotes a discrete random variable P(r i ) denotes the normalized histogram component corresponding to the i th value of r Mean: The n th moment: The second moment: Using Histogram Statistics

Global enhancement: The global mean and variance are measured over an entire image Local enhancement: The local mean and variance are used as the basis for making changes Using Histogram Statistics r s,t is the gray level at coordinates (s,t) in the neighborhood P(r s,t ) is the neighborhood normalized histogram component mean: local variance:

Mapping: E,K 0,K 1,K 2 are specified parameters M G is the global mean D G is the global standard deviation Using Histogram Statistics

A SEM sample images: Using Histogram Statistics

Local Mean Local Var E or one Using Histogram Statistics

Enhanced Images: Using Histogram Statistics

Fundamental of Spatial Filtering

The Mechanics of Spatial Filtering: -a +a -b+b Image size: M×N, x= 0,1,2,…,M-1 and y= 0,1,2,…,N-1 Mask size: m×n, a=(m-1)/2 and b=(n-1)/2 Correlation

Fundamental of Spatial Filtering

Spatial Correlation and Convolution

Vector Representation of Linear Filtering

Smoothing Linear Filters : Noise reduction Smoothing of false contours Reduction of irrelevant detail Smoothing Spatial Filters

Image smoothing with masks of various sizes.

MATLAB Tutorial W=repmat(1/9,3,3); W=1/9*ones(3,3); a=2; W=ones(2*a+1) W=W/sum(W(:)); Img1=imread(‘image1.jpg’); Img2=imfilter(Img1,W);

MATLAB Tutorial Img2=imfilter(Img1,W,’symmetric’);

Order-statistic filters: Max Min Median filter: Replace the value of a pixel by the median of the gray levels in the neighborhood of that pixel  Noise-reduction Order-Static (Nonlinear) Filters

Median Filter

The first-order derivative: The second-order derivative Sharpening Spatial Filters Zero in flat region Non-zero at start of step/ramp region Non-zero along ramp Zero in flat region Non-zero at start/end of step/ramp region Zero along ramp

Sharpening Spatial Filters

Use of second derivatives for enhancement-The Laplacian: Development of the method Sharpening Spatial Filters

Practically use:

Sharpening Spatial Filters

Two L. Mask SEM image a. Mask Result b. Mask Result (Sharper)

Unsharp masking Subtract a blurred version of an image from the image itself f(x,y) : The image, f ̄ (x,y): The blurred image High boost Filtering: Unsharp Masking and Highboost Filtering

Original Laplacian (A=0) Laplacian (A=1) Laplacian (A=1.7) Unsharp Masking and Highboost Filtering

Using first-order derivatives for (nonlinear) image sharpening, The gradient: The gradient: The magnitude is rotation invariant (isotropic) Using First-Order Derivative for (Nonlinear) Image Sharpening - The Gradient

Roberts Cross Gradient Sobel (2  1 for prewitt) and

Using the Gradient for Image Sharpening Sobel Gradient

Bone Scan Laplacian Original +Laplacian Soble of Original Combining Spatial Enhancement Tools

Smoothed Sobel (Orig. + L.)*S.Sobel Orig.+ (Orig. + L.)*S.Sobel Apply Power-Law Combining Spatial Enhancement Tools

Img0=im2double(img0); w=fspecial(type, parameters) W=fspecial(‘disk’,3); W=fspecial(‘gaussian’,101,10); W=fspecial(‘laplacian’,0); W=fspecial(‘log’,10,1); Img1=imfilter(Img0,W); figure();imshow(normalize(Img1)); C=-1; figure();imshow(img0+C*Img1); Wp=fspecial(‘prewitt’); Ws=fspecial(‘prewitt’); Img1=imfilter(Img0,Wp); Img2=imfilter(Img0,Ws); W=0.3*Wp+0.7*Ws; Img1=imfilter(Img0,W); Img1=imfilter(Img0,Wp); Img2=imfilter(Img0,Wp’); Imshow(sqrt(Img1.^2+Img2.^2) MATLAB Tutorial

function XN=Normalize(X) Xmin=min(X(:)); Xmax=max(X(:)); XN=((X-Xmin)/(Xmax-Xmin)).^beta; end MATLAB Tutorial

Img0=im2double(imread(‘….’)); M=3;N=5; Domain=ones(M,N); Img1=ordfilt2(img0,M*N, Domain); Img2=ordfilt2(img0,0, Domain); Img3=ordfilt2(img0,(M+N+1)/2, Domain); figure(); subplot(1,3,1); imshow(Img1); subplot(1,3,2); imshow(Img2); subplot(1,3,3); imshow(Img3); MATLAB Tutorial

Img0=im2double(imread(‘….’)); M=3;N=5; Domain=ones(M,N); Img1=imnoise(img0,’salt & pepper’); Img2=ordfilt2(img1,(M+N+1)/2, Domain); Img3=medfilt2(img1,[M N]); figure(); subplot(2,2,1); imshow(Img0); subplot(2,2,2); imshow(Img1); subplot(2,2,3); imshow(Img2); subplot(2,2,3); imshow(Img3); MATLAB Tutorial

MATLAB Command: – Image Statistics: means2, std2, corr2, imhist, regionprops – Image Intensity Adjustment: imadjust, histeq, adapthisteq, imnoise – Linear Filter: imfilter, fspecial, conv2, corr2, – Nonlinear filter: medfilt2, ordfilt2,

MATLAB Tutorial

End of Session 3