Sobel Edge Detection
Core Vision Operations DS practice problem on Onlearn.
Difficulty: medium.
Topics: Understanding Spatial Gradient-based Edge Detection, Sobel Operator, Kernel Padding, Gradient Magnitude, Discrete Differentiation, Pixel Intensity Gradients, Computer Vision, Image Processing, Linear Algebra, Signal Processing, Matrix Operations, Spatial Filtering, Convolutional Neural Networks, Gradient Estimation, Edge Detection, Kernel Convolutions.
Implement a Sobel Edge Detection function from scratch. Your function should accept a 2D grayscale image (as a list of lists) and return the gradient magnitude matrix. Use the standard 3x3 Sobel kernels: Gx = [[ 1, 0, 1], [ 2, 0, 2], [ 1, 0, 1]] and Gy = [[ 1, 2, 1], [0, 0, 0], [1, 2, 1]]. Perform zero padding to handle boundary conditions.