Bird
0
0

Which of the following is the correct syntax to perform erosion using scipy.ndimage on a binary image img with a 3x3 structuring element?

easy📝 Conceptual Q3 of 15
SciPy - Image Processing (scipy.ndimage)
Which of the following is the correct syntax to perform erosion using scipy.ndimage on a binary image img with a 3x3 structuring element?
Ascipy.ndimage.dilate(img, structure=np.ones((3,3)))
Bscipy.ndimage.erosion(img, structure=np.ones((3,3)))
Cscipy.ndimage.morphology.erosion(img, np.ones(3))
Dscipy.ndimage.erode(img, size=3)
Step-by-Step Solution
Solution:
  1. Step 1: Recall scipy erosion function syntax

    The correct function is scipy.ndimage.erosion with 'structure' parameter as a 2D array.
  2. Step 2: Check options for correct usage

    scipy.ndimage.erosion(img, structure=np.ones((3,3))) uses np.ones((3,3)) correctly; others have wrong function names or parameters.
  3. Final Answer:

    scipy.ndimage.erosion(img, structure=np.ones((3,3))) -> Option B
  4. Quick Check:

    Correct erosion syntax = scipy.ndimage.erosion(img, structure=np.ones((3,3))) [OK]
Quick Trick: Use scipy.ndimage.erosion with 2D structuring element [OK]
Common Mistakes:
  • Using wrong function name
  • Passing 1D structuring element
  • Confusing erosion with dilation function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes