(self, dpt, xstart, xend, ystart, yend, zstart, zend, thresh_z=True, background=0)
return cropped
Crop patch from image
        :param dpt: depth image to crop from
        :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: cropped image
Crop patch from image
        :param dpt: depth image to crop from
        :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: cropped image
Crop patch from image : param dpt : depth image to crop from : 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 : cropped image
def getCrop(self, dpt, xstart, xend, ystart, yend, zstart, zend, thresh_z=True, background=0):
        """
        Crop patch from image
        :param dpt: depth image to crop from
        :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: cropped image
        """
        if len(dpt.shape) == 2:
            cropped = dpt[max(ystart, 0):min(yend, dpt.shape[0]), max(xstart, 0):min(xend, dpt.shape[1])].copy()
            # add pixels that are out of the image in order to keep aspect ratio
            cropped = numpy.pad(cropped, ((abs(ystart)-max(ystart, 0),
                                           abs(yend)-min(yend, dpt.shape[0])),
                                          (abs(xstart)-max(xstart, 0),
                                           abs(xend)-min(xend, dpt.shape[1]))), mode='constant', constant_values=background)
        elif len(dpt.shape) == 3:
            cropped = dpt[max(ystart, 0):min(yend, dpt.shape[0]), max(xstart, 0):min(xend, dpt.shape[1]), :].copy()
            # add pixels that are out of the image in order to keep aspect ratio
            cropped = numpy.pad(cropped, ((abs(ystart)-max(ystart, 0),
                                           abs(yend)-min(yend, dpt.shape[0])),
                                          (abs(xstart)-max(xstart, 0),
                                           abs(xend)-min(xend, dpt.shape[1])),
                                          (0, 0)), mode='constant', constant_values=background)
        else:
            raise NotImplementedError()

        if thresh_z is True:
            msk1 = numpy.logical_and(cropped < zstart, cropped != 0)
            msk2 = numpy.logical_and(cropped > zend, cropped != 0)
            cropped[msk1] = zstart
            cropped[msk2] = 0.  # backface is at 0, it is set later
        return cropped
def getCrop ( self , dpt , xstart , xend , ystart , yend , zstart , zend , thresh_z = True , background = 0 ) : if len ( dpt . shape ) == 2 : cropped = dpt [ max ( ystart , 0 ) : min ( yend , dpt . shape [ 0 ] ) , max ( xstart , 0 ) : min ( xend , dpt . shape [ 1 ] ) ] . copy ( ) # add pixels that are out of the image in order to keep aspect ratio cropped = numpy . pad ( cropped , ( ( abs ( ystart ) - max ( ystart , 0 ) , abs ( yend ) - min ( yend , dpt . shape [ 0 ] ) ) , ( abs ( xstart ) - max ( xstart , 0 ) , abs ( xend ) - min ( xend , dpt . shape [ 1 ] ) ) ) , mode = 'constant' , constant_values = background ) elif len ( dpt . shape ) == 3 : cropped = dpt [ max ( ystart , 0 ) : min ( yend , dpt . shape [ 0 ] ) , max ( xstart , 0 ) : min ( xend , dpt . shape [ 1 ] ) , : ] . copy ( ) # add pixels that are out of the image in order to keep aspect ratio cropped = numpy . pad ( cropped , ( ( abs ( ystart ) - max ( ystart , 0 ) , abs ( yend ) - min ( yend , dpt . shape [ 0 ] ) ) , ( abs ( xstart ) - max ( xstart , 0 ) , abs ( xend ) - min ( xend , dpt . shape [ 1 ] ) ) , ( 0 , 0 ) ) , mode = 'constant' , constant_values = background ) else : raise NotImplementedError ( ) if thresh_z is True : msk1 = numpy . logical_and ( cropped < zstart , cropped != 0 ) msk2 = numpy . logical_and ( cropped > zend , cropped != 0 ) cropped [ msk1 ] = zstart cropped [ msk2 ] = 0. # backface is at 0, it is set later return cropped