>>> from numpy import random as r >>> I = r.rand(256,256);

Similar documents
>>> from numpy import random as r >>> I = r.rand(256,256);

CSCI 1290: Comp Photo

Motion illusion, rotating snakes

02/02/10. Image Filtering. Computer Vision CS 543 / ECE 549 University of Illinois. Derek Hoiem

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Prof. Feng Liu. Winter /10/2019

Motivation: Image denoising. How can we reduce noise in a photograph?

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

Motivation: Image denoising. How can we reduce noise in a photograph?

Sampling and Reconstruction

Fourier analysis of images

Image Filtering and Gaussian Pyramids

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

Image filtering, image operations. Jana Kosecka

Images and Filters. EE/CSE 576 Linda Shapiro

Waitlist. We ll let you know as soon as we can. Biggest issue is TAs

Oversubscription. Sorry, not fixed yet. We ll let you know as soon as we can.

Image analysis. CS/CME/BIOPHYS/BMI 279 Fall 2015 Ron Dror

Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

Image Processing for feature extraction

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

Image Enhancement II: Neighborhood Operations

Midterm is on Thursday!

Matlab (see Homework 1: Intro to Matlab) Linear Filters (Reading: 7.1, ) Correlation. Convolution. Linear Filtering (warm-up slide) R ij

Announcements. Image Processing. What s an image? Images as functions. Image processing. What s a digital image?

Linear Filters Tues Sept 1 Kristen Grauman UT Austin. Announcements. Plan for today 8/31/2015. Image noise Linear filters. Convolution / correlation

Image Enhancement in spatial domain. Digital Image Processing GW Chapter 3 from Section (pag 110) Part 2: Filtering in spatial domain

More image filtering , , Computational Photography Fall 2017, Lecture 4

Digital Image Processing

Templates and Image Pyramids

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Midterm Examination CS 534: Computational Photography

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

CS6670: Computer Vision Noah Snavely. Administrivia. Administrivia. Reading. Last time: Convolution. Last time: Cross correlation 9/8/2009

Computing for Engineers in Python

Templates and Image Pyramids

Sampling and Reconstruction

Image Filtering. Median Filtering

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

Practical Image and Video Processing Using MATLAB

Filip Malmberg 1TD396 fall 2018 Today s lecture

Vision Review: Image Processing. Course web page:

Image Processing by Bilateral Filtering Method

Digital Image Processing

Image Manipulation: Filters and Convolutions

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

CAP 5415 Computer Vision. Marshall Tappen Fall Lecture 1

Tonemapping and bilateral filtering

CIS581: Computer Vision and Computational Photography Homework: Cameras and Convolution Due: Sept. 14, 2017 at 3:00 pm

DIGITAL IMAGE DE-NOISING FILTERS A COMPREHENSIVE STUDY

Robert Collins CSE486, Penn State. Lecture 3: Linear Operators

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Preparing Remote Sensing Data for Natural Resources Mapping (image enhancement, rectifications )

Filtering in the spatial domain (Spatial Filtering)

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Image Enhancement using Histogram Equalization and Spatial Filtering

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

Chapter 3 Image Enhancement in the Spatial Domain. Chapter 3 Image Enhancement in the Spatial Domain

EE482: Digital Signal Processing Applications

CS/ECE 545 (Digital Image Processing) Midterm Review

Image processing for gesture recognition: from theory to practice. Michela Goffredo University Roma TRE

Image Processing COS 426

Filtering Images in the Spatial Domain Chapter 3b G&W. Ross Whitaker (modified by Guido Gerig) School of Computing University of Utah

Convolutional Networks Overview

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

CSC 320 H1S CSC320 Exam Study Guide (Last updated: April 2, 2015) Winter 2015

BBM 413 Fundamentals of Image Processing. Erkut Erdem Dept. of Computer Engineering Hacettepe University. Point Operations Histogram Processing

CSE 564: Scientific Visualization

BBM 413! Fundamentals of! Image Processing!

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

Computer Graphics Fundamentals

Spatial Domain Processing and Image Enhancement

Part I Feature Extraction (1) Image Enhancement. CSc I6716 Spring Local, meaningful, detectable parts of the image.

Sensors and Sensing Cameras and Camera Calibration

Capturing Light in man and machine

Image Enhancement. DD2423 Image Analysis and Computer Vision. Computational Vision and Active Perception School of Computer Science and Communication

Lec 05 - Linear Filtering & Edge Detection

Computer Vision, Lecture 3

Circular averaging filter (pillbox) Approximates the two-dimensional Laplacian operator. Laplacian of Gaussian filter

Lecture 2: Color, Filtering & Edges. Slides: S. Lazebnik, S. Seitz, W. Freeman, F. Durand, D. Forsyth, D. Lowe, B. Wandell, S.Palmer, K.

Digital Image Processing

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

MATLAB 6.5 Image Processing Toolbox Tutorial

06: Thinking in Frequencies. CS 5840: Computer Vision Instructor: Jonathan Ventura

Color Space 1: RGB Color Space. Color Space 2: HSV. RGB Cube Easy for devices But not perceptual Where do the grays live? Where is hue and saturation?

Image Denoising Using Statistical and Non Statistical Method

Computer Vision Lecture 3

Non Linear Image Enhancement

Image preprocessing in spatial domain

Capturing Light in man and machine

Lec 04: Image Filtering and Edge Features

Image Enhancement in the Spatial Domain

Introduction. Computer Vision. CSc I6716 Fall Part I. Image Enhancement. Zhigang Zhu, City College of New York

Capturing Light in man and machine

TIRF, geometric operators

Last Lecture. photomatix.com

Image restoration and color image processing

Thinking in Frequency

Transcription:

WHAT IS AN IMAGE?

>>> from numpy import random as r >>> I = r.rand(256,256); Think-Pair-Share: - What is this? What does it look like? - Which values does it take? - How many values can it take? - Is it an image?

>>> from matplotlib import pyplot as p >>> I = r.rand(256,256); >>> p.imshow(i); >>> p.show(); Danny Alexander

Dimensionality of an Image @ 8bit = 256 values ^ 65,536 Computer says Inf combinations. Some depiction of all possible scenes would fit into this memory.

Dimensionality of an Image @ 8bit = 256 values ^ 65,536 Computer says Inf combinations. Some depiction of all possible scenes would fit into this memory. Computer vision as making sense of an extremely high-dimensional space. Subspace of natural images. Deriving low-dimensional, explainable models.

What is each part of an image? y x

What is each part of an image? Pixel -> picture element 38 y I(x,y) x

Image as a 2D sampling of signal Signal: function depending on some variable with physical meaning. Image: sampling of that function. 2 variables: xy coordinates 3 variables: xy + time (video) Brightness is the value of the function for visible light Can be other physical values too: temperature, pressure, depth Danny Alexander

Example 2D Images Danny Alexander

Sampling in D Sampling in D takes a function, and returns a vector whose elements are values of that function at the sample points. Danny Alexander

Sampling in 2D Sampling in 2D takes a function and returns a matrix. Danny Alexander

Grayscale Digital Image Brightness or intensity x y Danny Alexander

What is each part of a photograph? Pixel -> picture element 27 y I(x,y) x

Integrating light over a range of angles. Camera Sensor Output Image James Hays

Resolution geometric vs. spatial resolution Both images are ~5x5 pixels

Quantization

Quantization Effects Radiometric Resolution 8 bit 256 levels 4 bit 6 levels 2 bit 4 levels bit 2 levels

Images in Python Numpy N x M grayscale image im im[,] = top-left pixel value im[y, x] = y pixels down, x pixels to right im[n-, M-] = bottom-right pixel Row Column.92.93.94.97.62.37.85.97.93.92.99.95.89.82.89.56.3.75.92.8.95.9.89.72.5.55.5.42.57.4.49.9.92.96.95.88.94.56.46.9.87.9.97.95.7.8.8.87.57.37.8.88.89.79.85.49.62.6.58.5.6.58.5.6.45.33.86.84.74.58.5.39.73.92.9.49.74.96.67.54.85.48.37.88.9.94.82.93.69.49.56.66.43.42.77.73.7.9.99.79.73.9.67.33.6.69.79.73.93.97.9.94.89.49.4.78.78.77.89.99.93 James Hays

Grayscale intensity.92.93.94.97.62.37.85.97.93.92.99.95.89.82.89.56.3.75.92.8.95.9.89.72.5.55.5.42.57.4.49.9.92.96.95.88.94.56.46.9.87.9.97.95.7.8.8.87.57.37.8.88.89.79.85.49.62.6.58.5.6.58.5.6.45.33.86.84.74.58.5.39.73.92.9.49.74.96.67.54.85.48.37.88.9.94.82.93.69.49.56.66.43.42.77.73.7.9.99.79.73.9.67.33.6.69.79.73.93.97.9.94.89.49.4.78.78.77.89.99.93

James Hays Color R G B

Images in Python Numpy N x M RGB image im im[,,] = top-left pixel value in R-channel Im[x, y, b] = x pixels to right, y pixels down in the b th channel Im[N-, M-, 3] = bottom-right pixel in B-channel Row Column.92.93.94.97.62.37.85.97.93.92.99.95.89.82.89.56.3.75.92.8.95.9.89.72.5.55.5.42.57.4.49.9.92.92.93.94.97.62.37.85.97.93.92.99 G.96.95.88.94.56.46.9.87.9.97.95.95.89.82.89.56.3.75.92.8.95.9.7.8.8.87.57.37.8.88.89.79.85.89.72.5.55.5.42.57.4.49.9.92.49.62.6.58.92.5.93.6.94.58.97.5.62.6.37.45.85.33.97.93.92.99.96.95.88.94.56.46.9.87.9.97.95.86.84.74.58.95.5.89.39.82.73.89.92.56.9.3.49.75.74.92.8.95.9.7.8.8.87.57.37.8.88.89.79.85.96.67.54.85.89.48.72.37.5.88.55.9.5.94.42.82.57.93.4.49.9.92.49.62.6.58.5.6.58.5.6.45.33.69.49.56.66.96.43.95.42.88.77.94.73.56.7.46.9.9.99.87.9.97.95.86.84.74.58.5.39.73.92.9.49.74.79.73.9.67.7.33.8.6.8.69.87.79.57.73.37.93.8.97.88.89.79.85.96.67.54.85.48.37.88.9.94.82.93.9.94.89.49.49.4.62.78.6.78.58.77.5.89.6.99.58.93.5.6.45.33.69.49.56.66.43.42.77.73.7.9.99.86.84.74.58.5.39.73.92.9.49.74.79.73.9.67.33.6.69.79.73.93.97.96.67.54.85.48.37.88.9.94.82.93.9.94.89.49.4.78.78.77.89.99.93.69.49.56.66.43.42.77.73.7.9.99.79.73.9.67.33.6.69.79.73.93.97.9.94.89.49.4.78.78.77.89.99.93 R B James Hays

Images in Python Numpy Take care between types! - uint8 (values to 255) io.imread( file.jpg ) - float32 (values to 255) io.imread( file.jpg ).astype(np.float32) - float32 (values to ) img_as_float32(io.imread( file.jpg )) Row Column.92.93.94.97.62.37.85.97.93.92.99.95.89.82.89.56.3.75.92.8.95.9.89.72.5.55.5.42.57.4.49.9.92.96.95.88.94.56.46.9.87.9.97.95.7.8.8.87.57.37.8.88.89.79.85.49.62.6.58.5.6.58.5.6.45.33.86.84.74.58.5.39.73.92.9.49.74.96.67.54.85.48.37.88.9.94.82.93.69.49.56.66.43.42.77.73.7.9.99.79.73.9.67.33.6.69.79.73.93.97.9.94.89.49.4.78.78.77.89.99.93 James Hays

Ben Thomas

IMAGE FILTERING

Image filtering Image filtering: Compute function of local neighborhood at each position h[ m, n] = k, l f [ k, l] I[ m + k, n + l] James Hays

Image filtering Image filtering: Compute function of local neighborhood at each position h=output h[ m, n] = f [ k, l] I[ m + k, n + l] k, l f=filter I=image 2d coords=k,l 2d coords=m,n [ ] [ ] [ ]

Example: box filter f [, ] Slide credit: David Lowe (UBC)

Image filtering f [, ] I[.,.] h[.,.] 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 2 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 2 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 2 3 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 2 3 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9? 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 2 3 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9? 9 9 9 9 9 9 9 9 9 5 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering f [, ] I[.,.] h[.,.] 2 3 3 3 2 9 9 9 9 9 2 4 6 6 6 4 2 9 9 9 9 9 3 6 9 9 9 6 3 9 9 9 9 9 3 5 8 8 9 6 3 9 9 9 9 3 5 8 8 9 6 3 9 9 9 9 9 2 3 5 5 6 4 2 2 3 3 3 3 2 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Box Filter What does it do? Replaces each pixel with an average of its neighborhood f [, ] Achieve smoothing effect (remove sharp features) Slide credit: David Lowe (UBC)

Box Filter What does it do? Replaces each pixel with an average of its neighborhood f [, ] Achieve smoothing effect (remove sharp features) Why does it sum to one? Slide credit: David Lowe (UBC)

Smoothing with box filter f [, ] James Hays

Image filtering Image filtering: Compute function of local neighborhood at each position h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Really important! Enhance images Denoise, resize, increase contrast, etc. Extract information from images Texture, edges, distinctive points, etc. Detect patterns Template matching James Hays

Think-Pair-Share time. 2. - -2 2-2 - 3. 4.

. Practice with linear filters? Original Source: D. Lowe

. Practice with linear filters Original Filtered (no change) Source: D. Lowe

2. Practice with linear filters? Original Source: D. Lowe

2. Practice with linear filters Original Shifted left By pixel Source: D. Lowe

3. Practice with linear filters 2 Sobel - -2 - Vertical Edge (absolute value) David Lowe

3. Practice with linear filters - 2-2 Sobel - Horizontal Edge (absolute value) David Lowe

4. Practice with linear filters 2 -? Original (Note that filter sums to ) Source: D. Lowe

4. Practice with linear filters 2 - Original Sharpening filter - Accentuates differences with local average Source: D. Lowe

4. Practice with linear filters Source: D. Lowe

Correlation and Convolution 2d correlation h[ m, n] = f [ k, l] I[ m + k, n + l] k, l e.g., h = scipy.signal.correlate2d(f,i) James Hays

Correlation and Convolution 2d correlation h[ m, n] = f [ k, l] I[ m + k, n + l] k, l e.g., h = scipy.signal.correlate2d(f,i) 2d convolution h[ m, n] = k, l f [ k, l] I[ m k, n l] e.g., h = scipy.signal.convolve2d(f,i) Convolution is the same as correlation with a 8 rotated filter kernel. Correlation and convolution are identical when the filter kernel is symmetric. James Hays

Key properties of linear filters Linearity: imfilter(i, f + f 2 ) = imfilter(i,f ) + imfilter(i,f 2 ) Shift invariance: Same behavior given intensities regardless of pixel location m,n imfilter(i,shift(f)) = shift(imfilter(i,f)) Any linear, shift-invariant operator can be represented as a convolution. S. Lazebnik

Convolution properties Commutative: a * b = b * a Conceptually no difference between filter and signal But particular filtering implementations might break this equality, e.g., image edges Associative: a * (b * c) = (a * b) * c Often apply several filters one after another: (((a * b ) * b 2 ) * b 3 ) This is equivalent to applying one filter: a * (b * b 2 * b 3 ) Source: S. Lazebnik

Convolution properties Commutative: a * b = b * a Conceptually no difference between filter and signal But particular filtering implementations might break this equality, e.g., image edges Associative: a * (b * c) = (a * b) * c Often apply several filters one after another: (((a * b ) * b 2 ) * b 3 ) This is equivalent to applying one filter: a * (b * b 2 * b 3 ) Correlation is _not_ associative (rotation effect) Why important? Source: S. Lazebnik

Recap of Monday Linear filtering (convolution) Not a matrix multiplication Sum over Hadamard product Can smooth, sharpen, translate (among many other uses) ], [ ], [ ], [, l n k m I l k f n m h l k =

Convolution properties Commutative: a * b = b * a Conceptually no difference between filter and signal But particular filtering implementations might break this equality, e.g., image edges Associative: a * (b * c) = (a * b) * c Often apply several filters one after another: (((a * b ) * b 2 ) * b 3 ) This is equivalent to applying one filter: a * (b * b 2 * b 3 ) Correlation is _not_ associative (rotation effect) Why important? Distributes over addition: a * (b + c) = (a * b) + (a * c) Scalars factor out: ka * b = a * kb = k (a * b) Identity: unit impulse e = [,,,, ], a * e = a Source: S. Lazebnik

Important filter: Gaussian Weight contributions of neighboring pixels by nearness x y.3.3.22.3.3.3.59.97.59.3.22.97.59.97.22.3.59.97.59.3.3.3.22.3.3 x y 5 x 5, = Slide credit: Christopher Rasmussen

Smoothing with Gaussian filter James Hays

Smoothing with box filter James Hays

Gaussian filters Remove high-frequency components from the image (low-pass filter) Images become more smooth Gaussian convolved with Gaussian is another Gaussian So can smooth with small-width kernel, repeat, and get same result as larger-width kernel would have Convolving twice with Gaussian kernel of width σ is same as convolving once with kernel of width σ 2 Separable kernel Factors into product of two D Gaussians Source: K. Grauman

Separability of the Gaussian filter Source: D. Lowe

Separability example 2D convolution (center location only) = The filter factors into a product of D filters: Perform convolution along rows: * = Followed by convolution along the remaining column: * = Source: K. Grauman

Separability Why is separability useful in practice? MxN image, PxQ filter 2D convolution: ~MNPQ multiply-adds Separable 2D: ~MN(P+Q) multiply-adds Speed up = PQ/(P+Q) 9x9 filter = ~4.5x faster

Practical matters How big should the filter be? Values at edges should be near zero Gaussians have infinite extent Rule of thumb for Gaussian: set filter half-width to about 3 σ James Hays

Practical matters What about near the edge? The filter window falls off the edge of the image Need to extrapolate methods: clip filter (black) wrap around copy edge reflect across edge Source: S. Marschner

Convolution in Convolutional Neural Networks Convolution is the basic operation in CNNs Learning convolution kernels allows us to learn which `features provide useful information in images.

Sobel filter visualization What happens to negative numbers? For visualization: Shift image +.5 If gradients are small, scale edge response

>> I = img_to_float32( io.imread( luke.jpg ) ); >> h = convolve2d( I, sobelkernel ); 2 - -2 - Sobel plt.imshow( h ); plt.imshow( h +.5 );

h(:,:,) < h(:,:,) >

Think-Pair-Share * = Convolution operator a) _ = D * B b) A = _ * _ c) F = D * _ d) _ = D * D D H A B F I C G E Hoiem

I = D * D D (275 x 75 pixels) I (from slide 275 x 75) something to do with lack of content (black) at edges

I = D * D D (275 x 75 pixels) I (from slide 275 x 75) >> D = img_to_float32( io.imread( convexample.png ) ) >> I = convolve2d( D, D ) >> np.max(i).2e+4 I_norm # Normalize for visualization >> I_norm = (I np.min(i)) / (np.max(i) np.min(i)) >> plt.imshow( I_norm )

I = D * D D (275 x 75 pixels) I (from slide 275 x 75) (275-)/2 (275-)/2 I_norm (549 x 349 pixels) 275 For x: 275 + (275-)/2 + (275-)/2 = 549

I = D * D D (275 x 75 pixels) I (from slide 275 x 75) >> I = convolve2d( D, D, mode= full ) (Default; pad with zeros) 549 x 349 >> I = convolve2d( D, D, mode= same ) (Return same size as D) 275 x 75 >> I = convolve2d( D, D, mode= valid ) (No padding) Value = 528.3 x

A = B * C - because it kind of looks like it. A B C C is a Gaussian filter (or something close to it it), and we know that it blurs. When the filter looks like the image = template matching Filtering viewed as comparing an image of what you want to find against all image regions. For symmetric filters: use either convolution or correlation. For nonsymmetric filters: correlation is template matching.

Filtering: Correlation and Convolution 2d correlation h[ m, n] = f [ k, l] I[ m + k, n + l] k, l e.g., h = scipy.signal.correlate2d(f,i) 2d convolution h[ m, n] = k, l f [ k, l] I[ m k, n l] e.g., h = scipy.signal.convolve2d(f,i) Convolution is the same as correlation with a 8 rotated filter kernel. Correlation and convolution are identical when the filter kernel is symmetric. James Hays

D (275 x 75 pixels) OK, so let s test this idea. Let s see if we can use correlation to find the parts of the image that look like the filter. >> f = D[ 57:7, 7:67 ] Expect response peak in middle of I f 6 x 6 >> I = correlate2d( D, f, same ) I Hmm That didn t work why not? Response peak Correct location + [Thanks to Robert Collins @ Penn State]

Correlation h[ m, n] = f [ k, l] I[ m + k, n + l] k, l e.g., h = scipy.signal.correlate2d(f,i) As brightness in I increases, the response in h will increase, as long as f is positive. Overall brighter regions will give higher correlation response -> not useful!

D2 (275 x 75 pixels) OK, so let s subtract the mean >> f = D[ 57:7, 7:67 ] >> f2 = f np.mean(f) >> D2 = D np.mean(d) f2 6 x 6 Now zero centered. Score is higher only when dark parts match and when light parts match. I2 >> I2 = correlate2d( D2, f2, same )

D2 (275 x 75 pixels) Or even >> I3 = correlate2d( D2, D2, full ) I3

D2 (275 x 75 pixels) What happens with convolution? >> f = D[ 57:7, 7:67 ] >> f2 = f np.mean(f) >> D2 = D np.mean(d) >> I2 = convolve2d( D2, f2, same ) I2 f2 6 x 6

NON-LINEAR FILTERS

Median filters Operates over a window by selecting the median intensity in the window. Rank filter as based on ordering of gray levels E.G., min, max, range filters Steve Seitz, Steve Marschner

Image filtering - mean f [, ] I[.,.] h[.,.] 2 3 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9? 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Image filtering - mean f [, ] I[.,.] h[.,.] 2 3 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 5 9 h[ m, n] = k, l f [ k, l] I[ m + k, n + l] Credit: S. Seitz

Median filter? I[.,.] h[.,.] 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9? 9 Credit: S. Seitz

Median filters Operates over a window by selecting the median intensity in the window. What advantage does a median filter have over a mean filter? Steve Seitz, Steve Marschner

Noise Salt and Pepper Jack

Mean Jack 3 x 3 filter

Very Mean Jack x filter

Noisy Jack Salt and Pepper

Median Jack 3 x 3

Very Median Jack x

Median filters Operates over a window by selecting the median intensity in the window. What advantage does a median filter have over a mean filter? Is a median filter a kind of convolution? Steve Seitz, Steve Marschner

Median filters Operates over a window by selecting the median intensity in the window. What advantage does a median filter have over a mean filter? Is a median filter a kind of convolution? Interpretation: Median filtering is sorting.

Ben Thomas

Tilt-shift photography

Tilt shift camera Sensor Shift Tilt Sensor

Macro photography

Can we fake tilt shift? We need to blur the image OK, now we know how to do that.

Can we fake tilt shift? We need to blur the image OK, now we know how to do that. We need to blur progressively more away from our fake focal point

But can I make it look more like a toy? Boost saturation toys are very colorful We ll learn how to do this when we discuss color For now: transform to Hue, Saturation, Value instead of RGB

Next class: Thinking in Frequency