There is, however, a spectrum between these two extremes, whereby there is an element of pre-visualisation, and an element of opportunism, and the relative contribution of these to the final image can vary.
What matters is that you get the image you wanted. Sometimes, that is a result of very rapid decisions, and sometimes of prolonged work. Sometimes you have to make up your mind very rapidly about what image you want, and what you want the final result to look like, and this process may be almost simultaneous with taking the photo. So, for example, I may spot a butterfly resting in our meadow. I think quickly about the background and lighting, how I can approach the insect, what depth of field I want, whilst at the same time, approaching, setting up my camera, and hopefully capturing the shot (most of the time the butterfly has moved, or gone, but that is the charm of wildlife photography). Other times you may need to set things up in advance: we set up seed feeders for our birds so that we can get images with the light that I want, and the background that I want, for example. I will also wait for the right weather or lighting conditions to get an image of a particular local landscape. This can take months, or even years, if you want snow coverage and it doesn’t snow that winter.
Most of the time, there is some time after you’ve spotted the opportunity, to think about what you want the image to be like. Is it the colour that attracts you? Or the pattern of light and shade (in which case, you may see the final image in monochrome and adapt what you shoot accordingly)? Do you want to convey an emotion? In which case, what post processing would you like to use? Is the lighting right? If not, can you improve it by using flash or reflectors? Do you want the water to look blurred, in which case you may want to use a tripod? Do you want good contrast in both sky and foreground (maybe you might use a filter?)? Finally, what equipment have you got with you, and what can you get, given the things you have available (I often have the “wrong” lens on my camera, but manage to get something acceptable despite that)? The permutations are endless, but the point is that photography is almost always a combination between pre-visualisation and opportunism. Making the most of both is one of the great skills a photographer can have.