1. An image processing apparatus comprising a processor, wherein the processor functions as units comprising: an image obtaining unit which obtains plural pieces of image data, wherein the obtained plural pieces of image data have a substantially same field angle and include image data of a moving object; a reference-image generating unit which generates reference image data that represents a target image composition, wherein the generated reference image data is based on the obtained plural pieces of image data and includes less of a region containing the moving object than the obtained plural pieces of image data; an image selecting unit which selects at least two pieces of image data from among the obtained plural pieces of image data such that when the selected pieces of image data are combined into a composite image, the composite image will more closely resemble the generated reference image data than each of the obtained plural pieces of image data, wherein a number of the selected pieces of image data is less than a number of the obtained plural pieces of image data; a boundary setting unit which sets boundaries respectively in the selected pieces of image data; and an image combining unit which combines together the selected pieces of image data into the composite image based on the set boundaries.