Začínáme s filtrováním

Image Processing in Python

Rebeca Gonzalez

Data Engineer

Filtry

  • Vylepšení obrazu
  • Zvýraznění nebo odstranění rysů
  • Vyhlazení
  • Zostření
  • Detekce hran
Image Processing in Python

Okolí pixelu

Okolí filtru

Image Processing in Python

Detekce hran

Mince s detekovanými hranami

Image Processing in Python

Detekce hran

Původní obraz čokoládových bonbonů

Čokoládové bonbony s detekovanými hranami

Image Processing in Python

Detekce hran

Sobel
# Import module and function 
from skimage.filters import sobel

# Apply edge detection filter edge_sobel = sobel(image_coins)
# Show original and resulting image to compare plot_comparison(image_coins, edge_sobel, "Edge with Sobel")
Image Processing in Python

Detekce hran

Sobel

Obraz mincí s detekovanými hranami zobrazující jejich tvar

Image Processing in Python

Porovnání grafů

def plot_comparison(original, filtered, title_filtered):

    fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 6), sharex=True,
                                   sharey=True)
    ax1.imshow(original, cmap=plt.cm.gray)
    ax1.set_title('original')
    ax1.axis('off')
    ax2.imshow(filtered, cmap=plt.cm.gray)
    ax2.set_title(title_filtered)
    ax2.axis('off')
Image Processing in Python

Gaussovo vyhlazení

Obrázek psa vedle stejného obrázku s aplikovaným Gaussovým filtrem

Image Processing in Python

Gaussovo vyhlazení

Rebeca v Amsterdamu s kolem na mostě

Image Processing in Python

Gaussovo vyhlazení

# Import the module and function
from skimage.filters import gaussian

# Apply edge detection filter gaussian_image = gaussian(amsterdam_pic, multichannel=True)
# Show original and resulting image to compare plot_comparison(amsterdam_pic, gaussian_image, "Blurred with Gaussian filter")
Image Processing in Python

Gaussovo vyhlazení

Výsledný obraz

Image Processing in Python

Gaussovo vyhlazení

Výsledný obraz v přiblížení

Image Processing in Python

Pojďme si procvičit!

Image Processing in Python

Preparing Video For Download...