OpenCV Questions and Answers – Embossing

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

1. Which color mixing channel is used RC color space?
a) BGR
b) HSV
c) CMV
d) HSL
View Answer

Answer: a
Explanation: The RC color space is easily simulated in BGR (Blue Green Red) channel. Blue and Green can mix to make cyan. By averaging the B (Blue) and G (Green) channels and storing the result in both B and G and then collapsing these two channels into one C(Cyan).

2. Which OpenCV function converts an image from one color space to another where the source image is stored in two planes?
a) cvtColorTwoPlane()
b) cvtColorToPlane()
c) cvtColorPlane()
d) cvtColorthePlane()
View Answer

Answer: a
Explanation: cvtColorTwoPlane() Converts an image from one colour space to another where the source image is stored in two planes. This function only supports YUV420 to RGB conversion as of now.

3. Which OpenCV Enumerator is used to convert grayscale to BGR565 (16-bit images)?
a) COLOR_GRAY2BGR565
b) COLOR_GRAYBGR565
c) COLOR_BGR565GRAY
d) COLOR_BGR5652GRAY
View Answer

Answer: a
Explanation: The COLOR_GRAY2BGR565 enumerator is used to convert grayscale to BGR565 (16-bit images) while COLOR_BGR5652GRAY enumerator is used to convert BGR565 (16-bit images) to grayscale.
advertisement
advertisement

4. The default color format in OpenCV is RGB.
a) True
b) False
View Answer

Answer: b
Explanation: The default color format in OpenCV is BGR not RGB. The first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.

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

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

6. The Bayer pattern is widely used in CCD and CMOS cameras.
a) True
b) False
View Answer

Answer: a
Explanation: The Bayer pattern is widely used in CCD and CMOS cameras. It enables you to get color pictures from a single plane where R, G, and B pixels (sensors of a particular component) are interleaved. The output RGB components of a pixel are interpolated from 1, 2, or 4 neighbors of the pixel having the same color.

7. Which OpenCV enumerator is used to convert between RGB and BGR color spaces (with or without alpha channel)?
a) COLORBGR2RGBA
b) COLOR_RGBA2RGB
c) COLOR_RGBA2RGB
d) COLOR_BGR2RGBA
View Answer

Answer: d
Explanation: COLOR_BGR2RGBA enumerator is used to convert between RGB and BGR color spaces (with or without alpha channel) while COLOR_BGRA2BGR enumerator is used to remove alpha channel from RGB or BGR image.
advertisement

8. What is the conventional ranges for R, G, and B channel values in CV_16U images?
a) 0 to 255
b) 0 to 65535
c) 0 to 1
d) 10 to 100
View Answer

Answer: b
Explanation: The conventional ranges for R (Red), G (Green), and B (Blue) channel values (RGB value) in CV_16U images is 0 to 65535, while 0 to 255 for CV_8U images, and 0 to 1 for CV_32F images.

9. Which of the following is the default color format in OpenCV?
a) RGB
b) YUV
c) BGR
d) HSV
View Answer

Answer: c
Explanation: The default color format in OpenCV is often referred to as RGB but it is actually BGR (the bytes are reversed). So, the first byte in a standard (24-bit) color image will be an 8-bit Blue component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.
advertisement

10. Which of the following is the correct code line to use cvtColor() function?
a) dst=cv.cvtColor(code[, dst[, dstCn]])
b) dst=cvtColor(src, code[, dst[, dstCn]])
c) dst=cv.cvtColor(src, code[, dst[, dstCn]])
d) dst=cv.cvtColor(src, code[, dst]])
View Answer

Answer: a
Explanation: The correct code line to use cvtColor() function is dst=cv.cvtColor(src, code[, dst[, dstCn]]) where src -input image: 8-bit unsigned, 16-bit unsigned (CV_16UC… ), or single-precision floating-point, dst -output image of the same size and depth as src, code-color space conversion code while, dstCn -number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code .

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.