Under the Hood#
The Solution described what ScubAI does for the photographer. This article covers how — the processing pipeline, the image analysis, and the controls available for fine-tuning.
Why RAW#
Everything starts with RAW. The case for shooting RAW is stronger underwater than anywhere else: the attenuated red channel may carry a signal so faint that a JPEG discards it entirely, but at 14-bit depth that signal is real and recoverable.
ScubAI captures RAW (DNG) natively on iPhone. For dedicated camera users, the app imports RAW files from all major formats — ARW, NEF, CR2, CR3, RAF, PEF, RW2. The pipeline works on the sensor’s linear data throughout, preserving the full dynamic range the camera recorded.
On-device processing#
All processing runs locally on the iPhone. No upload, no cloud dependency, no waiting — and no sending your photos anywhere.
The pipeline decodes the RAW file, applies color correction, contrast enhancement, and dehazing tuned for underwater conditions, then renders the result at full resolution for export. A downscaled preview keeps editing responsive while the full-resolution output preserves every pixel the sensor captured.
Image analysis#
Before applying any correction, the app analyzes each image to understand its conditions.
Light source detection — the app determines whether the scene was lit by ambient light, a strobe, or a mix of both. Strobe-lit images need a different correction strategy because of the mixed-light problem. The app detects this and adapts.
Water type estimation — the color balance reveals whether the water is blue-dominant or green-dominant. Different water types require different adjustments — the same depth in blue water and green water produces a different color cast.
Depth-scaled intensity — the app estimates the depth at which the photo was taken by reading the light attenuation in the image, and scales correction strength accordingly, following the exponential relationship between depth and light loss.
The result is a set of correction parameters tailored to this specific image — not a generic underwater preset.
Color correction#
The core of the pipeline: restoring the color that water removed.
The correction operates per-channel, independently adjusting the red, green, and blue response based on the analysis above. Red — the most attenuated channel underwater — gets the strongest boost. The blue-green balance is shifted to counteract the dominant cast. Cross-channel relationships are preserved to maintain natural color rendering rather than simply tinting the image warm.
The correction is applied in linear space, before any tone curve or gamma encoding. This matters because the physics of light attenuation is exponential — working in the right domain means the math matches the reality.
Dehazing#
Water between camera and subject scatters light, adding a luminous veil that reduces contrast and washes out detail. The effect grows with distance — close subjects look crisp, distant backgrounds look flat and milky.
The pipeline includes contrast enhancement and dehazing scaled to the estimated scene depth. Deeper, hazier scenes get stronger dehazing; shallow close-up shots get less. The goal is to restore the contrast that scattering removed without introducing artifacts.
White balance#
White balance follows the Planckian locus, but the UI is mapped and optimized for the underwater range. The temperature and tint controls give more resolution in the region where most underwater corrections land, so adjustments are precise where they matter instead of jumping in large steps through the range you actually use.
Manual controls#
When the automatic correction needs adjustment:
- White balance — 2D control for temperature and tint, tuned for the underwater range
- Red boost — direct control over red channel amplification, the single most impactful underwater correction
- Blue-green balance — shifts the correction between blue-dominant and green-dominant water types
- Dehaze — controls how aggressively scattering is compensated
- Exposure, contrast, and shadows — standard RAW exposure and tone controls
- Sharpness — compensates for the softening effect of forward scatter
These controls adjust the correction, not the raw image. The starting point is already physics-informed; the controls let you refine from there rather than building a correction from scratch.
For what’s coming next — per-pixel depth-aware correction, dive computer integration, and calibration chart workflows — see What’s Next.