Image Analysis
I have always been interested in photography. Instead of presenting a gallery of photographs I have taken I wanted to look deeper at the images and present not only the image but some analysis of it as well. If you would like to see more photographs I have taken they can be found here.
DATA - Selection of jpegs from photos I have taken.
METHOD - A python script was written to process each image file. As the purpose here is to illustrate process and not particularly the application of rigorous image analysis science, the attributes analyzed will be the dominant color and the five color palette it is comprised of. We will use a method of vector quantization, k-means clustering to calculate these attributes. The code can be found by clicking the black button below.
CONCLUSION - Fundamentally, this analysis serves to provide some quantified insights into images in a gallery. That being said, one might conclude from the analysis here that apparently I like to take pictures with a lot of grey in them…
Here is a closer look.
There are many attributes that can be considered when doing image analysis: background subtraction and segmentation, sparse optical flow or comparing histograms are only a few. To keep it simple we are going to look at some rather superficial attributes. We will process images and render an array we can analyze. The array will contain basic information contained in the image relating to the red, green, and blue spectrums (RGB) they contain. For instance, when we examine the following image, we can extract those chromatic spectrums and print them:
These spectrums are emphasized here but do not represent the visible colors of the original image as can be seen in the following.
Quantifying color proportions allows us to consider them as dimensions in a coordinate space. Each color representing an axis in that space will provide a way for us to examine this image from a different perspective. We can use R to plot these RGB attributes in a 3 dimensional color space.
For our purposes we can continue examining these superficial attributes. Next, we determine means of each chromatic channel and then run k-means clustering algorithm on the image to determine the color palette of the image. Finally, we assign those calculated attributes to objects for plotting. What we end up with is the ability to present an image along with quantified descriptions of what is seen. We find the average color of the image as well as its dominant color palette.
Now we have developed our script to analyze each image. Let’s run the analysis and display the gallery of images along with data for each.