They are not this simple; if so, an RLS (Rain / Light Sensor) assembly would cost 50 cents. To do a proper job, you need an array of IR emitters, and an array of detectors; and they need to be properly integrated into your windshield glass.
The RLS is usually a part of the rearview mirror supporting structure.
It also has to also work for hail and snow/sleet. Again, it's not as simple as you suggest.
Is that not what I described, more or less? None of the components are particularly complex or expensive except the part where they join with the glass in the structure. Trying to do it with video is a much, much harder problem.
Anything water based on top of the light emitter will have the same effect. You just need to use a formula describing its refractive index with temperature and density inputs. The temperature is known by the car, the density can use a look up table for various states the water could be in.
The RLS is usually a part of the rearview mirror supporting structure.
It also has to also work for hail and snow/sleet. Again, it's not as simple as you suggest.