Skip to content

A Shape Finder using Corner-Harris and Heirarchical Clustering

License

Notifications You must be signed in to change notification settings

perseus784/Shape-Finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shape-Finder

A Shape Finder using Corner-Harris and Heirarchical Clustering.

Prerequisite:

How is this method different from other shape finders:
Generally, all shape finders will use number of arcs to determine the shape of an object. But this method uses Corners of an object to determine it's shape. Using this method we can find the length of the arcs, angles and more.

Okay, how it is done ? Glad you asked, We can easily find corners using Corner-Harris method!
The issue is Corner-Harris is not very accurate in real time. If we give it a triangle, it should give only 3 corners. Instead, it gives us 30-40 nearby points for each corner.

Now our task is convert this 120 points into 3 corners.
After some search and learnings from AI techniques, it's found that Heirarchical Clustering is the way to do it.

Heirarchical Clustering:

Two liner: It's a Machine Learning technique used to group bunch of points without giving any idea or mentioning number of groups required. Unlike traditional Clustering, we don't have to give to how many groups it should be seperated.
It is simply demonstrated here.

Those stars represent an individual group for each cluster.

hr

Groupify the seperate clusters:

Run this.
Supply Image:
For simplicity, we give it a image containg triangles.
We did some contour detection for selecting the triangle for a particular color.
In this case, we select Red one as our target triangle.

tri

Find Corners:
Now apply Corner-Harris to find the corners in the contour.
We found some bunch of points in each corner, we will have find the actual corners from this by applying Heirarchical Clustering.
Once we apply HC, it is gonna look like this in graph:
That Star represents the center that it found for each cluster.

matplot

Visualization:

opencv

Output:

We got 3 corners, it is easy to determine it's shape and we can do more operations from other informations like below:

op

Releases

No releases published

Packages

No packages published

Languages