Some debug art from a shape recognizer.
I use mouse clicks to draw a shape on the left. Compare it against the templates on the right. The last column shows the best matches between points in the shape and the templates.
I’m using $P algorithm. https://depts.washington.edu/acelab/proj/dollar/pdollar.html
The above is an example of a success but sometimes I get poor results like below.
Here I draw a rectangle and shorts are a closer match than the square because of the aspect ratio of the rectangle. The score is actually quite good as well, similar to the score for the rainbow in the first screenshot.
So that presents a problem. I think I need to find some way to detect features in the shape, not just compare point distances.
I saw an algorithm that traces the outline, determining for each point whether the points around it form a straight line, an interior angle, or an exterior angle.
…
Here we go. Turning functions.
Here’s a slideshow by Philip Mitchell at Waterloo. https://student.cs.uwaterloo.ca/~cs763/Projects/phil.pdf
This slideshow by Ming Zhang uses turning functions as just one of three options. https://www.cs.princeton.edu/courses/archive/spr00/cs598b/lectures/polygonsimilarity/polygonsimilarity.pdf
One of the other methods is G-Graphs: slice the shape into strips. Each strip is a vertex in the G-Graph and adjacent strips are connected. Now compare the G-Graphs.
Pretty cool to think of a polygon as a graph. Also allows for simplification by deleting leaf nodes from the graph.
The third method is even weirder. It seems to involve shrink wrapping the shape on the outside and similarly from the inside. Comparing the distances between the two resulting polygons generates a signature which can then be compared. That one’s harder to imagine how it would play out.
…
Here’s a paper that predicts a building’s function based on its footprint. https://www.researchgate.net/publication/399984989_Predicting_Building_Types_and_Functions_at_Transnational_Scale
They’re using a neural net for it so not relevant here but that’s an interesting application.
…
Okay, so it’s drawing the template turnings now I just need the input turnings and then compare with sliding and reverse.