Inspiration

One of our groupmates wanted to be green. So why not?

What it does

We used k means clustering to detect and produce a palette of the most prominent colours in any image uploaded by the user. Then, selecting these colours from the palette, the user may change that colour, to change all colours with a similar shade in the actual image, while keeping the changes relatively smooth and natural. Alternatively, users may also import colour palettes from other images to the current one.

How we built it

We built it through a combination of matrices, image processing, and assorted overcomplicated math algorithms. First, we needed to analyze every pixel in the image, applying a repeated K means clustering algorithm to find the optimal number of nodes, or in other words, the amount of prominent colours within the image. Too find this, we simply ran the algorithm several times and found the break point. We then ran the algorithm one last time with this optimal k amount to actually produce the clusters, as is important to find similar shades. Then we detect user changes too the palette, where we apply them to the actual image, either through shifting the values of the cluster itself, or finding a weight through gaussian function falloff based on difference in colour and distance and then applying it to the image (this makes it a lot less ugly).

Challenges we ran into

We had trouble with the UI starting out as initially, we used streamlet. However, pending issues with this framework, we were forced to change to tkinter- custom. Another issue was simply how many bad ways to do this that there were, as while it may seem simple, image processing needs to take a lot into consideration, such as gradients, anti-aliasing and shading. We continued to find different solutions, but almost never accomplished what we wanted to do.

Accomplishments that we're proud of

We're proud of actually creating what we set out to do, which is a way too change a select color without out it being too repulsive.

What we learned

We learned quite a bit about image processing, as just isolating and changing a colour while keeping it natural and smooth was quite a challenge. We also had to learn a lot of front-end on the fly, as our designated member for that had to drop out right before this event started.

What's next for OurColour

The code is pretty slow, and could stand to be optimized a bit

Built With

Share this project:

Updates