Shapes and curves recognition

   965   4   1
User Avatar
Member
3 posts
Joined: Sept. 2024
Offline
Hi everybody,

I've been tasked with creating a landscape dotted with buildings, out of a hand-drawn bitmap of an area.

To keep it simple let's imagine the picture has a black background and just two sets of symbols: yellow triangles for houses and red circles for buildings (but eventually there will be more symbols and colors).

How do I convert those hand-drawn symbols into coordinates that I can then use in Houdini to place the correct models for each category?

At this point I'm considering it a computer vision problem and I'm thinking of using a python node taking advantage of some kind of external python library to categorize the shapes, find their bounding boxes and out of the centroids generate a list of points with a category attribute.

Is there an easier way?

Kind regards, Manu
User Avatar
Member
144 posts
Joined: Aug. 2012
Offline
Trace, Extract Centroid?
User Avatar
Member
8 posts
Joined: Oct. 2022
Offline
Yeah. As Jillian said, you can take an image as input and use the trace node to generate a polygon or curve from the edges in the image. You can then loop over the connected pieces and extract centroid from each one using the Extract Centroid node or a point wrangle. After the for loop you’ll have a list of just the points that are at the center of the icons in the image. As for placing the right kind, you can attribute transfer color from the image to your extracted centroids, and use the new color attribute to drive a name or piece attribute for your copy to points down the line.
User Avatar
Member
3 posts
Joined: Sept. 2024
Offline
Thank you both for your input. Indeed it solves the problem as I stated it, which is a simplified version of the full challenge.

More specifically the icons I've been describing will be arbitrary and the color might be related to a different set of information. In short I need to recognize that an icon painted on the input is a specific alphanumerical character.

I realize this increases the scope of the original question. And the way to gather the position of those symbols, with centroid, remains valid. It's just how to recognize those symbols that remains the key issue.
User Avatar
Member
144 posts
Joined: Aug. 2012
Offline
I don't think there is built-in character recognition functionality in native Houdini nodes. It sounds like a computer vision problem, which could be processed by the third-party MLOPs package.

If your input data is mostly consistent (i.e. all the symbols use the same font), then you can try to brute-force the pattern matching, using the Font SOP (set to matching font) to create examples of symbols you want to match against, Match Size to align, and Boolean to compare difference.
  • Quick Links