Could you please tell me what is meant by the term 'sense data'? I am not clear whether it refers to what we immediately perceive around us, or to images inside our heads. Or is there a third meaning? And why is it controversial?

‘Sense data’ refers to the images. The idea is that objects in the world impinge on our senses and this causes us to perceive images. We are have immediate and full knowledge of these images (although not of the objects that cause them). Philosophers who believe in sense data disagree about whether or not we can gain knowledge of objects in the world starting from sense data. Some philosophers think that the whole idea of sense data is wrong-headed, arguing, for example, that we aren’t in fact fully aware of our ideas, that what we’re aware of in perception is objects in the world, that there is no way to have knowledge of the world if we have to gain it through the ‘veil’ of sense-data. This is just a quick answer. You might also look at the article on the topic in the online Stanford Encyclopedia of Philosophy, http://plato.stanford.edu/entries/sense-data/