Turbidity from photographs
A phone camera is available and free; a nephelometer is not. Suspended solids wash out a printed target seen through the sample, and that loss of contrast is the measurement.
Principle
A vessel of water sits in front of a printed high-contrast target. As turbidity rises, the target seen through the sample loses contrast. Contrast falls roughly exponentially with concentration, so the calibration is fitted linearly in log-contrast.
A white card in the same frame cancels exposure and white balance differences between shots. Without it a cloudier photograph and a darker room look identical to the code.
Relative, not NTU
Every result is a percentage of the influent. Calibrating to a real turbidity standard needs formazin, which this project does not have, so the output is never reported in NTU. For a pre-treatment stage the percentage removed is the number that matters anyway.
Workflow
Three commands. The first reads contrast off each photograph, the second fits the dilution series, the third compares influent to effluent.
rwl measure photos/*.jpg --setup setup.json --out readings.csv
rwl calibrate --readings readings.csv --levels levels.csv --out calibration.json
rwl report --readings readings.csv --calibration calibration.json \
--before influent --after effluentsetup.json holds the two regions of interest, read once off any frame in the session and reused for all of it:
{
"target": [820, 540, 300, 300],
"white": [180, 160, 120, 120]
}Both are [x, y, width, height] in pixels. The calibration prints an R²; below 0.9 the light drifted during the series and the photographs have to be retaken.
Limitations
- Relative to the stock, not traceable to a turbidity standard.
- Only suspended load is measured. Dissolved contaminants that do not scatter light are invisible to this method.
- Saturated highlights break the contrast estimate. Underexpose slightly rather than clipping the white card.
- Valid only within the calibrated range. An effluent clearer than the lowest calibration point should be reported as such, not extrapolated.