Did I find the right examples for you? yes no

All Samples(17)  |  Call(17)  |  Derive(0)  |  Import(0)
Equalize the image histogram. This function applies a non-linear
mapping to the input image, in order to create a uniform
distribution of grayscale values in the output image.

:param image: The image to equalize.
:param mask: An optional mask.  If given, only the pixels selected by
             the mask are included in the analysis.
:return: An image.

        def equalize(image, mask=None):
    """
    Equalize the image histogram. This function applies a non-linear
    mapping to the input image, in order to create a uniform
    distribution of grayscale values in the output image.

    :param image: The image to equalize.
    :param mask: An optional mask.  If given, only the pixels selected by
                 the mask are included in the analysis.
    :return: An image.
    """
    if image.mode == "P":
        image = image.convert("RGB")
    h = image.histogram(mask)
    lut = []
    for b in range(0, len(h), 256):
        histo = [_f for _f in h[b:b+256] if _f]
        if len(histo) <= 1:
            lut.extend(list(range(256)))
        else:
            step = (reduce(operator.add, histo) - histo[-1]) // 255
            if not step:
                lut.extend(list(range(256)))
            else:
                n = step // 2
                for i in range(256):
                    lut.append(n // step)
                    n = n + h[i+b]
    return _lut(image, lut)
        


src/i/n/instakit-0.1.7/instakit/processors/adjust.py   instakit(Download)
    def process(self, img):
        return ImageOps.equalize(img,
            mask=self.mask)
 
 

src/d/j/django-tint-0.1/tint/imageprocs/default.py   django-tint(Download)
    def equalize(self, image, params):
        return ImageOps.equalize(image)
 
    def scale(self, image, params):
        return image.resize((params['width'], params['height']), Image.ANTIALIAS)

src/d/j/django-tint-HEAD/tint/imageprocs/default.py   django-tint(Download)
    def equalize(self, image, params):
        return ImageOps.equalize(image)
 
    def scale(self, image, params):
        return image.resize((params['width'], params['height']), Image.ANTIALIAS)

src/n/u/nupic-HEAD/py/regions/ImageSensorFilters/EqualizeHistogram.py   nupic(Download)
      croppedImage.load()
      alpha = croppedImage.split()[1]
      croppedImage = ImageOps.equalize(croppedImage.split()[0])
      croppedImage.putalpha(alpha)
      image.paste(croppedImage, bbox)
      compositeImage = Image.composite(croppedImage, noiseImage, alpha)
      # Equalize the composite image
      compositeImage = ImageOps.equalize(compositeImage.split()[0])
      # Paste the part of the equalized image within the mask back
      # into the cropped image
    elif self.region == 'all':
      alpha = image.split()[1]
      image = ImageOps.equalize(image.split()[0])
      image.putalpha(alpha)
    return image

src/c/o/concept-robot-HEAD/HRI/vision/pyvision_0.9.0/src/pyvision/types/img.py   concept-robot(Download)
    def normalize(self):
        import PIL.ImageOps
        pil = self.asPIL().copy()
        pil = PIL.ImageOps.equalize(pil.convert('L'))
        self.pil = pil

src/p/i/Pillow-2.4.0/Tests/test_imageops.py   Pillow(Download)
    ImageOps.deform(lena("RGB"), deformer)
 
    ImageOps.equalize(lena("L"))
    ImageOps.equalize(lena("RGB"))
 
    i = lena("RGB").resize((15, 16))
 
    ImageOps.equalize(i.convert("L"))
    ImageOps.equalize(i.convert("P"))
    ImageOps.equalize(i.convert("RGB"))

src/p/i/Pillow-HEAD/Tests/test_imageops.py   Pillow(Download)
    ImageOps.deform(lena("RGB"), deformer)
 
    ImageOps.equalize(lena("L"))
    ImageOps.equalize(lena("RGB"))
 
    i = lena("RGB").resize((15, 16))
 
    ImageOps.equalize(i.convert("L"))
    ImageOps.equalize(i.convert("P"))
    ImageOps.equalize(i.convert("RGB"))