jeudi 12 octobre 2023

Grouping tiles in a mesh to roughly rectangular shapes

I am trying to write a program which produces a word cloud from a given image similar to:

enter image description here

I have split up my image using thresholding, and created a mesh / tile grid using kmeans:

enter image description here

I can't think of a good algorithm to group together tiles so that they form approximatley rectangular shapes.

I have an algorithm which warps rectangles to fit distorted polygons, so I just need a way of grouping tiles together.

My current method just places the word polygons (rectanglular) and finds the position with the most tiles covered:

enter image description here

Aucun commentaire:

Enregistrer un commentaire