icfpcontest2022 / mini-vinci

MIT License
0 stars 0 forks source link

[Design and Implementation] Baseline Solutions #11

Open alpaylan opened 2 years ago

alpaylan commented 2 years ago

We need a naive baseline solution for testing our system and designing a nice cost function. @mkaynarca and @GoktugEk will be separately working on their own implementations. You can discuss algorithmic ideas here and come up with separate implementations of course.

mkaynarca commented 2 years ago

Hi, I'm the naive solution guy. Before I start to explain my solution, I want to mention that I am not an actual CENG guy, thus I might label/name/mention some terms wrong. In that case please feel free to correct me. Moreover, as a person, I am not a fan of formal writings nor that I can not write properly in any formal way, thus sometimes I can be interpreted as not taking it seriously. I guarantee that this is not the case.

The base of my solution can be defined as "every painting is made of areas of same or approximately equal colors". First we have to divide the picture to areas, then we have to color them as long as the cost is less than the outcome.

How do we define the areas?

Let's say that we have a picture and canvas that is length L and width W. Thus we have LxW pixels. Every pixel has a value in between 0 and 255 for Red, Green and Blue channels. If we think every color as a dimension, we can say that every pixel is a vector in 3D, which makes a picture a vector field contains LxW vectors. If we take the gradient of this vector field for each channel, the outcome would be another vector field that shows the change of the color in each channel. enter image description here If we define a threshold value to determine whether the change in that pixel would be enough to consider as an area border, we can define the areas in that picture. Notice that higher threshold defines the change between let's say red and blue while lower threshold defines the change between light and dark blue. Thus threshold controls the fine tuning for defining areas.

How do we pick the color for the area?

As I said before I am the naive solution guy. Just take the average of the pixels.

Solution Our canvas is blank. Define the areas with predetermined threshold value, cut the areas and color them. Focus on the first area and lower the threshold. If it is dividable and worth of the cut and color cost, divide again and focus on each one individually while lowering the threshold, color again. If not, move on to the next area.