Counting Lights with OpenCV

Light-up decorations always seem to have weird bulb counts. When a bulb burns out, you’ll need to calculate the voltage for the new bulb by counting the length of the string. This was the decoration in question:

pumpkin

I briefly considered spending 10 seconds to count each light. But that was silly. I could do the same job in an hour using OpenCV! Having never used OpenCV before, it turned out to be a decent introductory exercise. Using some HSV ranging, and simple blob detection, I was able to get rough counting working. For those curious, I threw the (very hacky) program in a gist.

pumpkin_blobs

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s