Calculating amount of colorization for a psychological study

By silviodc, 21 July 2019

Recently I got approached with the request of automatically calculating how much of an image got colorized by a test subject. In this case they had to draw on the shape of a human body to describe which parts of their body reacted most to the experiment.
So we have a test sheet with some text on it, an area with the subject code and the actual image we are interested in.

Since I can’t use the real data as an example, I made my own test where 3 participants were asked to draw on a map where they have been already:

Since this is just dummy testing data it does not look very nice 😀

But it helps to understand what I am talking about^^
So this image should correspond to a coloration of 0%

I then created an image where whole Austria is filled, which corresponds to 100%.

Since this was just a quick project I am not considering the exact border lines, but a rectangle which contains the whole country. That means if one of my test subjects has been everywhere and is sloppy with colorizing, and draws over the borders, he can even reach a percentage above 100%

The output will be written in a csv file and also directly in a small image with the information and the test subject code, so it can’t be mixed up.

The sourcecode with the example files can be found on my github page again 🙂

The output of my testdata looks like this:

Welcome to our image processing skript
Today we are testing 3 sample files

Image Height: 951
Image Width: 1098
Image Shape: (951, 1098)

Selection Height: 601
Selection Width: 1098
Selection Shape: (601, 1098)
Selection Pixels: 361201

Dark Pixels in a non colored image: 21139

Dark Pixels in a fully colored image: 308705
Image 1
Colored Pixel: 44136
Color Percentage: 15.3 %
Image 2
Colored Pixel: 8090
Color Percentage: 2.8 %
Image 3
Colored Pixel: 142854
Color Percentage: 49.7 %