Self-adapting confidence estimation for stereo