1. An apparatus for detecting a moving object, comprising: an imaging unit imaging repeatedly at intervals a region to be detected of a moving object; a dictionary storage storing, as a dictionary, image patterns indicative of features of the moving object wherein the dictionary is prestored; and a control unit, wherein the control unit is configured to include: an extracting section extracting feature points indicative of a position of an object in the images, based on data of the images repeatedly imaged by the imaging unit; a calculating section calculating an optical flow of the feature points, based on the feature points in the images extracted time sequentially by the extracting section; a rectangle setting section grouping the feature points of the moving object and setting a reference rectangle encompassing the grouped feature points, based on the optical flow calculated by the calculating section; a region setting section setting an identification region encompassing both a region showing the moving object and the reference rectangle; an identifying section identifying the moving object in the identification region, using the dictionary stored in the dictionary storage; and a specifying section specifying the region occupied by the moving object, based on results identified by the identifying section and an image region having the highest degree of match with the dictionary; wherein: the rectangle setting section determines a height of the reference rectangle based on a distance to the grouped feature points and a height of the moving object virtually set; the rectangle setting section determines a width of the reference rectangle based on the height of the reference rectangle; the region setting section determines a width of the identification region based on distances to the feature points encompassed by the reference rectangle and a degree of lateral scattering; the region setting section sets the height of the identification region which is larger than the height of the reference rectangle; the dictionary storage stores therein, as the dictionary, a plurality of dictionaries showing the image patterns indicative of the features of each part of the moving object; and the identifying section identifies a region corresponding to each of the parts of the moving object, determines whether or not the identified region is behind other objects, and selectively uses the dictionaries in the dictionary storage, based on the optical flow of the feature points in the region and on whether the identified region is behind the other objects.