image transforma1ons
play

Image Transforma1ons image filtering : change range of image Image - PDF document

Image Transforma1ons image filtering : change range of image Image Processing : g(x) = h(f(x)) Transforma1ons, Warping and Morphing h Last Week Courtesy: Irfan Essa, Georgia Tech James Hayes, Georgia Tech Alexei Efros, UC Berkeley


  1. Image Transforma1ons • image filtering : change range of image Image Processing : • g(x) = h(f(x)) Transforma1ons, Warping and Morphing h Last Week Courtesy: Irfan Essa, Georgia Tech James Hayes, Georgia Tech Alexei Efros, UC Berkeley Steve Seitz, U Washington Image Transforma1ons • image filtering : change domain of image • g(x) = f(h(x)) h • x Parametric (global) warping Parametric (global) warping Original Aspect Skew Original • Examples: – Original – Transla1on Translate Scale Others, – Rota1on Translate Cylindrical Perspec4ve Rotate Rotate

  2. Image Scaling Parametric Global warping • Mul1ply each T components by a scalar p = (x,y) p � = (x � ,y � ) • Transformation T is a coordinate -changing machine • Uniform scaling : Scalar of pixels at x, y. × 2 same for x, y p � = T (p) • Global and parametric T: • Non-uniform : Not – Is the same for any point p same – Described parameters • T can be represented as a matrix: x ' x ⎡ ⎤ ⎡ ⎤ p � = M p x ' = ax + by ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ M x ' a b x = ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ ⎢ ⎥ y ' y y ' y c d y ' = cx + dy ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ Image Scaling Image Scaling • Mul1ply each • Mul1ply each components by a components by a scalar scalar • Uniform scaling : Scalar • Uniform scaling : Scalar × 2 × 2 same for x, y same for x, y (s x =s y ) • Non-uniform : Not • Non-uniform : Not same same (s x ≠s y ) ⎡ ⎤ x ' = ax + by x ' = s x x ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ s x 0 x ' a 0 x x ' x ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ y ' y y ' y 0 d y ' = s y y ⎢ 0 s y ⎥ y ' = cx + dy ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ Image Scaling 2D Image Transforma1on • Mul1ply each • Scaling: ⎡ ⎤ components by a x ' = s x x ⎡ ⎤ ⎡ ⎤ s x 0 x ' x ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ scalar y ' 0 s y y y ' = s y y ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ • Uniform scaling : Scalar same for x, y (s x =s y ) X × 2 Y × 0.5 • Non-uniform : Not • Mirror same (s x ≠s y ) ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ x ' x − 1 0 ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ y ' y 0 − 1 ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎡ ⎤ x ' = s x x ⎡ ⎤ ⎡ ⎤ s x 0 x ' x ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ y ' y y ' = s y y ⎢ 0 s y ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦

  3. 2D Rota1on 2D Rota1on (x � , y � ) (x � , y � ) • X’ is a linear combination x = r cos ( φ ) of x and y (even if sin( θ ) y = r sin ( φ ) (x, y) (x, y) and cos( θ ) themselves x � = r cos ( φ + θ ) are non-linear) y � = r sin ( φ + θ ) Trig Iden1ty • Inverse transformation? θ θ φ φ x � = r cos( φ ) cos( θ ) – r sin( φ ) – Rotation by – θ sin( θ ) – For rotation matrices R -1 = y � = r sin( φ ) cos( θ ) + r cos( φ ) R T x � = x cos ( θ ) - y sin ( θ ) x � = x cos ( θ ) - y sin ( θ ) sin( θ ) y � = x sin ( θ ) + y cos ( θ ) y � = x sin ( θ ) + y cos ( θ ) Subs1tute x � = x cos ( θ ) - y sin ( θ ) ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ cos( θ ) − sin( θ ) cos( θ ) − sin( θ ) x ' x x ' x ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ y � = x sin ( θ ) + y cos ( θ ) = = y ' y y ' y sin( θ ) cos( θ ) sin( θ ) cos( θ ) ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ 2D Linear Transforma1ons (LD) Linear Combina1on ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ x ' x − 1 0 x ' = − x ⎢ ⎥ = ⎢ ⎥ ⎢ ⎥ y ' y 0 − 1 y ' = − y ⎢ ⎥ ⎣ ⎦ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ Linear Transforma1ons ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ x ' x x ' x a b ⎢ ⎥ = M ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⇔ = ⎢ ⎥ x ' x x ' x = 1 0 • Mirror y ' y y ' y c d ⎢ ⎥ = ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ y ' y ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ = y ' y 0 1 ⎢ ⎥ ⎣ ⎦ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ • Iden1ty x ' = s x x ⎡ ⎤ • Only Linear Combina1ons can be ⎡ ⎤ ⎡ ⎤ s x 0 x ' x • Scale ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = y ' = s y y represented by a 2 x 2 matrix y ' 0 s y y ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ – Mirror, Iden1ty, Shear, Scale, and Rotate • Shear – Origin maps to origin ⎡ ⎤ ⎡ ⎤ 1 sh x ⎡ ⎤ x ' = x + sh x * y x ' x • Rotate ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ – Lines map to lines y ' ⎢ sh y 1 ⎥ y y ' = sh y * x + y ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ – Parallel lines remain parallel – Ratios are preserved – Closed under composition ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ x ' cos( θ ) − sin( θ ) x x � = x cos( θ ) - y sin( θ ) x ' = x + t x ⎢ ⎥ ⎢ ⎥ = ⎢ ⎥ • What about Translate? y � = x sin( θ ) + y cos( θ ) y ' sin( θ ) cos( θ ) y ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ y ' = y + t y Homogenous Coordinate Basic 2D Transforma1on ⎡ ⎤ • Idea : Add an extra 1 0 t x x ' 1 0 t x x t ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ + ⎤ ⎡ ⎤ ⎢ ⎥ x ' = x + t x x x x dimension ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎡ ⎤ y ' 0 1 t y y t T ranslation = 0 1 t y = = + x ⎢ ⎥ ⎢ y ⎥ y ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ y ' = y + t y – In 2D use a 3-vector and 3x3 y ⎢ ⎥ ⇒ 1 ⎢ 0 0 1 ⎥ 1 1 ⎢ 0 0 1 ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ matrices. y ⎢ ⎥ ⎣ ⎦ ⎢ ⎥ ⎡ ⎤ – In 3D use a 4-vector and 5x4 1 1 0 ⎣ ⎦ Identity = ⎢ ⎥ matrices. 0 1 ⎣ ⎦ • The extra coordinate (3 rd for 2D images) is an arbitrary t x = 2 y value w, added to each 2D t y = 1 2 point (x,y) � (x,y,w) (2,1,1) or (4,2,2) or (6,3,3) ) 1 • (x, y, w) � (x/w, y/w) 1 2 x • (x, y, 0) � infinity ed • (0, 0, 0) is not allowed

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend