DREAM PLAN IDEA IMPLEMENTATION 1. 2 3 Introduction to Image Processing Dr. Kourosh Kiani

Slides:



Advertisements
Similar presentations
Environmental Remote Sensing GEOG 2021
Advertisements

Basis beeldverwerking (8D040) dr. Andrea Fuster dr. Anna Vilanova Prof.dr.ir. Marcel Breeuwer Filtering.
1 DREAM PLAN IDEA IMPLEMENTATION. 2 3 Introduction to Image Processing Dr. Kourosh Kiani
Computer Vision Lecture 7: The Fourier Transform
DREAM PLAN IDEA IMPLEMENTATION Introduction to Image Processing Dr. Kourosh Kiani
Linear Filtering – Part I Selim Aksoy Department of Computer Engineering Bilkent University
Spatial Filtering (Chapter 3)
Motion illusion, rotating snakes. Slide credit Fei Fei Li.
DREAM PLAN IDEA IMPLEMENTATION Introduction to Image Processing Dr. Kourosh Kiani
Lecture 4 Linear Filters and Convolution
Image Filtering CS485/685 Computer Vision Prof. George Bebis.
1 Image filtering Hybrid Images, Oliva et al.,
Lecture 1: Images and image filtering
1 Image Filtering Readings: Ch 5: 5.4, 5.5, 5.6,5.7.3, 5.8 (This lecture does not follow the book.) Images by Pawan SinhaPawan Sinha formal terminology.
CS443: Digital Imaging and Multimedia Filters Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University Spring 2008 Ahmed Elgammal Dept.
1 Image filtering Images by Pawan SinhaPawan Sinha.
Image Analysis Preprocessing Arithmetic and Logic Operations Spatial Filters Image Quantization.
Linear filtering.
CS4670: Computer Vision Kavita Bala Lecture 7: Harris Corner Detection.
Linear Filtering About modifying pixels based on neighborhood. Local methods simplest. Linear means linear combination of neighbors. Linear methods simplest.
DREAM PLAN IDEA IMPLEMENTATION Introduction to Image Processing Dr. Kourosh Kiani
Most slides from Steve Seitz
CS 376b Introduction to Computer Vision 02 / 26 / 2008 Instructor: Michael Eckmann.
Presentation Image Filters
Machine Vision ENT 273 Image Filters Hema C.R. Lecture 5.
Spatial Filtering: Basics
Digital Image Processing Image Enhancement Part IV.
Lecture 03 Area Based Image Processing Lecture 03 Area Based Image Processing Mata kuliah: T Computer Vision Tahun: 2010.
Image Processing Edge detection Filtering: Noise suppresion.
Image processing Fourth lecture Image Restoration Image Restoration: Image restoration methods are used to improve the appearance of an image.
Image Filtering Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/02/10.
Digital Image Processing Lecture 10: Image Restoration March 28, 2005 Prof. Charlene Tsai.
Chapter 5: Neighborhood Processing
Linear filtering. Motivation: Noise reduction Given a camera and a still scene, how can you reduce noise? Take lots of images and average them! What’s.
Machine Vision ENT 273 Image Filters Hema C.R. Lecture 5.
Digital Image Processing Lecture 10: Image Restoration
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 3 Intensity Transformations.
CSC508 Convolution Operators. CSC508 Convolution Arguably the most fundamental operation of computer vision It’s a neighborhood operator –Similar to the.
Intelligent Vision Systems ENT 496 Image Filtering and Enhancement Hema C.R. Lecture 4.
CS654: Digital Image Analysis
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
Sejong Univ. CH3. Area Processes Convolutions Blurring Sharpening Averaging vs. Median Filtering.
CS 691B Computational Photography
CSE 6367 Computer Vision Image Operations and Filtering “You cannot teach a man anything, you can only help him find it within himself.” ― Galileo GalileiGalileo.
Linear filtering. Motivation: Image denoising How can we reduce noise in a photograph?
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
CSE 185 Introduction to Computer Vision Image Filtering: Spatial Domain.
Lecture 1: Images and image filtering CS4670/5670: Intro to Computer Vision Noah Snavely Hybrid Images, Oliva et al.,
Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels.
Filters– Chapter 6. Filter Difference between a Filter and a Point Operation is that a Filter utilizes a neighborhood of pixels from the input image to.
Image Processing Lab Section 28/3/2016 Prepared by Mahmoud Abdelsatar Demonstrator at IT Dep. Faculty of computers and information Assuit University.
Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.
Miguel Tavares Coimbra
Fundamentals of Spatial Filtering:
Filtering – Part I Gokberk Cinbis Department of Computer Engineering
Histogram Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has.
Recap from Wednesday Spectra and Color Light capture in cameras and humans.
Image filtering Images by Pawan Sinha.
Image filtering Images by Pawan Sinha.
Motion illusion, rotating snakes
Spatial operations and transformations
Digital Image Processing Week IV
Most slides from Steve Seitz
Department of Computer Engineering
Intensity Transformation
Image Filtering Readings: Ch 5: 5. 4, 5. 5, 5. 6, , 5
Most slides from Steve Seitz
Lecture 7 Spatial filtering.
Spatial operations and transformations
Presentation transcript:

DREAM PLAN IDEA IMPLEMENTATION 1

2

3 Introduction to Image Processing Dr. Kourosh Kiani Web: Present to: Amirkabir University of Technology (Tehran Polytechnic) & Semnan University

Lecture 05 4 Mask processing or Spatial filter

 Spatial Domain  Frequency Domain (i.e., uses Fourier Transform)

 Convert a given pixel value to a new pixel value based on some predefined function.

 Need to define: 1. Area shape and size 2. Operation output image

Area shape is typically defined using a rectangular mask. Area size is determined by mask size. e.g., 3x3 or 5x5 Mask size is an important parameter!

 Neighborhood operation work with values of the image pixels and corresponding values of a sub image.  The sub image is called:  Filter  Mask  Kernel  Template  Window  The values in a filter sub image are referred to as coefficients, rather than pixels.  Our focus will be on masks of odd sizes, e.g. 3x3, 5x5,…

 Typically linear combinations of pixel values.  e.g., weight pixel values and add them together.  Different results can be obtained using different weights.  e.g., smoothing, sharpening, edge detection). mask

mask 8 Modified image dataLocal image neighborhood

 Correlation  Convolution

 A filtered image is generated as the center of the mask visits every pixel in the input image. g(i,j) h(i,j) f(i,j) filtered image n x n mask

0 0 0 ……………………….0 Option 1: Zero padding Option 2: Wrap around Option 3: Reflection *

 Commutative: A*B = B*A  Associative: (A*B)*C = A*(B*C)  Linear: A*(  B+  C)=  A*B+  A*B  Shift-Invariant A*B(x-x 0,y-y o )= (A*B) (x-x 0,y-y o )

0 1 0 A(x)*  (x) = A(x) A(x,y)*  (x,y) = A(x,y)

 Due to shift-invariance: A(x,y)*  (x-x 0,y-y 0 ) = A(x-x 0,y-y 0 )  (x,y)  (x-1,y-1) A *  (x-1,y-1) = A(x-1,y-1) (Zero padding) A(x-1,y-1) (Wrap around) =

 Suppose x and y are two n-dimensional vectors:  The dot product of x with y is defined as:  Correlation generalizes the notion of dot product using vector notation: x y θ

cos(θ) measures the similarity between x and y Normalized correlation (i.e., divide by lengths)

Measure the similarity between images or parts of images. = mask

Traditional correlation cannot handle changes due to: size orientation shape (e.g., deformable objects). ?

 Same as correlation except that the mask is flipped, both horizontally and vertically. h * f = f * h Notation: H V For symmetric masks (i.e., h(i,j)=h(-i,-j)), convolution is equivalent to correlation!

Correlation: Convolution:

A = [ ; ; ] A = H = [1 2 3;4 5 6;7 8 9] H = Correlation result = (10 x 1) + (20 x 2) + (30 x 3) + (40 x 4) + (50 x 5) + (60 x 6) + (70 x 7) + (80 x 8) + (90 x 9) = 2850 Convolution and Correlation in Image Processing is quite similar except that the kernel are rotated 180 degree between these 2 operation. Convolution and Correlation in Image Processing

A = [ ; ; ] A = H = [1 2 3;4 5 6;7 8 9] H = H180= Convolution and Correlation in Image Processing Convolution result = (10 x 9) + (20 x 8) + (30 x 7) + (40 x 6) + (50 x 5) + (60 x 4) + (70 x 3) + (80 x 2) + (90 x 1) = 1650

In the real Image convolution and correlation, the kernel is sliding over every single pixel and performs above operation to form a new image Convolution and Correlation in Image Processing

A = [ ; ; ] A = H = [1 2 3;4 5 6;7 8 9] H = corr_result = imfilter(A,H) corr_result = >conv_result = imfilter(A,rot90(H,2)) conv_result = Convolution and Correlation in Image Processing

Most of the time the choice of using the convolution and correlation is up to the preference of the users, and it is identical when the kernel is symmetrical. For example, a smoothing filter which is: Convolution and Correlation in Image Processing

Standard average Weighted average

kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result)

Origin kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) Blur

Origin kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) Blur

Motion Blur Origin kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) Motion blur is achieved by blurring in only 1 direction

Find Edges Origin kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) A filter of 5x5 instead of 3x3 was chosen, because the result of a 3x3 filter is too dark on the current image. Note that the sum of all the elements is 0 now, which will result in a very dark image where only the edges it detected are colored.

Origin kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) Sharpen

kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) Extra Edge Here's a filter that shows the edges excessively Origin

kk=imread(‘nice.jpg'); corr_result = imfilter(kk,H); imshow(corr_result) Origin Emboss An emboss filter gives a 3D shadow effect to the image, the result is very useful for a bumpmap of the image

, 10, 20, 20, 25, 25, 30, 30, 250 min max  Min filter:  Max filter Min & Max Filters

, 10, 20, 20, 25, 25, 30, 30, 250 median The Median Filter

Noisy image 3x3 average 5x5 average 7x7 average median

 Filtering is often used to remove noise from images  Sometimes a median filter works better than an averaging filter Original Image With Noise Image After Averaging Filter Image After Median Filter

Original Gaussian noise salt & pepper

Median filter 3x3 window Gaussian blur std=1.5 Salt & Pepper Noise:

Median filter 5x5 window Gaussian blur std=1.5 Gaussian Noise:

Noise from Glass effectRemove noise by median filter

 Separable Filter

 Convolution with self is another Gaussian Special case: convolving two times with Gaussian kernel of width is equivalent to convolving once with kernel of width * =

Separable kernel: a 2D Gaussian can be expressed as the product of two 1D Gaussians.

 2D Gaussian convolution can be implemented more efficiently using 1D convolutions:

row get a new image I r Convolve each column of I r with g

2D convolution (center location only) The filter factors into a product of 1D filters: Perform convolution along rows: Followed by convolution along the remaining column: * * = = O(n 2 ) O(2n)=O(n)

 Complexity of non-separable filter: N 2  Complexity of separable filter: 2N

 Depends on the application.  Usually by sampling certain functions and their derivatives. Gaussian 1 st derivative of Gaussian 2 nd derivative of Gaussian Good for image smoothing Good for image sharpening

 Sum of weights affects overall intensity of output image.  Positive weights one  Normalize them such that they sum to one.  Both positive and negative weights zero  Should sum to zero (but not always) 1/91/16

Idea: replace each pixel by the average of its neighbors. Useful for reducing noise and unimportant details. The size of the mask controls the amount of smoothing.

 Trade-off: noise vs blurring and loss of detail. 3x35x57x7 15x1525x25 original

 Idea: replace each pixel by a weighted average of its neighbors  Mask weights are computed by sampling a Gaussian function Note: weight values decrease with distance from mask center!

 The Gaussian kernel is separable and symmetric.  To construct the kernel we must sample and quantize! (basically, we “image” the function)  The kernel below is an example where sigma =

mask size depends on σ : σ determines the degree of smoothing! σ=3

= 30 pixels= 1 pixel = 5 pixels = 10 pixels

Averaging Gaussian

 Idea: compute intensity differences in local image regions.  Useful for emphasizing transitions in intensity (e.g., in edge detection). 1 st derivative of Gaussian

Zooming as a Convolution Application Example Zero interlace Convolve The value of a pixel in the enlarged image is the average of the value of around pixels. The difference between insert 0 and original value of pixels is “smoothed” by convolution Original Image ( ) ÷( ) = 13/9

Zooming as a Convolution Application Example

Questions? Discussion? Suggestions ?

81