1. An image processing apparatus comprising: a dividing unit configured to divide a frame of a moving image into a changing area in which there is an active object and a changeless area in which there is a stationary object; and a generation unit configured to generate a still image by compositing an area corresponding to the changeless area in each of X frame(s) (where X is an integer of 1 or more) among a plurality of frames included in the moving image and an area corresponding to the changing area in each of Y frames (where Y is an integer greater than X) among the plurality of frames, wherein the dividing unit includes: a detection unit configured to detect motion vectors in each of a plurality of areas in each of the plurality of frames; an identifying unit configured to identify, from among the detected motion vectors, camera shake motion vectors caused by a camera shake at a time of capturing the moving image; a summation unit configured to, for each area, sum magnitude components of object motion vectors obtained by excluding the camera shake motion vectors from the detected motion vectors; and a determining unit configured to determine an area in which a sum value obtained by the summation is greater than or equal to a first threshold value as the changing area, and determine an area in which the sum value is less than the first threshold value as the changeless area, wherein the identifying unit is configured to decide a second threshold value based on a frequency distribution of magnitude components of the detected motion vectors, and identify, from among the detected motion vectors, motion vectors whose magnitude component is less than the second threshold value as the camera shake motion vectors.