CSC589 Introduction to Computer Vision Lecture 9 Sampling, Gaussian Pyramid Bei Xiao.

Slides:



Advertisements
Similar presentations
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Advertisements

Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
CS 691 Computational Photography Instructor: Gianfranco Doretto Frequency Domain.
Ted Adelson’s checkerboard illusion. Motion illusion, rotating snakes.
CS 691 Computational Photography
Computational Photography: Sampling + Reconstruction Connelly Barnes Slides from Alexei Efros and Steve Marschner.
Pyramids and Texture. Scaled representations Big bars and little bars are both interesting Spots and hands vs. stripes and hairs Inefficient to detect.
Thinking in Frequency Computer Vision Brown James Hays Slides: Hoiem, Efros, and others.
Computer Vision University of Illinois Derek Hoiem
Linear Filtering – Part II Selim Aksoy Department of Computer Engineering Bilkent University
Computational Photography CSE 590 Tamara Berg Filtering & Pyramids.
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
Image transformations, Part 2 Prof. Noah Snavely CS1114
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Immagini e filtri lineari. Image Filtering Modifying the pixels in an image based on some function of a local neighborhood of the pixels
Image Sampling Moire patterns
Linear filtering. Overview: Linear filtering Linear filters Definition and properties Examples Gaussian smoothing Separability Applications Denoising.
CSCE 641 Computer Graphics: Fourier Transform Jinxiang Chai.
The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall 2011 Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve.
CPSC 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Templates, Image Pyramids, and Filter Banks Computer Vision James Hays, Brown Slides: Hoiem and others.
Computer Vision - A Modern Approach Set: Pyramids and Texture Slides by D.A. Forsyth Scaled representations Big bars (resp. spots, hands, etc.) and little.
The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall 2008 Somewhere in Cinque Terre, May 2005 Many slides borrowed from Steve.
Computational Photography: Fourier Transform Jinxiang Chai.
Slides from Alexei Efros, Steve Marschner Filters & fourier theory.
Image Sampling Moire patterns -
1 Image Filtering Slides by Steve Seitz. 2 Salvador Dali, “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 3 Ravi Ramamoorthi
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
CSE 185 Introduction to Computer Vision Image Filtering: Frequency Domain.
Slide credit Fei Fei Li. Image filtering Image filtering: compute function of local neighborhood at each position Really important! – Enhance images.
Applications of Image Filters Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/04/10.
CSC589 Introduction to Computer Vision Lecture 8
Recap of Friday linear Filtering convolution differential filters
Computer Vision James Hays Thinking in Frequency Computer Vision James Hays Slides: Hoiem, Efros, and others.
CSC589 Introduction to Computer Vision Lecture 7 Thinking in Frequency Bei Xiao.
CS 1699: Intro to Computer Vision Texture and Other Uses of Filters Prof. Adriana Kovashka University of Pittsburgh September 10, 2015 Slides from Kristen.
CSC 589 Introduction to Computer Vision Lecture 2 linear filtering Instructor: Bei Xiao Thursday, January 15th Salvador Dali “Gala Contemplating the Mediterranean.
CSE 185 Introduction to Computer Vision Image Filtering: Frequency Domain.
Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/03/15.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
Thinking in Frequency Computational Photography University of Illinois Derek Hoiem 09/01/15.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
Templates, Image Pyramids, and Filter Banks
Recap of Monday linear Filtering convolution differential filters filter types boundary conditions.
Lecture 5: Fourier and Pyramids
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
Slide credit Fei Fei Li.
Advanced Computer Graphics
Prof. Adriana Kovashka University of Pittsburgh September 14, 2016
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
Computer Vision Brown James Hays 09/16/11 Thinking in Frequency Computer Vision Brown James Hays Slides: Hoiem, Efros, and others.
Sampling, Template Matching and Pyramids
- photometric aspects of image formation gray level images
Linear Filtering – Part II
Department of Computer Engineering
Image Pyramids and Applications
More Image Manipulation
CSCE 643 Computer Vision: Thinking in Frequency
Oh, no, wait, sorry, I meant, welcome to the implementation of 20th-century science fiction literature, or a small part of it, where we will learn about.
Department of Computer Engineering
Image Resampling & Interpolation
Thinking in Frequency Computational Photography University of Illinois
Templates and Image Pyramids
Presentation transcript:

CSC589 Introduction to Computer Vision Lecture 9 Sampling, Gaussian Pyramid Bei Xiao

What we have learned so far Image contrast, histograms, and basic manipulation Image Convolution Image Filters Fourier transform Filtering in Fourier transform

What we want to achieve in this course? Basic image processing (extract contours, boundaries, edges). Basic understanding of image formation (camera models, projection) Basic skills of image synthesizing (textures, panorama images, image hybrid, stereo) Basic understanding of image features (HOG, SIFT, optical flow). Basic exposure of the state of the art computer vision applications. (multiple object tracking, segmentation, 3D construction, recognition of objects and faces) Application of machine learning in CV (Clustering, Bayesian, deep learning intro). Basic mathematical concepts behind image processing (Fourier transform, convolution, probability and statistics ). Brushing up numerical Python skills If you have made progress in at least 4 out of the above points, it is a success!

Exercise 1 Download the FFTAnalysis.py from blackboard. Use the einstein.png Right now the image removes low frequency (center) of the images. Can you modify the code that you are removing the high frequency (low pass) the image? You can do this either by directly modifying the DFT or use a filter.

Exercise 1 mask = abs(fshift) < fshift[mask]= 10

Exercise 2 Download the Cheetha and Zebra images DFT both images in Fourier domain and compute magnitude and phase. I have already did this in the helper code PhaseandMagnitude.py You can compute phase and magnitude as this: magnitude_zebra = 30*np.log(np.abs(fshift)) phase_zebra = np.angle(fshift) Reconstruct the image with Cheetha phase and Zebra magnitude and vice versa. You have to do this yourself!

Inverse Fourier Transform Forward Fourier: img = misc.imread('cheetah.png',flatten=1) f = np.fft.fft2(img) fshift = np.fft.fftshift(f) magnitude_cheetah = np.abs(fshift) phase_cheetah = np.angle(fshift) Inverse Fourier: re = magnitude_zebra*np.cos(phase_zebra) im = magnitude_zebra*np.sin(phase_zebra) F = re+1j*im f_ishift = np.fft.ifftshift(F) img_back = np.fft.ifft2(f_ishift) img_back = np.abs(img_back) #img_back= misc.bytescale(img_back) print img_back.min(), img_back.max() plt.imshow(np.uint8(img_back), cmap='gray')

Filtering in frequency domain FFT Inverse FFT = Slide: Hoiem

Filters in Fourier Domain Mean filterGaussian Filter

Why does a lower resolution image still make sense to us? What do we lose? Image: Sampling

Throw away every other row and column to create a 1/2 size image Subsampling by a factor of 2

Aliasing problem 1D example (sinewave):

1D example (sinewave): Aliasing problem Sample at 2Hz

1D example (sinewave): Aliasing problem Sample at 3Hz

1D example (sinewave): Aliasing problem Sample at 1.5 Hz

1D example (sinewave): Aliasing problem Sample at 1.5 Hz

1D example (sinewave): Aliasing problem

Sub-sampling may be dangerous…. Characteristic errors may appear: – “Wagon wheels rolling the wrong way in movies” – “Checkerboards disintegrate in ray tracing” – “Striped shirts look funny on color television” Source: D. Forsyth Aliasing problem

Aliasing in video Slide by Steve Seitz Visual illusion:

Aliasing in video

Source: A. Efros Aliasing in graphics

Sampling and aliasing

When sampling a signal at discrete intervals, the sampling frequency must be  2  f max f max = max frequency of the input signal This will allows to reconstruct the original perfectly from the sampled version good bad vvv Nyquist-Shannon Sampling Theorem

Anti-aliasing Solutions: Sample more often Get rid of all frequencies that are greater than half the new sampling frequency – Will lose information – But it’s better than aliasing – Apply a smoothing filter

Algorithm for downsampling by factor of 2 1.Start with image(h, w) 2.Apply low-pass filter im_blur = ndimage. filters_ gaussian_filter (image, 7) 3.Sample every other pixel im_small = im_blur[::2; ::2];

Text images

Anti-aliasing Forsyth and Ponce 2002

Subsampling without pre-filtering 1/4 (2x zoom) 1/8 (4x zoom) 1/2 Slide by Steve Seitz

Subsampling with Gaussian pre-filtering G 1/4G 1/8Gaussian 1/2 Slide by Steve Seitz

Why do we get different, distance-dependent interpretations of hybrid images? ?

Salvador Dali invented Hybrid Images? Salvador Dali “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976

Campbell-Robson contrast sensitivity curve

Hybrid Image in FFT Hybrid ImageLow-passed ImageHigh-passed Image

Why do we get different, distance-dependent interpretations of hybrid images? ? Perception

Things to Remember Sometimes it makes sense to think of images and filtering in the frequency domain – Fourier analysis Can be faster to filter using FFT for large images (N logN vs. N 2 for auto- correlation) Images are mostly smooth – Basis for compression Remember to low-pass before sampling

Practice question 1.Match the spatial domain image to the Fourier magnitude image 1 54 A 3 2 C B D E

Take home reading Aliasinghttp://redwood.berkeley.edu/bruno/n pb261/aliasing.pdfhttp://redwood.berkeley.edu/bruno/n pb261/aliasing.pdf Fourier Transform: Chapter 3.4 Next class: Template Matching, Gaussian Pyramid, Filter banks and Texture