OpenCV Questions and Answers – Erosion and Dilation

This set of OpenCV Multiple Choice Questions & Answers (MCQs) focuses on “Erosion and Dilation”.

1. Which of the following statement is TRUE about Opening in OpenCV?
a) Opening is just another name of erosion followed by dilation
b) Opening is reverse of Closing, Dilation followed by Erosion
c) It is the difference between dilation and erosion of an image
d) It is just opposite of erosion
View Answer

Answer: a
Explanation: Opening is just another name of erosion followed by dilation. It is useful in removing noise, as we explained above. Here we use the function, cv2.morphologyEx(). Closing is reverse of Opening, Dilation followed by Erosion.

2. Morphological operations are a set of operations that process images based on shapes.
a) True
b) False
View Answer

Answer: a
Explanation: Morphological operations are a set of operations that process images based on shapes. Morphological image processing basically deals with modifying geometric structures in the image. They apply a structuring element to an input image and generate an output image.

3. Which of the following statement is TRUE about Morphological Gradient?
a) Morphological Gradient is just another name of erosion followed by dilation
b) Morphological Gradient is reverse of Closing, Dilation followed by Erosion
c) It is the difference between dilation and erosion of an image
d) It is just opposite of erosion
View Answer

Answer: c
Explanation: Morphological Gradient is the difference between dilation and erosion of an image. The result will look like the outline of the object, while Opening is just another name of erosion followed by dilation.
advertisement
advertisement

4. Which function is used to Erode an image by using a specific structuring element?
a) erode()
b) eroded()
c) eroding()
d) erodestrcut()
View Answer

Answer: a
Explanation: erode() function or method is used to Erode an image by using a specific structuring element. The function erodes the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the minimum is taken.

5. Which of these functions is used to Dilate an image by using a specific structuring element?
a) dilater()
b) dilating()
c) dilate()
d) dilatstruct()
View Answer

Answer: c
Explanation: dilate() function is used to Dilate an image by using a specific structuring element. The function dilates the source image using the specified structuring element that determines the shape of a pixel neighborhood over which the maximum is taken.

6. What statement is FALSE about Dilation?
a) Dilation removes white noises, but it also shrinks our object
b) It is just opposite of erosion
c) Dilation operation consists of convolving an image A with some kernel (B), which can have any shape or size, usually a square or circle
d) Dilation can be applied several (iterations) times
View Answer

Answer: a
Explanation: Erosion removes white noises, but it also shrinks our object. So, we dilate it. Since noise is gone, they won’t come back, but our object area increases. It is also useful in joining broken parts of an object.

7. Black Hat is the difference between input image and Opening of the image.
a) True
b) False
View Answer

Answer: b
Explanation: Top Hat is the difference between input image and Opening of the image, while black hat is the difference between the closing of the input image and input image. The top-hat filter is used to enhance bright objects of interest in a dark background.
advertisement

8. Which OpenCV function or method returns a structuring element of the specified size and shape for morphological operations?
a) getStructElement()
b) getStructuring()
c) getStructuringElement()
d) StructuringElement()
View Answer

Answer: c
Explanation: The getStructuringElement() function or method returns a structuring element of the specified size and shape for morphological operations. The function constructs and returns the structuring element that can be further passed to erode, dilate or morphologyEx.

9. Which of these method or function is used to destroy all of the opened HighGUI windows?
a) destroywindows()
b) destroyAllwinodw()
c) destroyAllWindows()
d) destroyWindow()
View Answer

Answer: c
Explanation: destroyAllWindows() method or function is used to destroy all the opened highGUI (high graphics User Interface) windows, while destroyWindow is used to destroy the specified windows with the given name.
advertisement

10. Which OpenCV function or method perform advanced morphological transformations using an erosion and dilation as basic operations?
a) morphologyEx()
b) morpho()
c) morphoEx()
d) morphingEx()
View Answer

Answer: a
Explanation: The function cv::morphologyEx can perform advanced morphological transformations using an erosion and dilation as basic operations. Any of the operations can be done in-place. In case of multi-channel images, each channel is processed independently.

11. Which of the following is useful in closing small holes inside the foreground objects, or small black points on the object?
a) Morphological Gradient
b) Dilation
c) Erosion
d) Closing
View Answer

Answer: d
Explanation: Closing is reverse of Opening, Dilation followed by Erosion. It is useful in closing small holes inside the foreground objects, or small black points on the object. Opening is useful in removing noise.

12. Which of the following Enumerator is used for a closing operation?
a) Morphological Gradient is just another name of erosion followed by dilation
b) Morphological Gradient is reverse of Closing, Dilation followed by Erosion
c) It is the difference between dilation and erosion of an image
d) It is just opposite of erosion
View Answer

Answer: c
Explanation: Morphological Gradient is the difference between dilation and erosion of an image. The result will look like the outline of the object, while Opening is just another name of erosion followed by dilation.

13. Which of the following Enumerator is used for a Black hat operation?
a) MORPH_CLOSE
b) MORPH_OPEN
c) MORPH_ERODE
d) MORPH_BLACKHAT
View Answer

Answer: d
Explanation: MORPH_BLACKHAT is the enumerator used for black hat, while MORPH_OPEN is the enumerator used for an opening operation, MORPH_TOPHAT is the enumerator used for top hat and MORPH_CLOSE is the enumerator used for a closing operation.

14. Which of the following Enumerator is used for a Top Hat operation?
a) MORPH_CLOSE
b) MORPH_OPEN
c) MORPH_TOPHAT
d) MORPH_BLACKHAT
View Answer

Answer: c
Explanation: MORPH_TOPHAT is the enumerator used for Top Hat operation, while MORPH_OPEN is the enumerator used for an opening operation, MORPH_BLACKHAT is the enumerator used for Black Hat and MORPH_CLOSE is the enumerator used for a closing operation.

15. Which of the following Enumerator is used for a cross-shaped structuring element?
a) MORPH_RECT
b) MORPH_CROSS
c) MORPH_ELLIPSE
d) MORPH_MULTI
View Answer

Answer: b
Explanation: MORPH_CROSS is the enumerator used for a cross-shaped structuring element while, MORPH_RECT enumerator is used for a rectangular structuring element and MORPH_ELLIPSE is the enumerator used for an elliptic structuring element.

Sanfoundry Global Education & Learning Series – OpenCV.

To practice all areas of OpenCV, here is complete set of Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.