OpenCV MCQ (Multiple Choice Questions)

Here are OpenCV MCQs (Chapterwise).

1. Who developed the first OpenCV library?
a) Bjarne Stroustrup
b) Dennis Ritchie
c) Gary Bradsky
d) Guido van Rossum
View Answer

Answer: c
Explanation: Gary Bradsky was the first developer of OpenCV library. Guido van Rossum developed the Python language; Dennis Ritchie developed the C language and Bjarne Stroustrup developed C++.

2. What is the full name of the OpenCV?
a) Open Computer Vector
b) Open Computer Vision
c) Open Common Vector
d) Open Common Vision
View Answer

Answer: b
Explanation: OpenCV’s full name is Open Computer Vision where open means Open Source. OpenCV library is used in computer vision and Machine Learning. The main focus of the OpenCV library is real-time applications and real-time computer vision development.

3. Which OpenCV method or function is used for saving the image?
a) imload()
b) imget()
c) imread()
d) imwrite()
View Answer

Answer: d
Explanation: imwrite() is the method or function that is used for saving the image file to any storage device. The imwrite() function stores the image in specified format like jpg, png, tiff, bmp etc.
advertisement

4. In which languages OpenCV is written?
a) R
b) Python
c) C++
d) Java
View Answer

Answer: c
Explanation: The OpenCV is natively written in C++. OpenCV also retains some interface written in C language also but all the new development and algorithm are written C++ itself. Java, R, Python are the other languages that are supported by the OpenCV library.

5. Which of the following are the Access Modifiers types in Python-OpenCV?
a) Protected Access Modifier, Private Access Modifier, Non-Public Access Modifier.
b) Public Access Modifier, Protected Access Modifier, Private Access Modifier.
c) Public Access Modifier, Semi-Protected Access Modifier, Private Access Modifier.
d) Public Access Modifier, Protected Access Modifier, Semi-private Access Modifier.
View Answer

Answer: b
Explanation: There are 3 types of access modifiers types in Python-OpenCV, they are Public Access Modifiers—by default all data members and functions of class are Public, Protected Access Modifier–declared using single underscore (_) symbol, and Private Access Modifier—declared using double underscore(__) symbol.
Free 30-Day Python Certification Bootcamp is Live. Join Now!

6. Which OpenCV method or function is used for Bilateral Filtering technique?
a) cv2.boxbilateral()
b) cv2.bilateralbox()
c) cv2.bilateral()
d) cv2.bilateralFilter()
View Answer

Answer: d
Explanation: cv2.bilateralFilter() is the method or function used for Bilateral Filtering. Bilateral Filtering is a highly effective technique for noise removal from the image, while preserving the edges or sharpness of the image.

7. Which OpenCV function is used to construct the Gaussian Pyramid of the image?
a) gaussianpyramid()
b) buildPyramid()
c) pyramidbuild()
d) gaussian()
View Answer

Answer: b
Explanation: buildPyramid() function or method is used to construct the Gaussian Pyramid of the image. The function constructs a vector of images and builds the Gaussian pyramid by recursively applying pyrDown to the previously built pyramid layer.

8. Which OpenCV interpolation technique is nearest neighbor interpolation?
a) INTER_AREA
b) INTER_LINEAR
c) INTER_NEAREST
d) INTER_LANCZOS4
View Answer

Answer: c
Explanation: INTER_NEAREST is the OpenCV interpolation technique that uses nearest neighbor interpolation. INTER_NEAREST interpolation is the cheapest interpolation among other interpolation techniques but it produces blocky results.

9. Set of positive samples is created using which OpenCV haar cascade application?
a) opencv_createsamples
b) opencv_annotation
c) opencv_visualisation
d) opencv_traincascade
View Answer

Answer: a
Explanation: Set of positive samples (containing actual objects you want to detect) is created using the OpenCV (Open Computer Vision) opencv_createsamples application, whereas the set of negative samples (containing everything you do not want to detect) must be prepared manually.

advertisement

10. Which OpenCV function is used to equalize the histogram of a grayscale image?
a) equalizeHistogram
b) equalHist
c) equalizeHist
d) equalHistogram
View Answer

Answer: b
Explanation: – equalizeHist is the OpenCV function or method used for equalizing the histogram of a grayscale image. The algorithm normalizes the brightness and increases the contrast of the image.

11. Which of these is not a blurring technique in Open Computer Vision library?
a) Averaging Filtering
b) Median Filtering
c) Gaussian Filtering
d) Mode Filtering
View Answer

Answer: d
Explanation: Mode Filtering is not a blurring technique provided by OpenCV library. Averaging, Median filtering, Gaussian filtering, Bilateral filtering are the only techniques provided by OpenCV for blurring or smoothing the image.

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

Answer: c
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.

13. Which of the following statement is correct about kernel in OpenCV?
a) Kernel is also known as Filtering matrix in OpenCV
b) Kernel is also known as convolution matrix in OpenCV
c) Kernel is also known as Mixing Matrix in OpenCV
d) Kernel is also Known as Normalized matrix in OpenCV
View Answer

Answer: b
Explanation: Kernel is also known as convolution matrix in OpenCV. Kernel or convolution matrix mixes up or convolutes the pixels in the region. Kernel is a set of weights, which determine how each output pixel is calculated from a neighborhood of input pixels.

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

Answer: a
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.

15. Which of the following OpenCV function is used to apply a separable linear filter to an image?
a) seperFilter2D()
b) sepFilter()
c) separateFilter2D()
d) sepFilter2D()
View Answer

Answer: d
Explanation: sepFilter2D() is used to apply a separable linear filter to an image. First, every row of src (source) is filtered with the 1D kernel kernelX. Then, every column of the result is filtered with the 1D kernel kernelY. The final result shifted by delta is stored in dst (destination).

16. Which of the following is the third step in Canny Edge Detection Algorithm?
a) Hysteresis Thresholding
b) Non-maximum Suppression
c) Finding Intensity Gradient of the Image
d) Noise Reduction
View Answer

Answer: b
Explanation There are 4-5 steps in applying the Canny Edge Detection algorithm. The first step is Noise Reduction. The second step in Canny Edge Detection Algorithm is Finding Intensity Gradient of the Image. The third step is Non-maximum Suppression. After getting gradient magnitude and direction, a full scan of image is done to remove any unwanted pixels which may not constitute the edge. For this, at every pixel, pixel is checked if it is a local maximum in its neighborhood in the direction of gradient.

17. Which OpenCV method or function is used for Median Filtering?
a) cv2.medianFilter()
b) cv.bilateralBlur()
c) cv2.medianBlur()
d) cv2.mediansmooth()
View Answer

Answer: c
Explanation: cv2.medianBlur() function is used for Median Filtering technique. Cv2.medianBlur() computes the median of all the pixels under the kernel window and the central pixel is replaced with this median value. The kernel size must be a positive odd integer.

18. Which OpenCV Enumerator is used to remove alpha channel from RGB or BGR image?
a) COLOR_BGRA2BGR
b) COLORBGRA2BGR
c) COLORBGR2BGRA
d) COLOR_BGR2BGRA
View Answer

Answer: a
Explanation: The COLOR_BGRA2BGR Enumerator is used to remove alpha channel from RGB or BGR image while COLOR_BGR2BGRA Enumerator is used to add alpha channel to RGB (Red Green Blue) or BGR image.


Chapterwise Multiple Choice Questions on OpenCV

OpenCV MCQ

Our MCQs focus on all topics of the OpenCV subject, covering all topics. This will help you to prepare for exams, contests, online tests, quizzes, viva-voce, interviews, and certifications. You can practice these MCQs chapter by chapter starting from the 1st chapter or you can jump to any chapter of your choice.
  1. OpenCV Basics
  2. Handling Files, Cameras, and GUIs
  3. Filtering Images
  4. Tracking
  5. Detecting Edges and Applying Image Filters
  6. Cartoonizing

1. MCQ on OpenCV Basics

The section contains multiple choice questions and answers on history and basics of opencv.

  • History and Basics of OpenCV
  • 2. OpenCV Questions on Handling Files, Cameras, and GUIs

    The section covers questions and answers on basic io scripts and object oriented.

  • Basic I/O Scripts
  • Basic I/O Scripts – 2
  • Object-Oriented
  • 3. OpenCV MCQ on Filtering Images

    The section contains MCQs on curves, filters and channel types.

  • Types of Filters and Channel
  • Types of Filters and Channel – 2
  • Curves
  • 4. OpenCV MCQ on Tracking

    The section contains multiple choice questions and answers on haar cascades and tracking.

  • Haar Cascades
  • Tracking
  • 5. OpenCV Questions on Detecting Edges and Applying Image Filters

    The section covers questions and answers on capturing frames, 2d convolution, image blurring and sharpening, canny edge detection, motion blur, embossing, erosion and dilation.

  • Capturing Frames
  • 2D Convolution
  • Image Blurring
  • Canny Edge Detection
  • Motion Blur
  • Image Sharpening
  • Embossing
  • Erosion and Dilation
  • 6. OpenCV MCQ on Cartoonizing

    The section contains MCQs on Cartoonify an Image using Open CV.

  • Cartoon
  • Cartoon – 2
  • Cartoon – 3
  • If you would like to learn "OpenCV" thoroughly, you should attempt to work on the complete set of 1000+ MCQs - multiple choice questions and answers mentioned above. It will immensely help anyone trying to crack an exam or an interview.

    Wish you the best in your endeavor to learn and master OpenCV!

    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
    I’m Manish - Founder and CTO at Sanfoundry. I’ve been working in tech for over 25 years, with deep focus on Linux kernel, SAN technologies, Advanced C, Full Stack and Scalable website designs.

    You can connect with me on LinkedIn, watch my Youtube Masterclasses, or join my Telegram tech discussions.

    If you’re in your 40s–60s and exploring new directions in your career, I also offer mentoring. Learn more here.