Jump into filtering

Image Processing in Python

Rebeca Gonzalez

Data Engineer

Filters

  • Enhancing an image
  • Emphasize or remove features
  • Smoothing
  • Sharpening
  • Edge detection
Image Processing in Python

Neighborhoods

Filter neighborhood

Image Processing in Python

Edge detection

Coins in where edges are detected

Image Processing in Python

Edge detection

Original image of chocolate kisses

Chocolate kisses image in where the edges are detected

Image Processing in 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")
Image Processing in Python

Edge detection

Sobel

Coins image in where edges are detected showing the shape

Image Processing in 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')
Image Processing in Python

Gaussian smoothing

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

Image Processing in Python

Gaussian smoothing

Image of Rebeca in Amsterdam holding a bike in a bridge

Image Processing in 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")
Image Processing in Python

Gaussian smoothing

Resulted image

Image Processing in Python

Gaussian smoothing

Resulted image zoomed in

Image Processing in Python

Let's practice!

Image Processing in Python

Preparing Video For Download...