Thermal imaging detects temperature variations in the floor, indicating the presence of a leak by showing hot or cold spots.