Inspiration
Resistors have coded colored bands that you can use to tell their resistance values. We have a friend in ECE who is red-green colorblind, so he can't read resistor color bands, because he can't distinguish them.
What it does
You put a resistor onto the green plate and its camera reads the color bands, and tells you the decoded value.
How we built it
We designed a housing for the pi and the camera that would ensure even lighting for the video. We took training images of resistors and trained our computer vision algorithms to recognize the resistors and their colors. Then we designed a display to show the decoded values.
Challenges we ran into
Our original computer vision algorithm was too slow for the raspberry pi.
Accomplishments that we're proud of
We're proud it works at all!
What we learned
We learned about the importance of good training data and the importance of starting early.
What's next for Resistance Is Futile
Adjust the housing: Make it more robust. Improve the CV algorithms to both run faster and give better results. Maybe add a sorting feature in a future iteration.
Specifics of the implementation
Don't judge us too much, this was a hackathon, not a Computer Vision homework!
Training:
- We take training images and manually pick out the resistor color bands and the background.
- We train a NormalBayesClassifier (
bg_classifier) to recognize the background vs the resistor. - We train a NormalBayesClassifier (
color_classifier) to distinguish the different resistor colors.
Running:
- capture an input image
Iand convert it to the CIE L*a*b* color space - Down-sample
Ito 256x256 - Apply
bg_classifierto each pixel to get a rough estimate of foreground vs background - Apply the morphological opening operator with a 5x5 box kernel (5 iterations)
- Find the largest contour
Cin the resulting image, check its area is in the range [800, 2300] pixels. - Scale up
Cand pick the corresponding pixels from the original (not down-sampled) image I - Apply
color_classifierto each pixel in the contour. - Find the 3 most commonly occurring colors. (We're not looking for the gold/silver bands!)
- Find the centroid of the contour
C - Find the centroid of the pixels in each of the most commonly occurring colors
- Determine which color
rhas the centroid furthest from the centroid ofC. This is the color band on the edge. - Sort the other 2 colors by the distance from their centroids to the centroid of
r. This should give us the correct ordering of color bands. - Look up the color bands in a table and display the result.

Log in or sign up for Devpost to join the conversation.