A7: Colour Coding
This activity focused on using colour values to pick out objects in an image. I’ve always wondered how image segmentation worked with coloured objects, and this activity gave me a lot of insight in the process. I quite enjoyed bringing out the inner demon of my chosen image. You’ll see what I mean soon enough.
Okay, to begin, we had to familiarize myself with normalized chromaticity coordinates (NCC), which were used to represent the colour values in our images. Basically, we can take the colour of a single pixel and represent it in values of Red, Green, and Blue. If we choose our coordinate system such that the sum of all three values representing red, green, and blue must be equal to 1, we can instead represent this colour using only two coordinates; chosen here to be r and g.
With that laid out, let me introduce you all to my test image: Happy Rabbit.
It’s so cute.
So we had two methods of segmentation to cover: parametric, and non-parametric.
Parametric Segmentation
This method relies on a Probability Distribution Function (PDF) generated from a selected subregion within the region of interest (ROI) we want highlighted. Here’s what I got from a particularly orange part of Happy Rabbit.
So this should give an idea of whether or not a pixel can be considered as part of your ROI depending on its r and g values.
With this, we found the probability for each pixel in the Happy Rabbit image to be part of the ROI. The result is... frightening.
The demon is rising. So to help Demon Rabbit enter our world, we set a probability threshold for which points should be considered in our ROI. Naturally, decreasing the threshold allows more points to be considered, but these points might not be part of Happy Rabbit, but instead part of the soft fabric it rests its happy body on. It’s up to us to find a good threshold.
Non-Parametric Segmentation
This method relies on histogram backprojection. Basically, we take the NCC histogram for our subregion, and use this to pick out pixels that should be included in our ROI. It’s kind of like having a a phone book to look up numbers you wanna call.
And with this histogram, we got Demon Rabbit v2.
No thresholds here. The segmentation is entirely dependent on the subregion chosen, and because of that, it can include a wider variety of colours in the segmentation, shown here with most of the shadow and face now being included, in contrast to our previous Demon Rabbit.
Now wasn’t that fun, summoning forth the Demon Rabbit from the abyss? I think it was. And hey, I also accomplished the requirements for this activity. Not bad, if I do say so myself. I’ll give myself a 10 out of 10 here for that. I didn’t really explore far beyond what was asked, so I don’t think I deserve any bonus points in this one. All in all, I had a good time.
Long live Happy Rabbit.
Here are my Acknowledgements and References:
Wondercat, the creator of Happy Rabbit
Anthony Fox, my classmate and friend who explained to me about histogram backprojection














