We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hello all,
i have a question about shape recognition. to simplify my question i will take a simple example. let's say i have a pattern like in the image
i want to get the exact number of appearance of the shapes. as you can see, i have three different shapes that appear in different ways and rotations, in other examples it could be in different sizes(scale). my file is vector , an SVG file. i was wondering how can i do that, parsing the SVG, go through every shape and telling with shape is what. i have no idea how shape recognition works, but i am familiar with SVG, geomerative... any example or library could be helpful..
thank you in advance
Answers
Use OpenCV or BoofCV
hello jeremy, thank your for your answer.
i don't know much about computer vision and shaped recognition, if you have any good tutorial to recommend me that will be helpful.
the advantage of using SVG ( i create) is i can change the colors and other aspects of it to fit my needs. so to answer your questions.
the shapes are always tiled, i gave a simple example to start but it can be more comlex
the advantage is that i already know every piece/shape, they are like alphabet, so the choice is limited to a list of pieces/shapes.
maybe in the future i would love to scan a real patter from a wall or ground and decompose it like in this example
2.Are the tilings always regular?
as you can see the tiling is not always regular, it is radial some times, but it can change
no shaped is nested inside an other, it is always again puzzle
the shapes are overlapping in the edges, every shape is touching the shapes around and the vertices of one side are always above the vertices of some neighbor
as i said before, i can change the colors or the pattern, commonly, they are filled with and altering colors
hi guys,
i tried boofcv, and openCV, i played with the examples and i could get lines from or edges from my binary image, but i have no idea how to go from the edge detection to shape recognition. any good tutorial or hint ? is it possible to store my shapes in a separate file and ask the program to detect the closest shape from my image to the shapes in the list?
This is not easy, although there might be some shortcuts.
Here are three example discussions of dealing with this problem in OpenCV (not Python specific). Your case is on the complex side because you have a wide variety of different polygons.
https://stackoverflow.com/questions/11424002/how-to-detect-simple-geometric-shapes-using-opencv
https://stackoverflow.com/questions/9663841/how-to-extract-simple-geometric-forms-from-contours-in-opencv
https://stackoverflow.com/questions/22023923/shape-detection-in-python-using-opencv/22042006#22042006
However, these approaches are meant to be robust as through a camera and uneven lighting. You have a precise image and know the exact shapes ahead of time -- although not their orientations. This suggests that you could use a very simple "image registration" approach -- slide your candidate shape across the entire image at a given size and orientation, and score each pixel by how close it is to a perfect match. This has been applied to fractals and tessellations in the past.
https://en.m.wikipedia.org/wiki/Image_registration
http://ieeexplore.ieee.org/document/5413618/?reload=true
thank you a lot jeremy , that is a path i am willing to follow. :)