You are on page 1of 30

Method of edge detection using 1-D liner image maps sampled from images at any angle

Author : Arnab Pal

[arnab.pal@msn.com]

An accident
Noise during 1-D mipmap generation while re-creating 1D bump-map textures on under-performing graphic-cards

Motivation
Noise sounds like a reason to reduce intensity difference Facts: Decision for intensity difference reduces to one dimension (may be linear) So? Takes less computation for an easier decision

Initial experiments
Assume this 1D line sample cut-out from a real image

And here are some probable edge differences


Look for the while spots (the pixels are purposely replaced by white)

Looks positive, so far

Time to decide on some strategies and apparatus


What we need :
Color subtraction A general line sampler (parameter = angle) Data structures Not forgetting the how-tos

Color subtraction
It is important to find the distance between 2 colors Red / Green / Blue it is considering either one aspect or an average Hue / Saturation / Brightness they are actually functions of RGB, not very different How about mapping mapping RGB to XYZ axes of a 3D space What???????? Lets think again are they actually different? If not, we use our geometry formula to find distance

Color subtraction continues


The shortest path between 2 colors in a hypothetical 3D color space
+R
R=255;G=0;B=0

r2,g2,b2

r1,g1,b1

+G
R=0;G=255;B=0

R=0;G=0;B=255

+B

Distance = Sqrt((r2-r1)^2 + (g2-g1)^2 + (b2-b1)^2)

Line Sampling
de 0 e re g s
0d 9 e e re g s

65 degrees

15 degrees

any angle (theta)

Please remember that the lines are not far spaced as shown in the diagram. They are actually touching each other (a gap of 0 pixels).

Strategies and Data Structures


Strategy 1: Bounded and Sorted collection for MaxEdge based sorting
14,3,7,4,19,9,6,32,2,18,0,0,61,12,0,19,1,48,27,27,0,0,0,27,62,50,21,7

State of collection after adding above items


MaxEdges = 6 62 61 50 48 27 27

Strategy 2: A stack to push sign of an edge and pop when opposite sign is received. 2 edges are added when all items until common sign in popped

We start to mix everything in a meaningful way


Programming language : C# Sample images:
General images from everywhere Medical images Images and results from experiments conducted on several other edge detection algorithms (for comparison) Some coding and debugging skills

Flowchart of proposed algorithm


[1]
Get Image

[2]
C* = Color subtraction strategy D* = Data storage strategy

[3]
+Get MaxEdgePoints or CurrentSaved EdgePoints

Split image into list of 1D scan line images using angle

pixel = 0 (current)

Create a 1D image of same height as original image with EdgePoints marked in white. All other pixels marked in black

Foreach 1D scan-line or texture do [2]

Using C; get difference = image[pixel] image[ pixel +1] Return generated image to [1]

Arrange 1Dscan-lines In same format and create output image

Using D store (difference and pixel)

pixel = pixel + 1 (increment) Y

* For D strategy algorithms see next slide

* For C color subtraction see Slide 6 & 7


pixel < image_height N Goto [3] with D + Remember; MaxEdge points are not all points added to the data store. DataStore intelligently saves edgePoints based on parameters. See next slide for how

Flowchart Data storage strategies [D marked in previous slide]


MaxEdge based
Input (Difference / Pixel)

+/- Stack based


Input (Difference / Pixel)

Add difference/pixel pair to sorted list of differnce/pixel pair

Comparison between 2 strategies to generate edge points from a scan line

For + difference push the diff/pix pair

If sorted lists length > MaxEdge delete the last difference/pixel pair (last diff/pix pair = smallest differnce)

D1

D2

For - difference, Pop all diff/pix pair until a + diff is found and add 2 edges. (1 for last item poped and 1 current)

Get EdgePoints
Return pixels from diff/pix pair generated at the end of a scan (essentially these are the max difference edge points in a scan line)

Get EdgePoints
Return pixels from diff/pix pair generated at the end of a scan (essentially these are the edgePoints Saved while popping from stack)

Rest of the slides contain results, screenshots and comparison

Source: http://www.uweb.ucsb.edu/~shahnam/AfED.doc

Source: http://en.wikipedia.org/wiki/File:Valve_monochrome_canny_(6).PNG

QnA