image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

def plot_analysis(ww):
    for n in range(1, 7):
        gga = scipy.ndimage.filters.gaussian_filter(ww, 2 * n * 1.0)
        ggb = scipy.ndimage.filters.gaussian_filter(ww, n * 1.0)
        xx = ggb - gga
        mm = xx == scipy.ndimage.morphology.grey_dilation(xx, size=(3, 3))
        plt.axis('off')
        plt.axis('off')
        plt.axis('off')

imgs = img_gen()
for k in range(10):
    qq = next(imgs)
    ww = qq.reshape(20, 20)

def find_dice(ww):
    gga = scipy.ndimage.filters.gaussian_filter(ww, 4.0)
    ggb = scipy.ndimage.filters.gaussian_filter(ww, 2.0)
    ggb - gga
    xx = ggb - gga
    mm = xx == scipy.ndimage.morphology.grey_dilation(xx, size=(3, 3))
    mm[0, :] = 0
    mm[-1, :] = 0
    mm[:, 0] = 0
    mm[:, -1] = 0
    return np.nonzero(mm)
plt.figure(figsize=(15, 8))
imgs = img_gen()
for k in range(50):
    qq = next(imgs)
    ww = qq.reshape(20, 20)
    plt.subplot(5, 10, k + 1)
    plt.imshow(ww)
    plt.axis('off')
    for y, x in zip(*find_dice(ww)):
        plt.plot(x, y, 'ro')