def _normalization(image): assert image.__class__ == numpy.ndarray row, col = image.shape #stdImag standardized image stdImg = numpy.zeros((row, col)) """ What image.sum() do is the same as the following code but more faster than this. for i in xrange(self.Row): for j in xrange(self.Col): sigma += image[i][j] """ #sigma = image.sum() meanVal = image.mean() stdValue = image.std() if stdValue == 0: stdValue = 1 stdImg = (image - meanVal) / stdValue return stdImg
def Normimg(image): row, col = image.shape img_new = np.zeros((row, col)) meanVal = image.mean() stdValue = image.std() if stdValue == 0: stdValue = 1 img_new = (image - meanVal) / stdValue return img_new
def _normalization(image): assert image.__class__ == numpy.ndarray row, col = image.shape stdImg = numpy.zeros((row, col)) meanVal = image.mean() stdValue = image.std() if stdValue == 0: stdValue = 1 stdImg = (image - meanVal)/stdValue return stdImg