Challenge - 5 Problems
Image Gradient Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Sobel filter on a simple image
What is the output array after applying the Sobel filter on the given 3x3 grayscale image using OpenCV's Sobel function with dx=1, dy=0, and kernel size 3?
Computer Vision
import cv2 import numpy as np image = np.array([[10, 10, 10], [10, 20, 10], [10, 10, 10]], dtype=np.uint8) sobelx = cv2.Sobel(image, cv2.CV_64F, 1, 0, ksize=3) output = sobelx.astype(int) print(output)
Attempts:
2 left
💡 Hint
Sobel with dx=1 detects horizontal edges by calculating differences along the x-axis.
✗ Incorrect
The Sobel filter with dx=1 and dy=0 calculates the gradient in the x-direction. The center pixel has a higher value (20) than its neighbors (10), so the gradient is positive on the left and negative on the right, resulting in the output shown in option D.
🧠 Conceptual
intermediate1:30remaining
Understanding Laplacian filter effect
Which statement best describes the effect of applying a Laplacian filter to a grayscale image?
Attempts:
2 left
💡 Hint
Think about what the second derivative tells us about intensity changes.
✗ Incorrect
The Laplacian filter calculates the second derivative of the image intensity, which highlights areas where the intensity changes rapidly, such as edges and corners.
❓ Hyperparameter
advanced1:30remaining
Choosing kernel size for Sobel filter
What is the effect of increasing the kernel size (ksize) parameter in OpenCV's Sobel function from 3 to 7?
Attempts:
2 left
💡 Hint
Larger kernels average over more pixels.
✗ Incorrect
Increasing the kernel size makes the Sobel filter consider a larger neighborhood, smoothing the image more and detecting broader edges while reducing sensitivity to noise.
🔧 Debug
advanced2:00remaining
Identifying error in Laplacian filter code
What error will this code produce when applying the Laplacian filter, and why?
import cv2
import numpy as np
image = np.array([[1,2],[3,4]], dtype=np.uint8)
laplacian = cv2.Laplacian(image, cv2.CV_8U)
print(laplacian)
Computer Vision
import cv2 import numpy as np image = np.array([[1,2],[3,4]], dtype=np.uint8) laplacian = cv2.Laplacian(image, cv2.CV_8U) print(laplacian)
Attempts:
2 left
💡 Hint
Laplacian can produce negative values; unsigned types cannot represent them.
✗ Incorrect
Using CV_8U (unsigned 8-bit) as the output depth causes negative values from the Laplacian to wrap around, producing incorrect results. The correct depth is CV_64F or CV_16S to handle negatives.
❓ Model Choice
expert2:30remaining
Best gradient method for detecting fine edges in noisy images
You want to detect fine edges in a noisy grayscale image. Which gradient method and parameter choice is best to maximize edge detection while minimizing noise?
Attempts:
2 left
💡 Hint
Consider methods that combine smoothing and edge detection.
✗ Incorrect
The Laplacian of Gaussian (LoG) filter smooths the image to reduce noise and then applies the Laplacian to detect edges, making it ideal for noisy images with fine edges.