PDA

View Full Version : Shape detection / recognition



Talei
10th April 2014, 11:15
Hello,
I'm looking for a way to detect shape that is QImage (I know that OpenCV can do that but I don't want to use that lib in code) or as QPainterPath.


Basically what I want to do is this: user draw rectangle, mouse move do create QPainterPath and now using that painter path I would like to detect shape that was drawn, in this case rectangle. The problem is that rectangle can have variable angle and can be imperfect. This also need to distinguish other shapes like circle, triangle etc.

Any idea about solving this problem are more then welcome.

wysota
10th April 2014, 11:37
There are many algorithms you can use based on different AI systems (e.g. neural networks). In general the problem is called "Classification" and the general approach involves teaching your classificator different shapes and then feeding it with the actual shape and asking it to classify the shape as belonging to one of the sets learned earlier. The algorithm itself depends on the actual task you want to solve, in your case a somewhat naive approach would be to feed the classifier with an ordered set of vertices forming the path.

Here is an article to get you going:
http://en.wikipedia.org/wiki/Statistical_classification