Challenge - 5 Problems
Morphological Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of erosion on a binary image
Given the following 5x5 binary image and a 3x3 square structuring element, what is the output after applying one iteration of erosion?
Computer Vision
import numpy as np import cv2 image = np.array([ [1, 1, 1, 1, 0], [1, 1, 1, 1, 0], [1, 1, 1, 1, 0], [1, 1, 1, 1, 1], [0, 0, 0, 1, 1] ], dtype=np.uint8) kernel = np.ones((3,3), np.uint8) eroded = cv2.erode(image, kernel, iterations=1) print(eroded)
Attempts:
2 left
💡 Hint
Erosion shrinks white regions by removing pixels on object boundaries where the structuring element does not fit entirely.
✗ Incorrect
Erosion with a 3x3 kernel removes pixels from the edges of white regions. Only the central 2x2 block in the top-left square remains white because the kernel fits fully there. The bottom-right white region is too small for the kernel, so it disappears.
🧠 Conceptual
intermediate1:30remaining
Effect of dilation on image noise
Which of the following best describes the effect of applying dilation to a binary image with small isolated noise pixels?
Attempts:
2 left
💡 Hint
Think about how dilation changes the size of white areas.
✗ Incorrect
Dilation expands white regions by adding pixels around them. Isolated noise pixels, which are white, will grow larger after dilation, making noise more prominent.
❓ Hyperparameter
advanced2:00remaining
Choosing kernel size for opening operation
You want to remove small white noise dots from a binary image without affecting larger objects. Which kernel size for the opening operation is most appropriate?
Attempts:
2 left
💡 Hint
Opening removes small objects smaller than the kernel size.
✗ Incorrect
Opening is erosion followed by dilation. It removes small white noise smaller than the kernel. To keep larger objects intact, the kernel must be bigger than noise but smaller than objects.
❓ Metrics
advanced1:30remaining
Evaluating closing operation effect
After applying a closing operation on a binary image, which metric would best indicate that small black holes inside white objects have been filled?
Attempts:
2 left
💡 Hint
Closing fills small black holes inside white regions.
✗ Incorrect
Closing is dilation followed by erosion. It fills small black holes inside white objects, increasing the white pixel area inside those objects.
🔧 Debug
expert2:00remaining
Identifying error in morphological operation code
What error will this code raise when applying dilation with an invalid kernel shape?
import numpy as np
import cv2
image = np.array([[0,1,0],[1,1,1],[0,1,0]], dtype=np.uint8)
kernel = np.array([1,1,1]) # Incorrect kernel shape
result = cv2.dilate(image, kernel)
Attempts:
2 left
💡 Hint
Check the expected shape of the kernel argument in OpenCV dilation.
✗ Incorrect
OpenCV expects the kernel to be a 2D array. Passing a 1D array causes an assertion failure with a specific error message about kernel size.