Detecting and predicting visual affordance of objects in a given environment