180 likes | 195 Views
Finding Polygons with K edges in an image. written by Gidi Sidis. Motivation. This is one step further in Perceptual Organization (after lines circles…). Automated machines can use this function in order to scan images and identify pieces
E N D
Finding Polygons with K edges in an image written by Gidi Sidis
Motivation • This is one step further in Perceptual Organization (after lines circles…). • Automated machines can use this function in order to scan images and identify pieces • Analyzing satellite or airplane images (searching for buildings and etc’)
How can it be done ? Let the following image be our subject: And let’s say we want to find all polygons with 4 edges.
The main idea is to find all the lines in the image by doing edge detection and using Hough Transform on the result. edge detection
After all lines have been found we search for each line the appropriate segment(s) in the image. When done, we create a matrix of size num_segments * num_segments neighborhood matrix of size 5*5 Segments found - marked on image Comment: There are 2 matrixes do to the fact that a point is represented by (x,y)
For each segment i and segment j that intersect, we update the matrix(i,j) to be the intersecting point. neighborhood matrix after updating X Segment 5 Segment 3 Y (62,94) Segment 2 Segment 1 Segment 4
2 3 1 4 5 • Basically, we found a neighborhood matrix of all segments which represents a graph where each segment is a vertex, and each intersecting point is an edge.
we found a circle of 4 edges long • All that remains to be done is to scan the graph for all circles of size K. Each circle is a polygon of K edges in the image. neighborhood matrix after updating
Some problems in implementation • The algorithm is highly sensitive to inaccuracy (which is a side product of transforming from continuous to discrete and vice versa), plus there is numeric inaccuracy done by the cpu which have a finite memory space. • The algorithm is sensitive to noise in the image. • The problem of finding all circles in a graph is a NP Hard problem.
Some solutions to the problems • For the first and second problem as stated previously, the simplest solution is to use an ε environment for all numeric calculations that deals with binary comparison (as in the case of 2 segments intersection and etc’).
For the third problem, there is no simple solution (if there was I would be a very rich man…), however, we are not scanning the graph for all circles but only the circle of size K thus we can block the running time to N^K where N is the number of segments found in the image (notice that the number of segments is much smaller than the number of edge point which by them the Hough Transform runs).
Some Conclusions points • The problem of finding polygons in a complex image, especially a noisy one, is fairly hard and will not be treated well by this algorithm / program, however this algorithm could be useful and will give pretty good results for simple images. • You can check out the implementation pseudo code and more information in my final report at: www.cs.bgu.ac.il/~sidisg/vision_project_report.doc • You can check out the MatLab program which implements the algorithm at: www.cs.bgu.ac.il/~sidisg/find_polygons_program.zip
more examples The result of searching for all 4 edges polygons
more examples cont. The result of searching for all 3 edges polygons
more examples cont. The result of searching for all 5 edges polygons
more examples cont. The result of searching for all 4 edges polygons