Water Droplets Simulation Module#
Water droplets on camera lenses create localized distortions through refraction, reflection, and occlusion. These effects can cause missed detections, reduced confidence scores, fragmented tracking, and corrupted feature extraction — especially when droplets obscure or warp critical target regions. Because many computer vision models are trained on clear, unobstructed imagery, water droplets represent a common operational friction that can significantly degrade performance in outdoor and maritime environments.
From an ML T&E perspective, water droplets matter because they introduce localized distortions that models rarely encounter during training. Unlike uniform blur or noise, droplets create irregular distortion patterns in unpredictable locations, which can confuse both detection and recognition algorithms. This risk is therefore particularly relevant for real-world deployments where weather conditions cannot be controlled.
NRTK’s WaterDropletPerturber simulates this risk using physics-based modeling to create
realistic refraction and blur effects. The perturbation accounts for droplet size, position,
and optical properties to generate operationally representative test conditions for robustness
screening.
Water Droplet Perturbation#
Simulates realistic water droplets on a camera lens using physics-based modeling so you can test how well a model handles refraction, occlusion, and localized distortions.
Use This When…#
You want to simulate raindrops or water spray on camera lenses in outdoor/maritime scenarios.
You need a physics-based perturbation that models realistic optical refraction effects.
You’re doing early screening of robustness to lens contamination before running heavier T&E analysis (see the full T&E Simulation Guide → WaterDropletPerturber T&E guide).
You want to test model performance under localized distortions rather than global blur.
Minimal Code Example#
from nrtk.impls.perturb_image.environment import WaterDropletPerturber
perturber = WaterDropletPerturber(
num_drops=20,
size_range=[0.0, 1.0],
blur_strength=0.25
)
perturbed_img, boxes = perturber(image=img_in, boxes=boxes)
Key Parameters#
num_drops- Number of water droplets to simulate on the lens.size_range- Range of size multiplier values [min, max] used for computing droplet sizes.blur_strength- Strength of Gaussian blur applied to simulate depth-of-field effects.
Advanced Parameters (defaults work for most cases):
psi- Angle between camera line-of-sight and glass plane (radians) - Default: 90°.n_air- Refractive index of air - Default: 1.0.n_water- Refractive index of water - Default: 1.33.f_x,f_y- Camera focal lengths in x and y directions (cm) - Default: 400 for both.seed- Random seed for reproducible results across runs.
Limitations and Next Steps#
API Reference:
WaterDropletPerturberApplies frame-by-frame — droplet positions are randomized each call, so there’s no temporal consistency across video frames (suitable for static image robustness testing).
Requires optional dependencies: install via
pip install nrtk[waterdroplet].See Validation and Trust for cross-perturber validation status.
Related Risks: Dirt / Specularities on Lens, Mist / Fog / Snow








