(self, dpt)
Calculate the center of mass
        :param dpt: depth image
        :return: (x,y,z) center of mass
Calculate the center of mass
        :param dpt: depth image
        :return: (x,y,z) center of mass
Calculate the center of mass : param dpt : depth image : return : ( x y z ) center of mass
def calculateCoM(self, dpt):
        """
        Calculate the center of mass
        :param dpt: depth image
        :return: (x,y,z) center of mass
        """

        dc = dpt.copy()
        dc[dc < self.minDepth] = 0
        dc[dc > self.maxDepth] = 0
        cc = ndimage.measurements.center_of_mass(dc > 0)
        num = numpy.count_nonzero(dc)
        com = numpy.array((cc[1]*num, cc[0]*num, dc.sum()), numpy.float)

        if num == 0:
            return numpy.array((0, 0, 0), numpy.float)
        else:
            return com/num
def calculateCoM ( self , dpt ) : dc = dpt . copy ( ) dc [ dc < self . minDepth ] = 0 dc [ dc > self . maxDepth ] = 0 cc = ndimage . measurements . center_of_mass ( dc > 0 ) num = numpy . count_nonzero ( dc ) com = numpy . array ( ( cc [ 1 ] * num , cc [ 0 ] * num , dc . sum ( ) ) , numpy . float ) if num == 0 : return numpy . array ( ( 0 , 0 , 0 ) , numpy . float ) else : return com / num