(self, cropped, size, com)
return jts[0]*(size[2]/2.)
Refines the detection result of the hand
        :return: center of hand
Refines the detection result of the hand
        :return: center of hand
Refines the detection result of the hand : return : center of hand
def refineCoM(self, cropped, size, com):
        """
        Refines the detection result of the hand
        :return: center of hand
        """

        imgD = numpy.asarray(cropped.copy(), 'float32')

        imgD[imgD == 0] = com[2] + (size[2] / 2.)
        imgD[imgD >= com[2] + (size[2] / 2.)] = com[2] + (size[2] / 2.)
        imgD[imgD <= com[2] - (size[2] / 2.)] = com[2] - (size[2] / 2.)
        imgD -= com[2]
        imgD /= (size[2] / 2.)

        test_data = numpy.zeros((1, 1, cropped.shape[0], cropped.shape[1]), dtype='float32')
        test_data[0, 0] = imgD
        # test_data2 = numpy.zeros((test_data.shape[0], test_data.shape[1], test_data.shape[2]//2, test_data.shape[3]//2), dtype='float32')
        # test_data4 = numpy.zeros((test_data2.shape[0], test_data2.shape[1], test_data2.shape[2]//2, test_data2.shape[3]//2), dtype='float32')
        # for j in range(test_data.shape[0]):
        #     for i in range(test_data.shape[1]):
        #         test_data2[j, i, :, :] = cv2.resize(test_data[j, i, :, :], (test_data2.shape[3], test_data2.shape[2]))
        #         test_data4[j, i, :, :] = cv2.resize(test_data2[j, i, :, :], (test_data4.shape[3], test_data4.shape[2]))

        dsize = (int(test_data.shape[2]//2), int(test_data.shape[3]//2))
        xstart = int(test_data.shape[2]/2-dsize[0]/2)
        xend = xstart + dsize[0]
        ystart = int(test_data.shape[3]/2-dsize[1]/2)
        yend = ystart + dsize[1]
        test_data2 = test_data[:, :, ystart:yend, xstart:xend]

        dsize = (int(test_data.shape[2]//4), int(test_data.shape[3]//4))
        xstart = int(test_data.shape[2]/2-dsize[0]/2)
        xend = xstart + dsize[0]
        ystart = int(test_data.shape[3]/2-dsize[1]/2)
        yend = ystart + dsize[1]
        test_data4 = test_data[:, :, ystart:yend, xstart:xend]
        if self.refineNet.cfgParams.numInputs == 1:
            jts = self.refineNet.computeOutput(test_data)
        elif self.refineNet.cfgParams.numInputs == 3:
            jts = self.refineNet.computeOutput([test_data, test_data2, test_data4])
        else:
            raise NotImplementedError("Number of inputs is {}".format(self.refineNet.cfgParams.numInputs))
        return jts[0]*(size[2]/2.)
def refineCoM ( self , cropped , size , com ) : imgD = numpy . asarray ( cropped . copy ( ) , 'float32' ) imgD [ imgD == 0 ] = com [ 2 ] + ( size [ 2 ] / 2. ) imgD [ imgD >= com [ 2 ] + ( size [ 2 ] / 2. ) ] = com [ 2 ] + ( size [ 2 ] / 2. ) imgD [ imgD <= com [ 2 ] - ( size [ 2 ] / 2. ) ] = com [ 2 ] - ( size [ 2 ] / 2. ) imgD -= com [ 2 ] imgD /= ( size [ 2 ] / 2. ) test_data = numpy . zeros ( ( 1 , 1 , cropped . shape [ 0 ] , cropped . shape [ 1 ] ) , dtype = 'float32' ) test_data [ 0 , 0 ] = imgD # test_data2 = numpy.zeros((test_data.shape[0], test_data.shape[1], test_data.shape[2]//2, test_data.shape[3]//2), dtype='float32') # test_data4 = numpy.zeros((test_data2.shape[0], test_data2.shape[1], test_data2.shape[2]//2, test_data2.shape[3]//2), dtype='float32') # for j in range(test_data.shape[0]): #     for i in range(test_data.shape[1]): #         test_data2[j, i, :, :] = cv2.resize(test_data[j, i, :, :], (test_data2.shape[3], test_data2.shape[2])) #         test_data4[j, i, :, :] = cv2.resize(test_data2[j, i, :, :], (test_data4.shape[3], test_data4.shape[2])) dsize = ( int ( test_data . shape [ 2 ] // 2 ) , int ( test_data . shape [ 3 ] // 2 ) ) xstart = int ( test_data . shape [ 2 ] / 2 - dsize [ 0 ] / 2 ) xend = xstart + dsize [ 0 ] ystart = int ( test_data . shape [ 3 ] / 2 - dsize [ 1 ] / 2 ) yend = ystart + dsize [ 1 ] test_data2 = test_data [ : , : , ystart : yend , xstart : xend ] dsize = ( int ( test_data . shape [ 2 ] // 4 ) , int ( test_data . shape [ 3 ] // 4 ) ) xstart = int ( test_data . shape [ 2 ] / 2 - dsize [ 0 ] / 2 ) xend = xstart + dsize [ 0 ] ystart = int ( test_data . shape [ 3 ] / 2 - dsize [ 1 ] / 2 ) yend = ystart + dsize [ 1 ] test_data4 = test_data [ : , : , ystart : yend , xstart : xend ] if self . refineNet . cfgParams . numInputs == 1 : jts = self . refineNet . computeOutput ( test_data ) elif self . refineNet . cfgParams . numInputs == 3 : jts = self . refineNet . computeOutput ( [ test_data , test_data2 , test_data4 ] ) else : raise NotImplementedError ( "Number of inputs is {}" . format ( self . refineNet . cfgParams . numInputs ) ) return jts [ 0 ] * ( size [ 2 ] / 2. )