Image Transforms 主講人:虞台文. Content Overview Convolution Edge Detection – Gradients – Sobel operator – Canny edge detector – Laplacian Hough Transforms.

Slides:



Advertisements
Similar presentations
3-D Computer Vision CSc83020 / Ioannis Stamos  Revisit filtering (Gaussian and Median)  Introduction to edge detection 3-D Computater Vision CSc
Advertisements

Lecture 2: Convolution and edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Edge Detection CSE P 576 Larry Zitnick
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Lecture 4 Edge Detection
Midterm Review CS485/685 Computer Vision Prof. Bebis.
Canny Edge Detector.
Edge detection. Edge Detection in Images Finding the contour of objects in a scene.
Announcements Mailing list: –you should have received messages Project 1 out today (due in two weeks)
EE663 Image Processing Edge Detection 2 Dr. Samir H. Abdul-Jauwad Electrical Engineering Department King Fahd University of Petroleum & Minerals.
Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering
Edge Detection Today’s reading Forsyth, chapters 8, 15.1
Segmentation (Section 10.2)
Lecture 2: Image filtering
Lecture 4: Edge Based Vision Dr Carole Twining Thursday 18th March 2:00pm – 2:50pm.
Edge Detection Today’s readings Cipolla and Gee –supplemental: Forsyth, chapter 9Forsyth Watt, From Sandlot ScienceSandlot Science.
Edge Detection.
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Chapter 2. Image Analysis. Image Analysis Domains Frequency Domain Spatial Domain.
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30 – 11:50am.
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
HOUGH TRANSFORM Presentation by Sumit Tandon
Lecture 2: Edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Edges. Edge detection schemes can be grouped in three classes: –Gradient operators: Robert, Sobel, Prewitt, and Laplacian (3x3 and 5x5 masks) –Surface.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection From Sandlot ScienceSandlot Science.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski, Ch 4.1.2, From Sandlot.
Instructor: S. Narasimhan
CS654: Digital Image Analysis Lecture 24: Introduction to Image Segmentation: Edge Detection Slide credits: Derek Hoiem, Lana Lazebnik, Steve Seitz, David.
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
CSE 185 Introduction to Computer Vision Edges. Scale space Reading: Chapter 3 of S.
EE 4780 Edge Detection.
Many slides from Steve Seitz and Larry Zitnick
Edge Detection and Geometric Primitive Extraction Jinxiang Chai.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Edge Detection.
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.
Chapter 9: Image Segmentation
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.
Announcements Project 0 due tomorrow night. Edge Detection Today’s readings Cipolla and Gee (handout) –supplemental: Forsyth, chapter 9Forsyth For Friday.
EDGE DETECTION Instructor: Dr. Engr. Junaid Zafar.
Lecture 04 Edge Detection Lecture 04 Edge Detection Mata kuliah: T Computer Vision Tahun: 2010.
Digital Image Processing Lecture 17: Segmentation: Canny Edge Detector & Hough Transform Prof. Charlene Tsai.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
COMPUTER VISION D10K-7C02 CV05: Edge Detection Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Computer Vision Image Features Instructor: Dr. Sherif Sami Lecture 4.
Instructor: Mircea Nicolescu Lecture 7
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Lecture 8: Edges and Feature Detection
Finding Boundaries Computer Vision CS 143, Brown James Hays 09/28/11 Many slides from Lana Lazebnik, Steve Seitz, David Forsyth, David Lowe, Fei-Fei Li,
Winter in Kraków photographed by Marcin Ryczek
Miguel Tavares Coimbra
Edge Detection slides taken and adapted from public websites:
Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University.
Detection of discontinuity using
Edge Detection CS 678 Spring 2018.
Lecture 2: Edge detection
Jeremy Bolton, PhD Assistant Teaching Professor
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Review: Linear Systems
Edge Detection Today’s reading
Edge Detection CSE 455 Linda Shapiro.
Edge Detection Today’s reading
Lecture 2: Edge detection
Canny Edge Detector.
Edge Detection Today’s reading
Edge Detection Today’s readings Cipolla and Gee Watt,
Lecture 2: Edge detection
Winter in Kraków photographed by Marcin Ryczek
IT472 Digital Image Processing
IT472 Digital Image Processing
Introduction to Artificial Intelligence Lecture 22: Computer Vision II
Presentation transcript:

Image Transforms 主講人:虞台文

Content Overview Convolution Edge Detection – Gradients – Sobel operator – Canny edge detector – Laplacian Hough Transforms Geometric Transforms – Affine Transform – Perspective Transform Histogram Equalization

Image Transforms Overview

Image Transform Concept T[]

Image Transform Concept T[]

Image Transforms Convolution

Image Convolution g(x,y) is known as convolution kernel.

Image Convolution g(x,y) is known as convolution kernel. height 2h + 1 width 2w + 1

Image Convolution g(x,y) is known as convolution kernel. height 2h + 1 width 2w + 1

Some Convolution Kernels

OpenCV Implementation  Image Filter void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1, -1) ); void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1, -1) );

Deal with Convolution Boundaries void cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, int bordertype, CvScalar value=cvScalarAll(0) ); void cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, int bordertype, CvScalar value=cvScalarAll(0) );

Image Transforms Edge Detection

Convert a 2D image into a set of curves – Extracts salient features of the scene – More compact than pixels

Origin of Edges depth discontinuity surface color discontinuity illumination discontinuity surface normal discontinuity Edges are caused by a variety of factors

Edge Detection How can you tell that a pixel is on an edge?

Edge Types Step Edges Roof Edge Line Edges

Real Edges Noisy and Discrete! x I We want an Edge Operator that produces: – Edge Magnitude – Edge Orientation – High Detection Rate and Good Localization

Derivatives of Image in 1D Edges can be characterized as either: – local extrema of  I(x) – zero-crossings of  2 I(x)  1D image  gradient  Laplacian

2D-Image Gradient

Gives the direction of most rapid change in intensity Gradient direction: Edge strength:

Classification of Points To precisely locate the edge, we need to thin. Ideally, edges should be only one point thick. T Non-zero edge width

The Sobel Operators Sobel (3 x 3): Sobel (5 x 5): Good Localization Noise Sensitive Poor Detection Poor Localization Less Noise Sensitive Good Detection

OpenCV Implementation  The Sobel Operators void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 );

OpenCV Implementation  The Scnarr Operator void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); aperture_size CV_SCHARR

Demonstration

Exercise Download Test Program Download Test Program

Effects of Noise Where is the edge? Consider a single row or column of the image

Solution: Smooth First

Where is the edge?

Derivative Theorem of Convolution Gaussian:

Derivative Theorem of Convolution saves us one operation.

Optimal Edge Detection: Canny Assume: – Linear filtering – Additive iid Gaussian noise An "optimal" edge detector should have: – Good Detection Filter responds to edge, not noise. – Good Localization detected edge near true edge. – Single Response one per edge.

Optimal Edge Detection: Canny Based on the first derivative of a Gaussian Detection/Localization trade-off – More smoothing improves detection – And hurts localization.

Stages of the Canny algorithm Noise reduction Size of Gaussian filter Finding the intensity gradient of the image Non-maximum suppression Tracing edges through the image and hysteresis thresholding High threshold Low threshold

Parameters of Canny algorithm Noise reduction – Size of Gaussian filter Finding the intensity gradient of the image Non-maximum suppression Tracing edges through the image and hysteresis thresholding – High threshold – Low threshold

OpenCV Implementation  The Canny Operator void cvCanny( const CvArr* img, CvArr* edges, double lowThresh, double highThresh, int apertureSize = 3 ); void cvCanny( const CvArr* img, CvArr* edges, double lowThresh, double highThresh, int apertureSize = 3 );

Example: Canny Edge Detector Download Test Program Download Test Program

Review: Derivatives of Image in 1D Edges can be characterized as either: – l– local extrema of  I(x) – z– zero-crossings of  2 I(x)  1D image  gradient  Laplacian

Laplacian A scalar  isotropic. Edge detection: Find all points for which  2 I(x, y) = 0 No thinning is necessary. Tends to produce closed edge contours.

Laplacian

Discrete Laplacian Operators

OpenCV Implementation  The Discrete Laplacian Operators void cvLaplace( const CvArr* src, CvArr* dst, int apertureSize = 3 ); void cvLaplace( const CvArr* src, CvArr* dst, int apertureSize = 3 );

Example

Laplician for Edge Detection Find zero-crossing on the Laplacian image.

Zero Crossing Detection There is a little bug in the above algorithm. Try to design your own zero-crossing detection algorithm.

Example: Laplician for Edge Detection Download Test Program Download Test Program

Laplacian for Image Sharpening

Example: Laplacian for Image Sharpening Sharpened Image

Laplacian of Gaussian (LoG) Gaussian:

Some LoG Convolution Kernels

Example: LoG for Edge Detection by LoG by Laplacian

Image Transforms Hough Transforms

Goal of Hough Transforms A technique to isolate the curves of a given shape / shapes in a given image Classical Hough Transform – can locate regular curves like straight lines, circles, parabolas, ellipses, etc. Generalized Hough Transform – can be used where a simple analytic description of feature is not possible

HT for Line Detection x y m b (m, b) A line in xy-plane is a point in mb-plane.

HT for Line Detection x y m b (m 1, b 1 ) (m 2, b 2 ) (m 3, b 3 ) All lines passing through a point in xy-plane is a line in mb-plane. A line in xy-plane is a point in mb-plane.

HT for Line Detection x y m b (m 1, b 1 ) (m 2, b 2 ) (m 3, b 3 ) All lines passing through a point in xy-plane is a line in mb-plane. A line in xy-plane is a point in mb-plane. Given a point in xy-plane, we draw a line in mb-plane.

HT for Line Detection x y m b A line in xy-plane is a point in mb-plane. A line in xy-plane is then transformed in to a set of lines in mb-plane, which intersect at a common point. Given a point in xy-plane, we draw a line in mb-plane. (m, b)

HT for Line Detection x y m b A line in xy-plane is a point in mb-plane. A line in xy-plane is then transformed in to a set of lines in mb-plane, which intersect at a common point. Given a point in xy-plane, we draw a line in mb-plane. (m, b) How to implement? Is mb representation suitable?

HT Line Detection by  -representation x y     ( ,  ) A line in xy-plane is a point in  -plane.

HT Line Detection by  -representation x y   A line in xy-plane is a point in  -plane All lines passing through a point in xy-plane is a curve in  -plane.

HT Line Detection by  -representation x y   A line in xy-plane is a point in  -plane All lines passing through a point in xy-plane is a curve in  -plane. Given a point in xy-plane, we draw a curve in  -plane.

HT Line Detection by  -representation x y   A line in xy-plane is a point in  -plane. Given a point in xy-plane, we draw a curve in  -plane. A line in xy-plane is then transformed in to a set of curves in  -plane, which intersect at a common point. ( ,  )

HT Line Detection by  -representation A line in xy-plane is a point in  -plane. Given a point in xy-plane, we draw a curve in  -plane. A line in xy-plane is then transformed in to a set of curves in  -plane, which intersect at a common point.

OpenCV Implementation  Hough Line Transform CvSeq* cvHoughLines2( CvArr* image, void* line_storage, int method, double rho, double theta, int threshold, double param1 = 0, double param2 = 0 ); CvSeq* cvHoughLines2( CvArr* image, void* line_storage, int method, double rho, double theta, int threshold, double param1 = 0, double param2 = 0 );

Example: Hough Line Transform Download Test Program Download Test Program

Hough Circle Transform Circle equation: x y r a b image spaceparameter space

Hough Circle Transform Circle equation: x y r a b image spaceparameter space Cost ineffective & time consuming

Hough Gradient Method Circle equation: x y image space Parametric form:

Hough Gradient Method Circle equation: x y image space Parametric form: The value of can be obtained from the edge detection process.

Hough Gradient Method Quantize the parameter space for the parameters a and b. Zero the accumulator array M(a, b). Compute the gradient magnitude G(x, y) and angle  (x, y). For each edge (x 0, y 0 ) point in G(x, y), increment all points in the accumulator array M(a, b) along the line Local maxima in the accumulator array correspond to centers of circles in the image. Circle equation: x y image space

OpenCV Implementation  Hough Circle Transform CvSeq* cvHoughCircles( CvArr* image, void* circle_storage, int method, double dp, double min_dist, double param1=100, double param2=100 int min_radius=0, int max_radius=0 ); CvSeq* cvHoughCircles( CvArr* image, void* circle_storage, int method, double dp, double min_dist, double param1=100, double param2=100 int min_radius=0, int max_radius=0 );

Example: Hough Circle Transform Download Test Program Download Test Program

Image Transforms Geometric Transforms

Geometric Transforms  Stretch, Shrink, Warp, and Rotate

Scaling, Rotation, Translation Scaling Rotation Translation

Scaling, Rotation + Translation Scaling Rotation Translation + Translation + Translation

Homogeneous Coordinate

Scaling, Rotation + Translation Scaling Rotation + Translation + Translation 2  3 matrix

Affine Transformation An affine transformation is any transformation that can be expressed in the form of a matrix multiplication followed by a vector addition. – In OpenCV the standard style of representing such a transformation is as a 2-by-3 matrix. 2  3 matrix

Affine Transformation

GetAffineTransform

Get 2D Rotation Matrix

WarpAffine

GetQuadrangleSubPix

Example: Affine Transform Download Test Program Download Test Program

GetQuadrangleSubPix

Sparse Affine Transformation

Perspective Transform

Affine Transform vs. Perspective Transform Affine Transform: Perspective Transform:

Get Perspective Transform

WarpPerspective

Sparse Perspective Transformation

Image Transforms Histogram Equalization

Graylevel Histogram of Image

Goal of Histogram Equalization

Image Enhancement

Method  Graylevel Remapping 0 1 fX(x)fX(x) x 0 1 fY(y)fY(y) y y x X Y

Probability Theory y x X Y pdf cdf

Example: Gaussian

Demonstration

OpenCV Implementation

Example Download Test Program Download Test Program