C4W1L02 Edge Detection Examples

DeepLearningAI · 340K views · 2017 · 11:31

Open on YouTube

Machine learning & deep learningComputer vision, speech & NLPlecture

Why Stack Overflow recommends it

Stack Overflow users link it when asking about or explaining how convolution filters like the vertical edge detector work on pixel values.

Recommended by 0 people across 0 different months, 2018 to 2020.

What it is

A short lecture from Andrew Ng's Deep Learning Specialization (Course 4, Week 1) that introduces edge detection as a motivating example for convolutions. It walks through how a 3x3 filter slid over a small image highlights vertical edges, and how the sign of the result depends on brightness transitions.

What people said

Cites Harshit Kumar · 2018-12 · Stack Overflow · on “Intuition behind Edge Detection Matrices in Convolution Neural Network”

Filters detect spatial patterns such as edges in an image by detecting the changes in intensity values of the image. A quick recap: In terms of an image, a high-frequency image is the one where the intensity of the pixels changes by a large amount, while a low-frequency image the one where the intensity is almost uniform. An image has both high and low frequency components. The high-frequency components correspond to the edges of an object because at the edges the rate of change of intensity of pixel values is high. High pass filters are used to enhance the high-frequency parts of an image. Let's take an example that a part of your image has pixel values as [[10, 10, 0], [10, 10, 0], [10, 10

Cites Ashish Johnson · 2019-05 · Stack Overflow · on “Does the position of the pixels in an image govern the edge detection?”

Referring this video by andrew ng [this video] From this video I conclude that for detecting vertical edges in an image there should be some BRIGHTER followed by DARKER regions starting from the left side, then only this [[1,0,-1],[1,0,-1],[1,0,-1]] will act as a vertical edge detector otherwise not. Is my conclusion correct ? and Is the vice versa will also be true ?

Cites Penguin · 2020-12 · Stack Overflow · on “Is there a way to detect if a filter exists in an image or not?”

I'm following Andrew Ng's video1 [this video] video2 [LINK] on edge detection and I'm trying to detect if a filter exists in an image. So if I have 2 images and 2 filters (1 that detects horizontal lines and 1 that detects vertical lines): import numpy as np from scipy.signal import convolve2d img = np.array([[10,10,10,0,0,0],[10,10,10,0,0,0],[10,10,10,0,0,0],[10,10,10,0,0,0],[10,10,10,0,0,0],[10,10,10,0,0,0]]) img2 = np.array([[10,10,10,0,0,0],[10,10,10,0,0,0],[10,10,10,0,0,0],[0,0,0,10,10,10],[0,0,0,10,10,10],[0,0,0,10,10,10]]) vertical = np.array([[1,0,-1],[1,0,-1],[1,0,-1]]) horizontal = np.array([[1,1,1], [0,0,0], [-1,-1,-1]]) I tried to convolve the filters on each image using print(convolv