OpenCV Questions and Answers – Cartoon

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

1. What is the ASCII value for Escape (ESC)?
a) 39
b) 26
c) 27
d) 32
View Answer

Answer: c
Explanation: 27 is the ASCII value for Esc. Esc is a key used to generate the escape character, which can be represented as ASCII code 27 in decimal, Unicode U+001B, or Ctrl + [, while 32 is the ACII value for Space.

2. Which OpenCV Class is used for video capturing from video files, image sequences or cameras?
a) VideoCapture Class
b) VideoCap Class
c) VideoWriter Class
d) VideoRead Class
View Answer

Answer: a
Explanation: VideoCapture Class is used for video capturing from video files, image sequences or cameras. The class provides C++ API for capturing video from cameras or for reading video files and image sequences.

3. Which OpenCV function or method Opens a video file or a capturing device or an IP video stream for video capturing?
a) cv.VideoCapture.open()
b) cv.VideoCap.open()
c) cv.VideoCapture.op()
d) cv.VideoCapture.opened()
View Answer

Answer: a
Explanation: cv.VideoCapture.open() function or method Opens a video file or a capturing device or an IP video stream for video capturing. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
advertisement
advertisement

4. cap.read() returns a bool (True/False).
a) True
b) False
View Answer

Answer: a
Explanation: cap.read() returns a bool (True/False). If the frame is read correctly, it will be True. So, you can check for the end of the video by checking this returned value. Sometimes, cap may not have initialized the capture. In that case, this code shows an error. You can check whether it is initialized or not by the method cap.isOpened().

5. Which OpenCV function or method Closes video file or capturing device?
a) cv.VideoCapture.re()
b) cv.VideoCapture.close()
c) cv.VideoCapture.release()
d) cv.VideoCapture.closed()
View Answer

Answer: c
Explanation: cv.VideoCapture.release() is a function or method that Closes video file or capturing device. The method is automatically called by subsequent VideoCapture::open and by VideoCapture destructor. The C function also deallocates memory and clears *capture pointer.

6. getStructuringElement() returns a structuring element of the specified size and shape for morphological operations.
a) True
b) False
View Answer

Answer: a
Explanation: getStructuringElement() 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.

7. Which OpenCV function Decodes and returns the grabbed video frame?
a) retrieving()
b) decode()
c) grab()
d) retrieve()
View Answer

Answer: d
Explanation: retrieve() is the OpenCV function that Decodes and returns the grabbed video frame .If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the method returns false and the function returns an empty image (with cv::Mat, test it with Mat::empty()).
advertisement

8. Which of the following returns the specified VideoCapture property?
a) cv.VideoCapture.get(propId)
b) cv.VideoCapture.get(prop)
c) cv.VideoCapture(propId)
d) cv.VideoCapt.get(propId)
View Answer

Answer: a
Explanation: cv.VideoCapture.get(propId) returns the specified VideoCapture property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoCapture instance.

9. Which of the following function returns used backend API name?
a) getBackName()
b) getendName()
c) getBackendName()
d) getBackend()
View Answer

Answer: c
Explanation: getBackendName() is the OpenCV function or method that is used for returning the name of the backend API that is being used while using this function Stream should be opened in order to capture the API name.
advertisement

10. Which of the following function Grabs the next frame from video file or capturing device?
a) getnextName()
b) cv.VideoCapture.grab()
c) cv.Video.grab()
d) cv.Capture.grab()
View Answer

Answer: b
Explanation: cv.VideoCapture.grab() function Grabs the next frame from video file or capturing device. The primary use of the function is in multi-camera environments, especially when the cameras do not have hardware synchronization.

Sanfoundry Global Education & Learning Series – OpenCV.

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

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.