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
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
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
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.
4. cap.read() returns a bool (True/False).
a) True
b) False
View Answer
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
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
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
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()).
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
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
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.
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
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.