Optimize feature detection by taking into account relative position and distance from other features.