Dominant Colors in Movies

Inspired by Nordlicht I made a small program that finds the most dominant colors in movies. Using k-means clustering, it builds a color palette with 32 colors and calculates the number of pixels with smallest distance to the cluster centers.

As it would be far too computationally expensive if clustering worked on the complete set of full-sized images of a movie, I only extracted one frame per second and scaled it down to 16×16 pixels. Moreover, I cropped black borders from each frame, and removed all logos at the beginning as well as the credits at the end. This avoids having meaningless black pixels in the clustering process.

Some results are shown in the following images. The pie charts show the colors and their frequency of occurence. The bar below shows just the colors.

Big Buck Bunny
Big Buck Bunny

Big Buck Bunny

District 9
District 9

District 9

The Lord of the Rings: The Fellowship of the Ring
The Lord of the Rings: The Fellowship of the Ring

The Lord of the Rings: The Fellowship of the Ring

Mad Max: Fury Road
Mad Max: Fury Road

Mad Max: Fury Road

Shrek
Shrek

Shrek

Star Wars: Episode I - The Phantom Menace
Star Wars: Episode I - The Phantom Menace

Star Wars: Episode I – The Phantom Menace

Star Wars: Episode IV: A New Hope
Star Wars: Episode IV: A New Hope

Star Wars: Episode IV: A New Hope

The Dark Knight
The Dark Knight

The Dark Knight

The Social Network
The Social Network

The Social Network

The code is on GitHub. The D3-based generator for the pie charts can also be found on JSBin.

Advertisements

Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: