Camera Colour Counter
Camera Color Counter
This app is a counter based on the measured color from the camera preview image.
A blue box indicating the target area is shown on the camera image. The target area is analysed and the average colour then used for counting.
Measures RGB (Red, Green, Blue) and then calculates HSL (Hue Saturation, Lightness) and YUV (Luminance and Chrominance). Also includes an indicator of the color uniformity in the analysed area.
Up to 100 counters can be set with different trigger options. Either count when a certain colour is detected (defined by a range in HSL), or when a value such as the red, green or blue component passes a set level.
• Use front or back camera. Zoom in or out and lock focus or exposure. Turn camera flashlight on if available.
• Graph of values over time. Hue-Saturation diagram. Triggered counts indicated with red circles.
• Vibrate or Sound effects on button presses and/or count events.
• Pause button to pause measurement, and measure button to take measurements one at a time.
• Hexadecimal RGB colour code shown in plot mode.
Note that the camera and screen of your device might not measure or represent color accurately, therefore for Indication Only.
The app has three modes (Edit, Plot and List), selected with the buttons to the left of the camera preview.
In Edit mode, the counter names and count detection parameters can be changed.
In Plot mode, more detail about the measured color is shown. A graph showing the history of the measured values, a Hue-Saturation diagram and Lightness-Saturation plot are shown.
In List mode, all the counters are shown in a scrollable list. The list can be re-ordered by long holding on a counter item and then dragging it to its new position.
To the right of the camera preview are some controls for the camera:
Zoom - These buttons allow the camera to be zoomed in or out. Hold the buttons down to zoom in/out faster.
Focus Lock - This will lock the auto focus.
WB/Exp. Lock - This will lock the white balance and exposure.
Torch - This turns the camera LED on if available.
The target area for analysis is indicated on the camera preview with a blue box. The target area can be adjusted in the main settings (top left).
RGB, HSL and YUV
Color can be described in a few different ways. Three methods to describe color are included in this app (RGB, HSL and YUV).
The camera preview target area is analysed and the average Red, Green and Blue values are determined. From these RGB values, the other values are calculated.
RGB - Red, Green and Blue. Values range from 0 to 255.
HSL - Hue, Saturation and Lightness. The Hue describes the colour and is specified by an angle between 0 and 360° and is often represented by a colour wheel. Saturation and Lightness range from 0 to 1. Saturation goes from greyscale (S=0) up to maximum color (S=1). Lightness ranges from black (L=0) up to white (L=1).
YUV - Luminance, Y and two Chrominance values, UV. The Y value ranges from 0 to 1. Both U and V range from -0.5 to 0.5.
In Edit and Plot Modes, there is a central region showing the currently selected counter. The Arrows in this section will change the selected counter to the next or previous counter in the list. In List Mode, the currently selected Counter is highlighted in blue.
For this central region, and also for each counter in the list mode:
Each Counter has a name, shown upper Left. The name can be edited in Edit mode by tapping on the Name button.
Below the counter name is a number showing the position index of that counter in the list.
To the left and right there is a color which represents the current counter. If the counter is detecting counts by level, the colour will match the graph colour for that unit and have a bar representing the current trigger level for the counter. If the counter is detecting by color, the color will match the Hue.
Below the count, a small bar will appear when a count has been registered. This bar will dissappear once the specified no re-count time has elapsed and the colour leaves the detection region (or detection unit value crosses the detection level in the other direction). i.e. another count will not be registered until this bar has dissappeared, with the exception of the counter being paused and measure is pressed (see measure section later).
Selected counter section
The Lower Display area in Edit Mode is split into two regions. The top area is for editing the counter name, count etc and has rounded buttons.
The lower section is for setting the count detection parameters.
On / Off - Turns the counter on or off. The counter will only register counts if it is turned on. If the counter is off, it will be shown in a shade of grey in the counter list.
Name - Change the name of the current counter.
New - Makes a new counter with default settings and places it either before the current counter or at the end of the list as selected in the dialog that appears.
Copy - Makes a copy of the current counter and places it either before the current counter or at the end of the list as selected in the dialog that appears.
Delete - Deletes the current counter (unless there is only one left, in which case it can't be deleted).
If sound is enabled for count events, then then the four sound buttons will be enabled allowing each counter to select from one of three count sounds or to play no sound each time a count is detected.
The next three buttons allow the counter value to be modified:
-1 Subtracts one from the current counter value.
+1 Adds one to the current counter value.
The edit button located between the +1 and -1 buttons allows the counter value to be entered manually, or reset to zero.
Trigger by level
Trigger by color
Count Detection Settings
Counts can be triggered by either one of the measured parameters crossing a set level, or by the color crossing into a color region defined by a Hue, Saturation and Lightness Range.
Trigger counts by Level
Select which unit to trigger counts from with one of the 10 boxes with letters corresponding to:
R - The red component of the RGB color, value ranges from 0 to 255.
G - The green component of the RGB color, value ranges from 0 to 255.
B - The blue component of the RGB color, value ranges from 0 to 255.
H - The Hue component of the HSL color, value ranges from 0 to 360°.
S - The Saturation component of the HSL color, value ranges from 0 (grey scale) to 1 (max color).
L - The Lightness component of the HSL color, value ranges from 0 (black) to 1 (white).
Y - The Y (Luminance) component of the YUV color, value ranges from 0 to 1.
U - The U Chroma component of the YUV color, value ranges from -0.5 to 0.5.
V - The V Chroma component of the YUV color, value ranges from -0.5 to 0.5.
u - This is an indicative value of the uniformity of the color in the region analysed. It ranges from 0 to 1 (1 being all the same color).
Level - Choose the threshold level which when the selected unit's values crosses this level in the selected direction, a count will be registered.
No Re-Count Time - To avoid double counting, a time period can be set here where no further counts will be registered until after the time period has elapsed. If the trigger trace is shown on the graph, its colour will be darker inicating that another count cannot yet be registered. In addition, a bar will appear beneath the counter count value indicating that the trigger has not yet been reset.
Direction - The direction of the counting can be set to either be when the value rises from below to above the detection level, or falls from above to below the detection level.
Below the detection settings, a graph shows the selected trigger unit along with the detection
level and any count events that have occurred for the current counter.
Trigger counts by Color
Hue - Select the Hue by touching in the colour bar. This hue will be at the center of the hue range for color detection.
Pick - Tap here to set the Hue to the currently measured color.
Hue Range - Use the arrow buttons or tap edit to enter the hue range or other detection settings manually. The hue range can be from 0 to 180° and defines the color range for count detection of the current counter.
Saturation - Select the saturation range required for count detection. Tap on the cursors on the saturation bar and drag to required positions or tap on edit and enter the values manually.
Lightness - Select the lightness range required for count detection. Tap on the cursors on the lightness bar and drag to required positions or tap on edit and enter the values manually.
Uniformity - Select the uniformity range required for count detection. Tap on the cursors on the uniformity bar and drag to required positions or tap on edit and enter the values manually. Set the full range from 0 to 1 to ignore the uniformity. To avoid making counts when multiple colors are in the target area, increase the lower value.
No Re-Count Time - To avoid double counting, a time period can be set here where no further counts will be registered until after the time period has elapsed.
Direction - The direction of the counting can be set to either be when the value enters into the color region, or when it leaves it.
Plot mode will show graphs of the measured color values. The color data values can be shown on a graph, or the HSL values plotted on a Hue-Saturation diagram and lightness bar.
The 3 buttons select between three plot options available.
Below these 3 buttons is a bar showing the current measured color. This color bar is also annotated with the RGB hexidecimal value of the color used widely in HTML and many other applications. Long pressing on this color bar will copy the value to the clipboard reading for pasting into another application. Alternatively, read the decimal values for the R, G and B, or any of the other values from the upper right of this section.
Graphs section in Plot mode
Graph - This will plot any of the 10 values described earlier (see edit mode section) by tapping on the units letter in the button above the graph.
The y-Axis is shown as the percentage (%) of the full range, so that all the plots can fit onto the same graph. Thus 0% corresponds to the minimum value in the units range, and 100% the maximum. For example, the Hue will be at 0% at 0° and 100% at 360°, whilst Red will be at 0% for a value of 0, and 100% when it has a value of 255 and so on. For U and V, 0% will correspond to -0.5 and 100% to a value of 0.5.
The graph y axis is auto scaling by default. When paused or not in autoscale mode, double touching and stretching or pinching will scale the graph. Single touch panning will move the y-Axis scale up or down, or allow scrolling back to see earlier data on the x-axis.
If the current counter is detecting by level and the detection unit is selected, then the trace for the detection unit will be brighter and show registered count events as red spots. If the trigger unit for the current counter is changed, then previous count events for other units are shown in grey.
Long tap on the graph to open a dialog from which the graph data can be cleared.
Hue-Saturation Diagram - This shows a color ring with the Hue to be represented by the angle, and the Saturation from the radius. Recent measurements are shown with spots of the measured color. A count triggered measurement for the current counter will be shown with a red spot, and if the current counter is detecting counts by color, then there will be a blue segment in the Hue-Saturation diagram indicating the region from which the counter will detect counts (subject to uniformity and lightness both also being in their set detection ranges).
Saturation - Lightness Plot - In the first if the three plot options, a lightness-saturation plot is also shown with recent measured colors shown as spots of the measured color on the plot. If the current counter is detecting by color, then a blue box will indicate the detection region.
The list button on the left of the camera preview will select the list mode. In list mode, all the counters initialised are shown in a list. The currently selected counter is highlighted in blue. Counters that are turned off are partly grayed out.
To change the currently selected counter, just tap on a new one.
To scroll the list, just touch and drag up or down.
To change the counter position in the list, long tap on a counter and then drag it to its new position.
When paused, the measure button is enabled. This allows you to point and tap measure to take a single reading. Alternatively press the volume up/down on your device to take a measurement (if this option enabled - see settings below). When measure is pressed, any requirement to exit the color region, or wait specified time before another count can be registered is dis-regarded. i.e. every press of measure assumes that the we are already outside the target level/color and thus a new count is registered if the measured color/level is correct for the counter.
Clicking the cogs button at the top left of the screen brings up a settings menu:
Camera to use – Select either the front facing or back facing camera. If a camera is not available, it will be grayed out.
Target Size – Select the target area size to analyse the color from. The target area will be shown with a blue box on the camera preview image. Choose from size size options given as percentages of preview width and height.
Measurement Speed – Select how often a new measurement is done. Slow is approximately 1 sample a second, med is approx 4 samples a second and fast is as fast as possible for the device with the current settings.
Stay awake – Check this option to stop the device from sleeping.
Sound On – Turn sound effects on or off for the app.
Button Press Sounds - Button presses will make a click sound if this is enabled.
Enable Count Sounds - When a count is registered, the counter sound is played. Each counter can have one of three sounds or have no sound as selected in the edit screen for each counter.
Vibrate On – Turn vibration effects on or off for the app.
Vibrate on Button Presses - Button presses will cause the device to vibrate if this is enabled.
Vibrate on Count Detection - When a count is registered, the device will vibrate if this is enabled.
Auto scale graph Y-Axis - The Y-Axis of the graph will be auto scaled when not paused. Otherwise panning or pinching on the graph can change the axis scales.
Show Trigger Trace/Points on Plots - When a count is triggered, it will be indicated by a red dot on the various graphs. The graph will also show a trace showing where the measured values used for detecting the count are. The trigger trace color will also be darker after it has been triggered until the conditions to reset the trigger have been met.
Smooth RGB data - Smooths the last few data points of the measured color.
Measure once when volume up/down pressed while paused - The volume buttons can be used to trigger a measurement whilst paused if this option is selected. The volume buttons have the same effect as pressing the measure button.
Copy Counter Values to Clipboard – Copies the count values for all the counters to the clipboard ready for pasting into another application.
Zero All Counters – Zeros all the counters and clears the graph data.
Reset to defaults – Resets all preferences back to their default values and clears the graph data.