Challenge - 5 Problems
Image Sharpening Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this image sharpening kernel application?
Given a 3x3 grayscale image matrix and a sharpening kernel, what is the resulting pixel value at the center after applying the kernel?
Signal Processing
import numpy as np image = np.array([[10, 10, 10], [10, 20, 10], [10, 10, 10]]) kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]]) result = np.sum(image * kernel) print(result)
Attempts:
2 left
💡 Hint
Multiply each kernel value by the corresponding image pixel and add all results.
✗ Incorrect
The sharpening kernel multiplies the center pixel by 5 and subtracts the neighbors once each. Calculation: (20*5) + (10*-1)*4 = 100 - 40 = 60.
❓ data_output
intermediateWhat is the shape of the output image after sharpening with a 3x3 kernel and no padding?
If you apply a 3x3 sharpening kernel to a 10x10 image using valid convolution (no padding), what will be the shape of the output image?
Attempts:
2 left
💡 Hint
Output size = input size - kernel size + 1 when no padding is used.
✗ Incorrect
For valid convolution, output height and width = 10 - 3 + 1 = 8, so output shape is (8, 8).
🔧 Debug
advancedWhy does this sharpening code produce a blurred image instead?
This code applies a kernel to sharpen an image but the output looks blurred. What is the likely cause?
Signal Processing
import numpy as np from scipy.signal import convolve2d image = np.array([[50, 50, 50], [50, 100, 50], [50, 50, 50]]) kernel = np.array([[0, 1, 0], [1, -4, 1], [0, 1, 0]]) sharpened = convolve2d(image, kernel, mode='same') print(sharpened)
Attempts:
2 left
💡 Hint
Check the sum of the kernel values and how it affects the image intensity.
✗ Incorrect
The kernel sums to zero (0+1+0+1-4+1+0+1+0=0), so it removes the original image intensity and only highlights edges, which can look like blur if not added back properly.
❓ visualization
advancedWhich plot shows the correct effect of sharpening on a 1D signal?
You have a 1D signal: [1, 2, 5, 2, 1]. You apply a sharpening kernel [ -1, 3, -1 ]. Which plot correctly shows the sharpened signal?
Signal Processing
import matplotlib.pyplot as plt import numpy as np signal = np.array([1, 2, 5, 2, 1]) kernel = np.array([-1, 3, -1]) sharpened = np.convolve(signal, kernel, mode='same') plt.plot(signal, label='Original') plt.plot(sharpened, label='Sharpened') plt.legend() plt.show()
Attempts:
2 left
💡 Hint
Sharpening increases contrast around edges or peaks.
✗ Incorrect
The sharpening kernel amplifies the center value and subtracts neighbors, making peaks sharper and valleys deeper.
🧠 Conceptual
expertWhy is unsharp masking preferred over direct Laplacian sharpening in image processing?
Unsharp masking sharpens images by subtracting a blurred version from the original. Why is this method often preferred over applying a Laplacian kernel directly?
Attempts:
2 left
💡 Hint
Consider how each method affects image brightness and noise.
✗ Incorrect
Unsharp masking subtracts a blurred image, preserving overall brightness and controlling noise better. Laplacian sharpening can amplify noise and cause brightness shifts.
