Opencv With Python Quiz

10 Questions | Total Attempts: 5796

SettingsSettingsSettings
Please wait...
Opencv With Python Quiz


Questions and Answers
  • 1. 
    What does the import cv2 statement do?
    • A. 

      Imports the SciPy library for numerical processing.

    • B. 

      Imports the NumPy library for numerical processing.

    • C. 

      Imports our OpenCV Python bindings.

    • D. 

      Displays an image to our screen.

  • 2. 
    Given the following NumPy array shape, how would we interpret the width, height, and number of channels in the image: (400, 600, 3):
    • A. 

      Width=600, height=400, channels=3

    • B. 

      Width=600, height=3, channels=400

    • C. 

      Width=400, height=600, channels=3

    • D. 

      width=3, width=600, channels=400

  • 3. 
    Suppose our image has a width of 700 pixels, a height of 550 pixels, and 3 channels, one for each Red, Green, and Blue component. How would we express this image as a NumPy array shape?
    • A. 

      (550, 700, 3)

    • B. 

      (3, 550, 700)

    • C. 

      (700, 550, 3)

    • D. 

      (3, 700, 550)

  • 4. 
    We have an image that is 393 pixels wide and 312 tall. How many total pixels are in the image?
    • A. 

      367,848

    • B. 

      122,616

    • C. 

      280,800

    • D. 

      93,600

  • 5. 
    OpenCV stores RGB pixels in what order?
    • A. 

      GBR

    • B. 

      RGB

    • C. 

      BRG

    • D. 

      BGR

  • 6. 
    The RGB tuple (255, 0, 0) codes for red. But OpenCV would actually interpret this color as:
    • A. 

      Orange

    • B. 

      Blue

    • C. 

      Green

    • D. 

      Yellow

  • 7. 
    Translation: What is the correct line of code that defines a translation matrix that shifts an image 10 pixels up and 20 pixels to the right?
    • A. 

      M = np.float32([[1, 0, -20], [0, 1, 10]])

    • B. 

      M = np.float32([[1, 0, 20], [0, 1, -10]])

    • C. 

      M = np.float32([[1, 0, -10], [0, 1, 20]])

    • D. 

      M = np.float32([[1, 0, 10], [0, 1, -20]])

  • 8. 
    Translation: What is the correct line of code that defines a translation matrix that shifts an image 30 pixels down and 180 pixels to the left?
    • A. 

      M = np.float32([[1, 0, -180], [0, 1, -30]])

    • B. 

      M = np.float32([[1, 0, -180], [0, 1, 30]])

    • C. 

      M = np.float32([[1, 0, 30], [0, 1, 180]])

    • D. 

      M = np.float32([[1, 0, -30], [0, 1, -180]])

  • 9. 
    Cropping: I want to extract a rectangular region from my image starting at x=9, y=47 and ending at x=97, y=96. What is the correct line of code to perform this cropping?
    • A. 

      Crop = image[9:97, 47:96]

    • B. 

      Crop = image[47:96, 9:97]

    • C. 

      Crop = image[9:47, 97:96]

    • D. 

      crop = image[97:96, 9:47]

  • 10. 
    Cropping: Now, suppose I want to extract a second rectangular region from my image starting at x=1, y=48 and ending at x=80, y=69. What is the correct line of code to perform this cropping?
    • A. 

      Crop = image[80:69, 1:48]

    • B. 

      Crop = image[1:48, 80:69]

    • C. 

      Crop = image[48:80, 48:69]

    • D. 

      Crop = image[48:69, 1:80]

Back to Top Back to top