Exemplo n.º 1
0
def test_unsharp_mask():
    for image_fname in [
            '4_left.png', '35_left.png', '44_right.png', '68_right.png',
            '92_left.png'
    ]:
        image = cv2.imread(image_fname)
        image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)

        # image = A.CLAHE(always_apply=True)(image=image)['image']
        image = crop_black(image, tolerance=5)
        cropped = unsharp_mask(image)

        f, ax = plt.subplots(1, 2)
        ax[0].imshow(image)
        ax[1].imshow(cropped)
        f.show()
Exemplo n.º 2
0
def test_generate_wools():
    aug = AddCottonWools(p=1)

    for image_fname in [
            '4_left.png',
            # '35_left.png',
            '44_right.png',
            '68_right.png',
            # '92_left.png'
    ]:
        image = cv2.imread(image_fname)
        image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)

        image_with_wools = aug(image=image, diagnosis=0)['image']

        image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
        overlay = cv2.cvtColor(image_with_wools, cv2.COLOR_RGB2BGR)
        mask = unsharp_mask(overlay)

        cv2.imshow('image', image)
        cv2.imshow('overlay', overlay)
        cv2.imshow('clahe', mask)
        cv2.waitKey(-1)
Exemplo n.º 3
0
def test_augment_microaneurisms():
    aug = AddMicroaneurisms(p=1)
    for image_fname in [
            '4_left.png',
            # '35_left.png',
            '44_right.png',
            '68_right.png',
            # '92_left.png'
    ]:
        image = cv2.imread(image_fname)
        image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)

        image_with_aneurisms = aug(image=image, diagnosis=0)['image']

        image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
        image_with_aneurisms = cv2.cvtColor(image_with_aneurisms,
                                            cv2.COLOR_RGB2BGR)
        mask = unsharp_mask(image_with_aneurisms)

        cv2.imshow('image', image)
        cv2.imshow('overlay', image_with_aneurisms)
        cv2.imshow('clahe', mask)
        cv2.waitKey(-1)