1. A density measuring device comprising one or more processors programmed to: calculate, for each of a plurality of regions in an image including objects of a plurality of classes, a density corresponding to a number of objects of each object class captured in the region; calculate, from the density, a probability of each such object class captured for each of the regions; and generate density data, in which a position corresponding to each of the regions in the image is assigned with the density of an object class having the higher probability than the lowest probability of an object class in a corresponding region.