Top Banner
DTU Compute 2019 Image Analysis 1 DTU Compute, Technical University of Denmark DTU Compute 19. November 2019 02502 - Week 11 Tim B. Dyrby ([email protected]) Associate Professor, DTU Compute & Rasmus R. Paulsen ([email protected]) Associate Professor, DTU Compute 02502 Image Analysis Week 11 – Hough Transformation and Path Tracing 1 http://courses.compute.dtu.dk/02502/ Plenty of slides adapted from Thomas Moeslunds lectures
62

02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

May 15, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis1 DTU Compute, Technical University of DenmarkDTU Compute19. November 2019 02502 - Week 11

Tim B. Dyrby ([email protected])Associate Professor, DTU Compute

&Rasmus R. Paulsen ([email protected])Associate Professor, DTU Compute

02502Image AnalysisWeek 11 – Hough Transformation and Path Tracing

1

http://courses.compute.dtu.dk/02502/

Plenty of slides adapted from Thomas Moeslunds lectures

Page 2: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis2 DTU Compute, Technical University of Denmark

Lecture 11 – Hough Transformation and Path Tracing

Hough transform

q

r

-50 0 50

-400

-200

0

200

400

Page 3: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis3 DTU Compute, Technical University of Denmark

Breaking NEWS!One morning I was shopping in Amsterdam with my young fiancée, and

tired, we sat down on the café terrace to drink a cup of coffee and I was

just thinking about whether I could do this, and I then designed the

algorithm for the shortest path. As I said, it was a twenty-minute invention.

—Edsger Dijkstra, in an interview with Philip L. Frana, Communications of the ACM, 2001[3]

Page 4: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis4 DTU Compute, Technical University of Denmark

What can you do after today?n Use the Hough transform for line detectionn Describe the slope-intercept, the general form and the normalised

form of linesn Describe the connection between lines and the Hough spacen Use edge detection to enhance images for use with the Hough

transformn Use dynamic programming to trace paths in imagesn Describe how an image can be used as a graphn Describe the fundamental properties of a cost imagen Compute the cost of pathn Compute an accumulator image for path tracingn Compute a backtracing image for path tracingn Choose appropriate pre-processing steps for path tracingn Describe how circular structures can be located using path tracing

Page 5: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis5 DTU Compute, Technical University of Denmark

Line Detectionn Find the lines in an image

Page 6: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis6 DTU Compute, Technical University of Denmark

What is a line?

n It can be the entire object– Large scale

n Can also be the border between an object and the background– Small scale

n Normally only locally defined

Page 7: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis7 DTU Compute, Technical University of Denmark

Enhancing the linesn We want to locate the borders

– Enhance themn Filtering (Prewitt)n Edge detection

Original Prewitt Edge

Prewitt

Page 8: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis8 DTU Compute, Technical University of Denmark

What is a line II?n Result of the edge filter is a selection of

white pixelsn Some of them define a line

– Not a perfect straight line– “Linelike”

n How do we find the collection of points that define a line?

Page 9: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis9 DTU Compute, Technical University of Denmark

Mathematical line definitionn The classical definition (slope-intercept form)

-5 0 5-5

0

5

x axis

y ax

is

y=0.5 * x + 1

y = ax + bSlope Intercept

Can not represent lines that are vertical

Page 10: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis10 DTU Compute, Technical University of Denmark

-5 0 5-5

0

5

x axis

y ax

is

Ax + By = C

Mathematical line definitionn General definition

n With

Ax + By = C

A2 + B2 = 1

Line normal

Page 11: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis11 DTU Compute, Technical University of Denmark

Mathematical line definitionn Normal parameterisation

n where– is the distance from the

origin– is the angle

-5 0 5-5

0

5

x axis

y ax

is

Ax + Bx = C

A2 + B2 = 1

Page 12: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis12 DTU Compute, Technical University of Denmark

Mathematical line definitionn Normal parameterisation

n Therefore a line can be defined by two values––

n A line can therefore also be seen as a point in a ( , )-space

-5 0 5-5

0

5

x axis

y ax

is

Ax + Bx = C

½µ

Page 13: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis13 DTU Compute, Technical University of Denmark

Converting linesn From normal to slop-intercept form

𝑝 = 𝑥 cos 𝜃 + 𝑦 sin 𝜃The normal form:

y = 𝑎𝑥 + 𝑏The slope-intercept form:

Slope=a

intercept=b

−𝑥 ∗ 𝑐𝑜𝑡𝜃 + 𝑝 ∗ 𝑐𝑜𝑠𝑒𝑐𝜃 = 𝑦

𝑦 = 𝑥 ∗ −𝑐𝑜𝑡𝜃 + 𝑝(𝑐𝑜𝑠𝑒𝑐𝜃)

Slope=a

Intercept=b

-cos 𝜃 + 𝑝 = sin 𝜃

Start: 𝑝 = 𝑥 cos 𝜃 + 𝑦 sin 𝜃

Page 14: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis14 DTU Compute, Technical University of Denmark

Something about angles

In Matlab and in this presentation

In the course notes

Page 15: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis15 DTU Compute, Technical University of Denmark

Hough Space

-5 0 5-5

0

5

x axis

y ax

is

r = x cos q + y sin q

-50 0 50-5

0

5

qr

Page 16: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis16 DTU Compute, Technical University of Denmark

More about angles

-5 0 5-5

0

5

x axis

y ax

is

r = x cos q + y sin qWhy?

but Matlab only allows

look at the mirror-projection of the normal

is used to determine if it is the “upper” or “lower line”

Page 17: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis17 DTU Compute, Technical University of Denmark

Hough space: Let’s vote for general line …§ Basically a tool to find a line through points.

Hou

gh s

pace

Poin

ts

1) Point coordinates: (x,y)

3) Hough parameters space:(r,𝝷)

https://en.wikipedia.org/wiki/Hough_transform

2) Define origin

4) Map all possible lines through a point for different 𝝷5) “Vote” which line fit best through points

Page 18: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis18 DTU Compute, Technical University of Denmark

How do we use the Hough space?

-50 0 50-5

0

5

q

r

?

Page 19: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis19 DTU Compute, Technical University of Denmark

How do we use the Hough space?n What if every little “line-segment” was plotted in the Hough-

space?

-50 0 50-5

0

5

q

r

Page 20: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis20 DTU Compute, Technical University of Denmark

Filled Hough-Spacen All “line segments” in the image examinedn A “global line” can now be found as a cluster of points

-50 0 50-5

0

5

q

r

In practice it is difficult to identify clusters

Page 21: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis21 DTU Compute, Technical University of Denmark

Hough transform in practisen Hough Space is represented as an imagen It is quantisized – made into finite boxes

-50 0 50-5

0

5

q

r

Pixel

A line segment here

Belongs to this pixel

Page 22: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis22 DTU Compute, Technical University of Denmark

Hough transform as a voting schemen The pixels in the Hough space are used to vote for lines. n Each line segment votes by putting one vote in a pixeln The pixels are also called accumulator cells

-50 0 50-5

0

5

q

r

Page 23: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis23 DTU Compute, Technical University of Denmark

Hough transform per pixeln In practise we do not use line segmentsn Each pixel in the input image votes for all potential lines going

through it.

-50 0 50-5

0

5

q

r

Page 24: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis24 DTU Compute, Technical University of Denmark

Hough transform per pixel

-50 0 50-5

0

5

q

r

Go through all and calculate (x, y) are fixed

Sinusoid!

Page 25: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis25 DTU Compute, Technical University of Denmark

Real Hough Transform

Hough space

q

r

-50 0 50

-60

-40

-20

0

20

40

60

Page 26: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis26 DTU Compute, Technical University of Denmark

Real Hough Transform IIHough space

q

r

-50 0 50

-60

-40

-20

0

20

40

60

Page 27: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis27 DTU Compute, Technical University of Denmark

Real Hough Transform and lines

Hough space

q

r

-50 0 50

-60

-40

-20

0

20

40

60

Spot the line!

A maximum where Hough pixel has value 3

Page 28: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis28 DTU Compute, Technical University of Denmark

Finding the lines in Hough spacen The lines are found in Hough space where most

pixels have voted for there being a linen Can be found by searching for maxima in Hough

Space Hough transform

q

r

-50 0 50

-400

-200

0

200

400

Page 29: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis29 DTU Compute, Technical University of Denmark

The practical guide to the Hough Transformn Start with an input image

Page 30: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis30 DTU Compute, Technical University of Denmark

The practical guide to the Hough Transformn Detect edges and create a

binary image

Page 31: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis31 DTU Compute, Technical University of Denmark

The practical guide to the Hough Transformn Compute Hough transform

and locate the maxima

q

r

-50 0 50

-300-200-100

0100200300

Page 32: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis32 DTU Compute, Technical University of Denmark

The practical guide to the Hough Transformn Draw the lines corresponding

to the found maximan Here the cyan line is the

longest

Page 33: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis33 DTU Compute, Technical University of Denmark

Path Tracingn The diameter as

function of the distance to the optic cup tells something about the patients health

n We need to find the arteries and veins

n Path tracing is one solution

Fundus imageArteries and veins

Page 34: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis34 DTU Compute, Technical University of Denmark

Path tracingn A path is defined as a

curve in an image defined as something that is different from the background

n In this case it is a dark line

n Pre-processing can for example turn edges into dark lines.

Page 35: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis35 DTU Compute, Technical University of Denmark

Dynamic Programmingn Break up large problem into

many small sub-problemsn A classic algorithm:

– Dijkstra’s algorithm– One source to all nodes shortest path

n We will look at a simplifiedvariant

Dijkstra, E. W. (1959). "A note on two problems in connexion with graphs". Numerische Mathematik. 1: 269–271.

Page 36: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis36 DTU Compute, Technical University of Denmark

Path tracingn A GPS device uses path

tracingn Based on graph

algorithms– A city is a node– A road is an edge. The

weight of the edge is the fuel cost

n How do we come from Copenhagen to Aalborg using the least fuel?

n Dijkstra’s algorithm

Copenhagen

Aalborg

2.3 l

2.1 l

1.3 l

Page 37: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis37 DTU Compute, Technical University of Denmark

Images as graphsn Each pixel is a noden Pixel neighbours are

connected by edgesn The edge cost ( )is

the pixel value n Directed graphn Imagine a car driving on

the imagen Called a cost image

𝑐(𝑟, 𝑐)

Page 38: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis38 DTU Compute, Technical University of Denmark

Simplified problemn Track dark linesn Path going from top to

bottomn No sharp turns –

smoothn Problem:

– from the top to the bottom

– Sum of pixel values should be minimal

Page 39: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis39 DTU Compute, Technical University of Denmark

Simplified problemn Pixel value at (r,c)

equals the cost

n The path P consist of pixels

n The sum of pixel values in the path

𝐶(𝑟, 𝑐)

Page 40: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis40 DTU Compute, Technical University of Denmark

Path costn A path is defined as (r,c)

coordinates

P = [(1,3), (2,3), (3, 2), (4,3), (5,4)]

Page 41: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis41 DTU Compute, Technical University of Denmark

Quiz 1: Total cost – what is 𝐶<=<?A) 167B) 350C) 403D) 270E) 345

P = [(1,3), (2,3), (3, 2), (4,3), (5,4)]

Page 42: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis42 DTU Compute, Technical University of Denmark

Path costn This is NOT the optimal pathn How do we compute the path

P that has minimum 𝐶<=<?

n Test all possible paths?– No! Impossible amount of

posibilities

P = [(1,3), (2,3), (3, 2), (4,3), (5,4)]

Page 43: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis43 DTU Compute, Technical University of Denmark

Quiz 2: Path Cost

A path has been found in the image P=[(1,4),(2,4),(3,5),(4,5),(5,5),(6,4)]. A Matlab matrix coordinate system is used. What is the total cost of the path?

A) 196B) 154C) 201D) 185E) 132

Page 44: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis44 DTU Compute, Technical University of Denmark

Path restriction: The rulesn Path is only allowed to

– Go down– Move one pixel left or

right

n Longer jumps not allowed

Page 45: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis45 DTU Compute, Technical University of Denmark

Accumulator imagen Keeps track of the

accumulated cost for efficient paths finding

n Path ending here has cost 296

Page 46: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis46 DTU Compute, Technical University of Denmark

Computing the accumulator image

Step 1: Copy first row of input image

Page 47: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis47 DTU Compute, Technical University of Denmark

Computing the accumulator image

Step 2: Fill second row

Page 48: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis48 DTU Compute, Technical University of Denmark

Computing the accumulator image

Step 3: Fill all rows by looking at the previous row

Page 49: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis49 DTU Compute, Technical University of Denmark

Quiz 3: Accumulator ImageA) 57B) 167C) 301D) 241E) 145

An optimal path has been found in the image. What is the value of the accumulator image in the marked pixel?

Page 50: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis50 DTU Compute, Technical University of Denmark

Using the accumulator image

Step 4: The end of the optimal path can now be found

Page 51: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis51 DTU Compute, Technical University of Denmark

The backtracing image

• Keeps track of where the path came from

• Each pixel stores the column number

Page 52: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis52 DTU Compute, Technical University of Denmark

Using the backtracing image

Step 5: Trace the path in the backtracing image

Page 53: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis53 DTU Compute, Technical University of Denmark

Using the backtracing image

Page 54: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis54 DTU Compute, Technical University of Denmark

Quiz 4: BacktracingA) 1B) 2C) 3D) 4E) 5

An optimal path has been found in an image. The backtracing image is seen below and the optimal path ends in the marked pixel. A Matlab coordinate system is used. What is the optimal path?

Page 55: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis55 DTU Compute, Technical University of Denmark

Pre-processingn We would like to track

paths that are not dark curves

Page 56: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis56 DTU Compute, Technical University of Denmark

Quiz 5 : X-ray preprocessingA) Gaussian smoothingB) 255-IC) Gradient filterD) RegistrationE) Morphological operation

Page 57: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis57 DTU Compute, Technical University of Denmark

Pre-processing

Edge filtered image(Gaussian smoothing followed by Prewitt)

Page 58: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis58 DTU Compute, Technical University of Denmark

Path tracing on pre-processed image

Paths found on pre-processed image

Question from students:The prewitt filter (moving the filter from left to right) show an edge as highintensity when it is a image intensity change from low to high (red path).However, the “blue” path shown is from an edge coming from an imageintensity change from high to low, and therefore will appear as low intensityvalues (not easy to see).

Page 59: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis59 DTU Compute, Technical University of Denmark

Quiz 6: Optimal Path 2

A) 81B) 64C) 11D) 73E) 51

A 5 x 5 image is filled with values given the gray level run length encoding: 2, 180, 1, 15, 3, 112, 1, 8, 4, 177, 1, 20, 4, 195, 1, 12, 3, 242, 2, 25, 3, 9. After that the optimal path is found. What is the total cost?

15+8+20+12+9=64180 180 15 112 112112 8 177 177 177177 20 195 195 195195 12 242 242 24225 25 9 9 9

Page 60: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis60 DTU Compute, Technical University of Denmark

Locating Circular Structures

• Define origin inside structure

• Send out spokes

Page 61: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis61 DTU Compute, Technical University of Denmark

Locating Circular Structures

• Each spoke is a line in a new image (surface- layer detection)

• Prewitt• Dijkstra’s algorithm• Map back the spokes into image

Page 62: 02502 Image Analysis Week11 –Hough Transformation and Path ...courses.compute.dtu.dk/02502/Presentations/02502 - week11_TD_vo… · What can you do after today? nUse the Hough transform

DTU Compute

2019Image Analysis62 DTU Compute, Technical University of Denmark

Next week

n Statistical shape analysis