A non-transitory computer-readable storage medium having recorded thereon an image processing program for causing a computer to execute processes comprising:
- calculating a difference between two images acquired in time series;
- increasing a number of levels set for a partial region that includes a detection pixel at which the calculated difference is larger, than a predetermined threshold, in accordance with an increase in the difference;
- and
- detecting, for each partial region, a motion vector between the two images by using the set number of levels.