Android app using OpenCV that scans resistor colour bands to determine their values
Resistor Scanner is an Android app that uses OpenCV to scan resistor colour bands and determines their values.
Tested on a Nexus 4. Note that white balance differences with other phone cameras might require tweaking colour ranges in ResistorImageProcessor.java
ResistorCameraView extends JavaCameraView and enables the flash and zooms in fully (I found this was the best way of getting clear images with a somewhat consistent white balance)
ResistorImageProcessor contains the colour detection logic. It scans a small area below the red line indicator for the colours defined by COLOUR_BOUNDS, and generates contours for these regions. It stores the colour code value vs x-coordinate of the centroids of these contours in a dictionary.
The resistor value is then calculated by iterating through the x-coords of the centroids in ascending order and using their associated codes. (This requires the resistor tolerance band to be placed on the right side).
Note that this app works best when the resistors are on a light background.