Bird
Raised Fist0
Signal Processingdata~20 mins

Image sharpening in Signal Processing - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Image Sharpening Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What 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)
A20
B50
C60
D100
Attempts:
2 left
💡 Hint
Multiply each kernel value by the corresponding image pixel and add all results.
❓ data_output
intermediate
1:30remaining
What 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?
A(8, 8)
B(10, 10)
C(9, 9)
D(7, 7)
Attempts:
2 left
💡 Hint
Output size = input size - kernel size + 1 when no padding is used.
🔧 Debug
advanced
2:30remaining
Why 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)
AThe kernel values sum to zero, which removes the original image intensity causing a blurred effect.
BThe convolution mode 'same' pads with zeros causing border artifacts that blur the image.
CThe kernel is a Laplacian edge detector, not a sharpening kernel, causing edge enhancement that looks like blur.
DThe image array is integer type causing overflow and incorrect pixel values.
Attempts:
2 left
💡 Hint
Check the sum of the kernel values and how it affects the image intensity.
❓ visualization
advanced
2:00remaining
Which 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()
AA plot where the signal is smoothed with reduced peaks.
BA plot where the center peak is higher and neighbors are lower than original.
CA plot where the entire signal is uniformly increased by 3 times.
DA plot where the signal is inverted vertically.
Attempts:
2 left
💡 Hint
Sharpening increases contrast around edges or peaks.
🧠 Conceptual
expert
3:00remaining
Why 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?
ALaplacian sharpening is computationally more expensive than unsharp masking.
BLaplacian sharpening cannot enhance edges, while unsharp masking can.
CUnsharp masking requires no convolution, making it faster than Laplacian sharpening.
DUnsharp masking preserves image brightness and reduces noise amplification compared to Laplacian sharpening.
Attempts:
2 left
💡 Hint
Consider how each method affects image brightness and noise.

Practice

(1/5)
1. What is the main purpose of image sharpening in signal processing?
easy
A. To reduce the image size
B. To highlight edges and make the image clearer
C. To blur the image for artistic effect
D. To convert the image to grayscale

Solution

  1. Step 1: Understand image sharpening

    Image sharpening enhances edges and details to make images clearer.
  2. Step 2: Compare options

    Only To highlight edges and make the image clearer describes highlighting edges and clarity, which is the goal of sharpening.
  3. Final Answer:

    To highlight edges and make the image clearer -> Option B
  4. Quick Check:

    Image sharpening = highlight edges [OK]
Hint: Sharpening means making edges clearer, not blurring [OK]
Common Mistakes:
  • Confusing sharpening with blurring
  • Thinking sharpening changes image size
  • Assuming sharpening converts color formats
2. Which of the following is the correct Python syntax to apply a simple sharpening kernel using convolution with OpenCV?
easy
A. cv2.sharpen(image, kernel)
B. cv2.convolve(image, kernel)
C. cv2.filter2D(image, -1, kernel)
D. cv2.applySharpen(image, kernel)

Solution

  1. Step 1: Recall OpenCV function for convolution

    OpenCV uses cv2.filter2D() to apply kernels for filtering images.
  2. Step 2: Check options

    Only cv2.filter2D(image, -1, kernel) uses cv2.filter2D with correct parameters; others are invalid functions.
  3. Final Answer:

    cv2.filter2D(image, -1, kernel) -> Option C
  4. Quick Check:

    OpenCV convolution = filter2D [OK]
Hint: Use cv2.filter2D for custom kernel convolution [OK]
Common Mistakes:
  • Using non-existent OpenCV functions
  • Confusing convolution with sharpening function names
  • Incorrect parameter order
3. Given the following Python code using OpenCV, what will be the output type of sharpened?
import cv2
import numpy as np
image = cv2.imread('photo.jpg')
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
sharpened = cv2.filter2D(image, -1, kernel)
medium
A. A sharpened image as a NumPy array
B. An error due to kernel shape
C. A grayscale image
D. A blurred image

Solution

  1. Step 1: Understand filter2D output

    cv2.filter2D returns an image as a NumPy array after applying the kernel.
  2. Step 2: Analyze kernel and output

    The kernel is a sharpening kernel, so output is sharpened image, still in color and array form.
  3. Final Answer:

    A sharpened image as a NumPy array -> Option A
  4. Quick Check:

    filter2D output = NumPy array image [OK]
Hint: filter2D returns image array, not blurred or grayscale [OK]
Common Mistakes:
  • Assuming output is blurred instead of sharpened
  • Thinking output is grayscale without conversion
  • Believing kernel shape causes error
4. Identify the error in this Python code snippet for image sharpening:
import cv2
import numpy as np
image = cv2.imread('img.png')
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])
sharpened = cv2.filter2D(image, 1, kernel)
cv2.imshow('Sharpened', sharpened)
cv2.waitKey(0)
cv2.destroyAllWindows()
medium
A. The ddepth parameter should be -1, not 1
B. The kernel shape is invalid
C. cv2.imshow cannot display color images
D. cv2.waitKey is missing argument

Solution

  1. Step 1: Check ddepth parameter in filter2D

    ddepth=-1 means output image has same depth as input; 1 is invalid and may cause errors.
  2. Step 2: Validate other code parts

    Kernel shape is valid, cv2.imshow supports color, waitKey(0) is correct usage.
  3. Final Answer:

    The ddepth parameter should be -1, not 1 -> Option A
  4. Quick Check:

    ddepth=-1 for same depth [OK]
Hint: Use ddepth=-1 in filter2D to keep image depth [OK]
Common Mistakes:
  • Using wrong ddepth value causing errors
  • Thinking kernel shape is wrong
  • Misunderstanding cv2.imshow capabilities
5. You want to sharpen an image using unsharp masking. Which sequence of steps correctly applies this method?
hard
A. Directly apply a sharpening kernel without blurring
B. Add noise to the image, then apply a sharpening kernel
C. Convert image to grayscale, then apply a sharpening kernel
D. Blur the image, subtract the blurred from original, then add result back to original

Solution

  1. Step 1: Understand unsharp masking process

    Unsharp masking involves blurring the image, subtracting this blur from original to get edges, then adding edges back.
  2. Step 2: Evaluate options

    Only Blur the image, subtract the blurred from original, then add result back to original correctly describes this sequence; others miss key steps or add unrelated actions.
  3. Final Answer:

    Blur the image, subtract the blurred from original, then add result back to original -> Option D
  4. Quick Check:

    Unsharp masking = blur, subtract, add [OK]
Hint: Unsharp masking = blur, subtract, add back edges [OK]
Common Mistakes:
  • Skipping the blur step
  • Adding noise instead of subtracting blur
  • Applying sharpening kernel directly without unsharp steps
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard