'**SUMMARY***
This method is used to do the real time signal analysis. Pass the method
an image from the stream and it will return the event count. Note that
due to buffering the signal may lag the actual video by up to a few seconds.
**PARAMETERS**
* *img* - The image in the stream to test.
**RETURNS**
Returns an int that is the count of the number of times the event has occurred.
**EXAMPLE**
>>>> cam = Camera(1)
>>>> tct = TemporalColorTracker()
>>>> img = cam.getImage()
>>>> roi = ROI(img.width*0.45,img.height*0.45,img.width*0.1,img.height*0.1,img)
>>>> tct.train(cam,roi=roi,maxFrames=250)
>>>> disp = Display((800,600))
>>>> while disp.isNotDone():
>>>>     img = cam.getImage()
>>>>     result = tct.recognize(img)
>>>>     roi = ROI(img.width*0.45,img.height*0.45,img.width*0.1,img.height*0.1,img)
>>>>     roi.draw(width=3)
>>>>     img.drawText(str(result),20,20,color=Color.RED,fontsize=32)
>>>>     img = img.applyLayers()
>>>>     img.save(disp)
**TODO**
Return True/False if the event occurs.'

def recognize(self, img):

    if (self._bestKey is None):
        raise Exception('The    TemporalColorTracker    has    not    been    trained.')
    v = self._getBestValue(img)
    return self._updateBuffer(v)
