Exemplo n.º 1
0
        self.n = n
        if nY is not None:
            self.nY = nY
        else:
            self.nY = n
    
    def process(self, img):
        import numpy
        from PIL import Image
        out = kernels.gaussian_blur_filter(
            numpy.array(img),
            sigma=self.n)
        return Image.fromarray(out)

if __name__ == '__main__':
    from PIL import Image
    from django_instakit.utils import static
    
    image_paths = map(
        lambda image_file: static.path('img', image_file),
            static.listfiles('img'))
    image_inputs = map(
        lambda image_path: Image.open(image_path).convert('RGB'),
            image_paths)
    
    for image_input in image_inputs:
        image_input.show()
        GaussianBlur(n=3).process(image_input).show()
    
    print image_paths
    
Exemplo n.º 2
0
 def names(cls):
     return [curve_file.rstrip('.acv') \
         for curve_file in static.listfiles('acv') \
         if curve_file.lower().endswith('.acv')]
Exemplo n.º 3
0
            right -= remove
            diff_x = diff_x - add - remove

        while diff_y:
            slice = min(diff_y, max(diff_y // 5, 10))
            start = img.crop((0, top, source_x, top + slice))
            end = img.crop((0, bottom - slice, source_x, bottom))
            add, remove = self.compare_entropy(start, end, slice, diff_y)
            top += add
            bottom -= remove
            diff_y = diff_y - add - remove

        box = (left, top, right, bottom)
        img = img.crop(box)
        return img


if __name__ == '__main__':
    from django_instakit.utils import static

    image_paths = map(lambda image_file: static.path('img', image_file),
                      static.listfiles('img'))
    image_inputs = map(
        lambda image_path: Image.open(image_path).convert('RGB'), image_paths)

    for image_input in image_inputs:
        image_input.show()
        SquareCrop().process(image_input).show()

    print image_paths
Exemplo n.º 4
0
 def names(cls):
     return [curve_file.rstrip('.acv') \
         for curve_file in static.listfiles('acv') \
         if curve_file.lower().endswith('.acv')]