(self, img)
return retimg
Add status bar to image
        :param img: image
        :return: image with status bar
Add status bar to image
        :param img: image
        :return: image with status bar
Add status bar to image : param img : image : return : image with status bar
def addStatusBar(self, img):
        """
        Add status bar to image
        :param img: image
        :return: image with status bar
        """
        barsz = 20
        retimg = numpy.ones((img.shape[0]+barsz, img.shape[1], img.shape[2]), dtype='uint8')*255

        retimg[barsz:img.shape[0]+barsz, 0:img.shape[1], :] = img

        # FPS text
        fps = 1./(time.time()-self.lastshow)
        self.runningavg_fps.append(fps)
        avg_fps = numpy.mean(self.runningavg_fps)
        cv2.putText(retimg, "FPS {0:2.1f}".format(avg_fps), (20, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (0, 0, 0))

        # hand text
        cv2.putText(retimg, "Left" if self.hand.value == self.HAND_LEFT else "Right", (80, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (0, 0, 0))

        # hand size
        ss = "HC-{0:d}".format(self.sync['config']['cube'][0])
        cv2.putText(retimg, ss, (120, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (0, 0, 0))

        # hand tracking mode, tracking or detection
        cv2.putText(retimg, "T" if self.tracking.value else "D", (260, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (0, 0, 0))

        # hand detection mode, COM or CNN
        if self.detection.value == self.DETECTOR_COM:
            mode = "COM"
        else:
            mode = "???"
        cv2.putText(retimg, mode, (280, 10), cv2.FONT_HERSHEY_SIMPLEX, 0.3, (0, 0, 0))

        # status symbol
        if self.state.value == self.STATE_IDLE:
            col = (0, 0, 255)
        elif self.state.value == self.STATE_INIT:
            col = (0, 255, 255)
        elif self.state.value == self.STATE_RUN:
            col = (0, 255, 0)
        else:
            col = (0, 0, 255)
        cv2.circle(retimg, (5, 5), 5, col, -1)
        return retimg
def addStatusBar ( self , img ) : barsz = 20 retimg = numpy . ones ( ( img . shape [ 0 ] + barsz , img . shape [ 1 ] , img . shape [ 2 ] ) , dtype = 'uint8' ) * 255 retimg [ barsz : img . shape [ 0 ] + barsz , 0 : img . shape [ 1 ] , : ] = img # FPS text fps = 1. / ( time . time ( ) - self . lastshow ) self . runningavg_fps . append ( fps ) avg_fps = numpy . mean ( self . runningavg_fps ) cv2 . putText ( retimg , "FPS {0:2.1f}" . format ( avg_fps ) , ( 20 , 10 ) , cv2 . FONT_HERSHEY_SIMPLEX , 0.3 , ( 0 , 0 , 0 ) ) # hand text cv2 . putText ( retimg , "Left" if self . hand . value == self . HAND_LEFT else "Right" , ( 80 , 10 ) , cv2 . FONT_HERSHEY_SIMPLEX , 0.3 , ( 0 , 0 , 0 ) ) # hand size ss = "HC-{0:d}" . format ( self . sync [ 'config' ] [ 'cube' ] [ 0 ] ) cv2 . putText ( retimg , ss , ( 120 , 10 ) , cv2 . FONT_HERSHEY_SIMPLEX , 0.3 , ( 0 , 0 , 0 ) ) # hand tracking mode, tracking or detection cv2 . putText ( retimg , "T" if self . tracking . value else "D" , ( 260 , 10 ) , cv2 . FONT_HERSHEY_SIMPLEX , 0.3 , ( 0 , 0 , 0 ) ) # hand detection mode, COM or CNN if self . detection . value == self . DETECTOR_COM : mode = "COM" else : mode = "???" cv2 . putText ( retimg , mode , ( 280 , 10 ) , cv2 . FONT_HERSHEY_SIMPLEX , 0.3 , ( 0 , 0 , 0 ) ) # status symbol if self . state . value == self . STATE_IDLE : col = ( 0 , 0 , 255 ) elif self . state . value == self . STATE_INIT : col = ( 0 , 255 , 255 ) elif self . state . value == self . STATE_RUN : col = ( 0 , 255 , 0 ) else : col = ( 0 , 0 , 255 ) cv2 . circle ( retimg , ( 5 , 5 ) , 5 , col , - 1 ) return retimg