Portraits with OpenCV and Neopixel

drone4ya z
Nov 2, 2020

NeoPixels are cool and we all know that. Who doesn't want an RGB led with an embedded controller? I got excited and ordered a few, I mean little more than a few. Played with them built chasers, rainbows, etc. Then they sat in my closet till I got this idea.

Then on one day, I was taking pictures with the phone but the results were not coming as I expected. I was expecting the green canopy to cast shade on the subject similar to what my eyes are seeing. I tried post-processing but then the results were meh!

I knew I need help from Raspberry Pi, a swiss army knife for tinkerers. So I embarked on a journey to build a light that shows the most dominant color in the frame. That’s where OpenCV was useful.

Simple flow to do this was to:

  1. Read camera frame
  2. Crop the image to the center region
  3. Find dominant color in the region using OpenCV implementation of KMeans
  4. Pass the color to the NeoPixel

Will post the code and resulting images soon.

--

--