How to: Pixelise a webcam stream using OpenCV

There was a video the other day which I posted about where the video footage was all highly pixelised into circles of varying sizes and colours, and I reckoned I could produce a similar effect by either resizing the stream down so it’s really blocky then scaling it back up or reading all the pixels in a block, averaging the colour and then drawing blocks of that averaged colour.

Well, I had an hour or so today to do a bit of “me-coding”, and in the end I took the second option.

Pixelised Webcam Stream

The pixelisation works on the live stream, and you can drag the slider around to switch through from 1 division (i.e. the entire window is one block of solid colour) to 160 divisions.

I’ll bring the values into OpenGL and see what I can do with points and the like when I have another hour or two spare over the coming few days – fun stuff =D

Source code after the jump for those interested…

4 thoughts on “How to: Pixelise a webcam stream using OpenCV”

  1. Hello,

    great stuff, thank you.

    Do you think it would be possible to just pixelise 50% of the image? With a vertical border in the middle of the image, so that one half is the clearly streamed image and the other half is pixels?


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.