Challenge - 5 Problems
Morphological Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of dilation on a binary image
What is the output of the following MATLAB code snippet that performs dilation on a binary image?
BW = [0 0 0 0 0; 0 1 1 0 0; 0 1 0 0 0; 0 0 0 0 0];
se = strel('square', 3);
BW2 = imdilate(BW, se);
disp(BW2)
MATLAB
BW = [0 0 0 0 0; 0 1 1 0 0; 0 1 0 0 0; 0 0 0 0 0]; se = strel('square', 3); BW2 = imdilate(BW, se); disp(BW2)
Attempts:
2 left
💡 Hint
Dilation expands the white regions by the shape of the structuring element.
✗ Incorrect
The 3x3 square structuring element expands the white pixels in BW by one pixel in all directions, resulting in the output matrix shown in option C.
❓ Predict Output
intermediateResult of erosion on a binary image
What is the output of this MATLAB code that performs erosion on a binary image?
BW = [1 1 1 0 0; 1 1 1 0 0; 1 1 1 0 0; 0 0 0 0 0];
se = strel('disk', 1, 0);
BW2 = imerode(BW, se);
disp(BW2)
MATLAB
BW = [1 1 1 0 0; 1 1 1 0 0; 1 1 1 0 0; 0 0 0 0 0]; se = strel('disk', 1, 0); BW2 = imerode(BW, se); disp(BW2)
Attempts:
2 left
💡 Hint
Erosion shrinks white regions by removing pixels near edges based on the structuring element.
✗ Incorrect
The disk structuring element with radius 1 removes pixels on the edges of the white region, shrinking it as shown in option A.
🔧 Debug
advancedIdentify the error in morphological closing code
The following MATLAB code is intended to perform morphological closing on a binary image. What error will it produce when run?
BW = imread('text.png');
se = strel('line', 5, 45)
BW2 = imclose(BW, se);
imshow(BW2);MATLAB
BW = imread('text.png'); se = strel('line', 5, 45) BW2 = imclose(BW, se); imshow(BW2);
Attempts:
2 left
💡 Hint
Check the input type expected by imclose function.
✗ Incorrect
imclose expects a binary image (logical), but imread returns uint8. Without converting BW to logical, imclose will error.
🧠 Conceptual
advancedEffect of structuring element shape on morphological operations
Which statement best describes how the shape of the structuring element affects morphological operations like dilation and erosion?
Attempts:
2 left
💡 Hint
Think about how the shape controls which neighbors are considered during the operation.
✗ Incorrect
The shape of the structuring element defines which pixels around a target pixel are included in the operation, thus controlling how the image is modified.
❓ Predict Output
expertOutput of morphological gradient on a binary image
What is the output of this MATLAB code that computes the morphological gradient of a binary image?
BW = [0 0 0 0 0; 0 1 1 0 0; 0 1 1 0 0; 0 0 0 0 0];
se = strel('square', 3);
BWd = imdilate(BW, se);
BWe = imerode(BW, se);
BWg = BWd - BWe;
disp(BWg)
MATLAB
BW = [0 0 0 0 0; 0 1 1 0 0; 0 1 1 0 0; 0 0 0 0 0]; se = strel('square', 3); BWd = imdilate(BW, se); BWe = imerode(BW, se); BWg = BWd - BWe; disp(BWg)
Attempts:
2 left
💡 Hint
Morphological gradient highlights edges by subtracting eroded image from dilated image.
✗ Incorrect
The dilation expands the white region, erosion shrinks it, and their difference highlights the border pixels as shown in option A.
