Jump into filtering

Traitement d’images en Python

Rebeca Gonzalez

Data Engineer

Filters

  • Enhancing an image
  • Emphasize or remove features
  • Smoothing
  • Sharpening
  • Edge detection
Traitement d’images en Python

Neighborhoods

Filter neighborhood

Traitement d’images en Python

Edge detection

Coins in where edges are detected

Traitement d’images en Python

Edge detection

Original image of chocolate kisses

Chocolate kisses image in where the edges are detected

Traitement d’images en Python

Edge detection

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")
Traitement d’images en Python

Edge detection

Sobel

Coins image in where edges are detected showing the shape

Traitement d’images en Python

Comparing plots

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')
Traitement d’images en Python

Gaussian smoothing

Image of a dog next to the same image with Gaussian filter applied

Traitement d’images en Python

Gaussian smoothing

Image of Rebeca in Amsterdam holding a bike in a bridge

Traitement d’images en Python

Gaussian smoothing

# 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")
Traitement d’images en Python

Gaussian smoothing

Resulted image

Traitement d’images en Python

Gaussian smoothing

Resulted image zoomed in

Traitement d’images en Python

Let's practice!

Traitement d’images en Python

Preparing Video For Download...