Reputation: 191
I am using OpenCV to identify and deskew price tags from pictures. I used Probabilistic Hough Transform function to identify the edges in the picture. I am having trouble identifying the price tag quadlateral in the image.
I am attempting to group each edge/line by its slope and axis intercept. Here is an example of the image and data.
In the image, shorter edges are drawn in red, edges of medium length are drawn in blue, and longer edges are drawn in green. In the graph, the slope is plotted on the x-axis, intercept on the y-axis. The left and right hand graphs are the same except the length of the line is represented by the area of the circle.
I am looking for a way to group these clutters and then determine average line represented by each cluster. I hope to use the the groupings to identify the two most probable edges for both horizontal and vertical lines that bound the price tag.
Does anyone know an appropiate algorithm I could use to identify the groupings?
Thanks.
Upvotes: 3
Views: 1087
Reputation: 191
So after a bit of searching I decided to use the k-Means algorithm. For anyone that may be curious, here are my results:
I ran the algorithm and split the lines into 9 clusters. Although this is not exactly what I was looking for (I wanted to reject extreme outliers as opposed to forcing them in a cluster) the results are fine and will be manageable.
Here is a picture of the horizontal lines, extended and colored by cluster:
And here are the vertical lines:
Upvotes: 1