(self, crop, sz, xstart, xend, ystart, yend, zstart, zend, thresh_z=True, background=0)
return dpt
Crop patch from image
        :param crop: cropped depth image
        :param xstart: start x
        :param xend: end x
        :param ystart: start y
        :param yend: end y
        :param zstart: start z
        :param zend: end z
        :param thresh_z: threshold z values
        :return: depth image with crop put on position
Crop patch from image
        :param crop: cropped depth image
        :param xstart: start x
        :param xend: end x
        :param ystart: start y
        :param yend: end y
        :param zstart: start z
        :param zend: end z
        :param thresh_z: threshold z values
        :return: depth image with crop put on position
Crop patch from image : param crop : cropped depth image : param xstart : start x : param xend : end x : param ystart : start y : param yend : end y : param zstart : start z : param zend : end z : param thresh_z : threshold z values : return : depth image with crop put on position
def getInverseCrop(self, crop, sz, xstart, xend, ystart, yend, zstart, zend, thresh_z=True, background=0):
        """
        Crop patch from image
        :param crop: cropped depth image
        :param xstart: start x
        :param xend: end x
        :param ystart: start y
        :param yend: end y
        :param zstart: start z
        :param zend: end z
        :param thresh_z: threshold z values
        :return: depth image with crop put on position
        """

        dpt = numpy.ones(sz, dtype=crop.dtype)*background
        if (xend < 0 and xstart < 0) or (yend < 0 and ystart < 0):
            return dpt
        if (xend > dpt.shape[1] and xstart > dpt.shape[1]) or (yend > dpt.shape[0] and ystart > dpt.shape[0]):
            return dpt
        if xend == xstart or yend == ystart:
            return dpt

        cropped = self.resizeCrop(crop, (xend-xstart, yend-ystart))

        if len(dpt.shape) == 2:
            dpt[max(ystart, 0):min(yend, dpt.shape[0]), max(xstart, 0):min(xend, dpt.shape[1])] = cropped[max(-ystart, 0):cropped.shape[0]-max(yend-dpt.shape[0], 0), max(-xstart, 0):cropped.shape[1]-max(xend-dpt.shape[1], 0)]
        elif len(dpt.shape) == 3:
            dpt[max(ystart, 0):min(yend, dpt.shape[0]), max(xstart, 0):min(xend, dpt.shape[1]), :] = cropped[max(-ystart, 0):cropped.shape[0]-max(yend-dpt.shape[0], 0), max(-xstart, 0):cropped.shape[1]-max(xend-dpt.shape[1], 0)]
        else:
            raise NotImplementedError()

        if thresh_z is True:
            msk1 = numpy.logical_and(dpt < zstart, dpt != 0)
            msk2 = numpy.logical_and(dpt > zend, dpt != 0)
            dpt[msk1] = zstart
            dpt[msk2] = 0.  # backface is at 0, it is set later
        return dpt
def getInverseCrop ( self , crop , sz , xstart , xend , ystart , yend , zstart , zend , thresh_z = True , background = 0 ) : dpt = numpy . ones ( sz , dtype = crop . dtype ) * background if ( xend < 0 and xstart < 0 ) or ( yend < 0 and ystart < 0 ) : return dpt if ( xend > dpt . shape [ 1 ] and xstart > dpt . shape [ 1 ] ) or ( yend > dpt . shape [ 0 ] and ystart > dpt . shape [ 0 ] ) : return dpt if xend == xstart or yend == ystart : return dpt cropped = self . resizeCrop ( crop , ( xend - xstart , yend - ystart ) ) if len ( dpt . shape ) == 2 : dpt [ max ( ystart , 0 ) : min ( yend , dpt . shape [ 0 ] ) , max ( xstart , 0 ) : min ( xend , dpt . shape [ 1 ] ) ] = cropped [ max ( - ystart , 0 ) : cropped . shape [ 0 ] - max ( yend - dpt . shape [ 0 ] , 0 ) , max ( - xstart , 0 ) : cropped . shape [ 1 ] - max ( xend - dpt . shape [ 1 ] , 0 ) ] elif len ( dpt . shape ) == 3 : dpt [ max ( ystart , 0 ) : min ( yend , dpt . shape [ 0 ] ) , max ( xstart , 0 ) : min ( xend , dpt . shape [ 1 ] ) , : ] = cropped [ max ( - ystart , 0 ) : cropped . shape [ 0 ] - max ( yend - dpt . shape [ 0 ] , 0 ) , max ( - xstart , 0 ) : cropped . shape [ 1 ] - max ( xend - dpt . shape [ 1 ] , 0 ) ] else : raise NotImplementedError ( ) if thresh_z is True : msk1 = numpy . logical_and ( dpt < zstart , dpt != 0 ) msk2 = numpy . logical_and ( dpt > zend , dpt != 0 ) dpt [ msk1 ] = zstart dpt [ msk2 ] = 0. # backface is at 0, it is set later return dpt