hash tables listing continued increments the counter for the given category def inccountselfcategory )assert category in self _freqcounts"invalid histogram category value self _freqcounts valueofcategory self _freqcounts addcategoryvalue returns the sum of the frequency counts def totalcountself )total for cat in self _freqcounts total +self _freqcounts valueofcat return total returns an iterator for traversing the categories def __iter__self )return iterself _freqcounts the iterator operation defined by the adt is implemented in lines - in section we indicated the iterator method is supposed to create and return an iterator object that can be used with the given collection since the map adt already provides an iterator for traversing over the keyswe can have python access and return that iterator as if we had created our own this is done using the iter(functionas shown in our implementation of the iter method in lines - the color histogram histogram is used to tabulate the frequencies of multiple discrete categories the histogram adt from the previous section works well when the collection of categories is small some applicationshowevermay deal with millions of distinct categoriesnone of which are known up frontand require specialized version of the histogram one such example is the color histogramwhich is used to tabulate the frequency counts of individual colors within digital image color histograms are used in areas of image processing and digital photography for image classificationobject identificationand image manipulation color histograms can be constructed for any color spacebut we limit our discussion to the more common discrete rgb color space in the rgb color spaceindividual colors are specified by intensity values for the three primary colorsredgreenand blue this color space is commonly used in computer applications and computer graphics because it is very convenient for modeling the human visual system the intensity values in the rgb color spacealso referred to as color componentscan be specified using either real values in the range [ or discrete values in the range [ the discrete version is the most commonly used for the storage of digital imagesespecially those produced by digital cameras and scanners with discrete values for the three color componentsmore than million colors can be representedfar more than humans are capable of distinguishing value of indicates no intensity for the given component while