1. Home
  2. Explore
  3. Computer Science
  4. Python OpenCV Computer Vision

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Python OpenCV Computer Vision

  • 128Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Setup and Concepts

What is OpenCV primarily used for?

128 questions

  1. 1

    What is OpenCV primarily used for?

    1. A

      Compiling Python programs into machine code

    2. B

      Processing and analyzing images and video

    3. C

      Designing web pages and browser interfaces

    4. D

      Managing relational databases and tables

    Correct answer
    B

    Processing and analyzing images and video

    Explanation

    OpenCV is a computer vision library used for image and video processing, manipulation, and analysis.

  2. 2

    Which programming languages are identified as having OpenCV implementations?

    1. A

      Python, C++, and Java

    2. B

      C, Swift, and Kotlin

    3. C

      Java, PHP, and MATLAB

    4. D

      Python, Ruby, and JavaScript

    Correct answer
    A

    Python, C++, and Java

    Explanation

    The content identifies OpenCV as a computer vision library available in Python, C++, and Java.

  3. 3

    What does computer vision primarily attempt to derive insights from?

    1. A

      Text files and spreadsheets

    2. B

      Audio recordings and music

    3. C

      Source code and databases

    4. D

      Images and video

    Correct answer
    D

    Images and video

    Explanation

    Computer vision focuses on deriving insights from visual media such as images and video.

  4. 4

    Which command checks the installed Python version from a terminal?

    1. A

      pip --python-version

    2. B

      python --version

    3. C

      python --check-install

    4. D

      python --show-release

    Correct answer
    B

    python --version

    Explanation

    The command python --version displays the installed Python version.

  5. 5

    What minimum Python version is recommended for the course code?

    1. A

      Python 3.7 or newer

    2. B

      Python 4.0 or newer

    3. C

      Python 3.0 or newer

    4. D

      Python 2.7 or newer

    Correct answer
    A

    Python 3.7 or newer

    Explanation

    The material recommends using Python version 3.7 or above and warns that some code may not work with Python 2.

  6. 6

    Why is opencv-contrib-python recommended instead of only opencv-python?

    1. A

      It provides only the basic OpenCV functions without extras

    2. B

      It automatically converts every image into grayscale

    3. C

      It replaces Python with a faster compiled language

    4. D

      It includes the main OpenCV module and community contribution modules

    Correct answer
    D

    It includes the main OpenCV module and community contribution modules

    Explanation

    opencv-contrib-python includes the main OpenCV functionality as well as additional contribution modules provided by the community.

  7. 7

    What kind of operations is NumPy especially useful for in this course?

    1. A

      Training only face-recognition classifiers

    2. B

      Matrix and array manipulation

    3. C

      Installing Python interpreters

    4. D

      Video streaming over the internet

    Correct answer
    B

    Matrix and array manipulation

    Explanation

    NumPy is a scientific-computing package extensively used for matrix and array manipulation, transformation, and reshaping.

  8. 8

    What is the purpose of the utility package described as sear?

    1. A

      To provide helper functions that speed up computer-vision workflows

    2. B

      To replace OpenCV's image-reading functions

    3. C

      To convert Python code into Java programs

    4. D

      To provide a database for storing image labels

    Correct answer
    A

    To provide helper functions that speed up computer-vision workflows

    Explanation

    The package is described as a collection of utility functions and helpers intended to speed up computer-vision workflows.

  9. 9

    What does cv.imread return when it successfully reads an image?

    1. A

      A matrix containing the image's pixels

    2. B

      A list containing only the image filename

    3. C

      A text description of the image

    4. D

      A video-capture device object

    Correct answer
    A

    A matrix containing the image's pixels

    Explanation

    cv.imread takes an image path and returns the image as a matrix of pixels.

  10. 10

    Which statement correctly describes a relative image path?

    1. A

      It refers to a file relative to the current working directory

    2. B

      It must begin with the computer's root directory

    3. C

      It always identifies a file using a complete absolute path

    4. D

      It can refer only to files stored on the internet

    Correct answer
    A

    It refers to a file relative to the current working directory

    Explanation

    A relative path such as photos/cat.jpg identifies a file relative to the program's current working directory.

  11. 11

    What does cv.imshow do?

    1. A

      It displays an image matrix in a new window

    2. B

      It saves an image matrix as a compressed file

    3. C

      It converts an image matrix into a video

    4. D

      It calculates the number of pixels in an image

    Correct answer
    A

    It displays an image matrix in a new window

    Explanation

    cv.imshow displays the supplied image matrix in a named window.

  12. 12

    What is the effect of calling cv.waitKey(0)?

    1. A

      It pauses the program for exactly zero frames

    2. B

      It continuously records keyboard input into a file

    3. C

      It waits for zero milliseconds and immediately exits

    4. D

      It waits indefinitely for a keyboard key press

    Correct answer
    D

    It waits indefinitely for a keyboard key press

    Explanation

    cv.waitKey waits for a specified delay in milliseconds; a delay of zero means it waits indefinitely for a key press.

  13. 13

    What can the argument to cv.VideoCapture represent?

    1. A

      Only the width and height of a video

    2. B

      Only the name of an image window

    3. C

      A camera index or a path to a video file

    4. D

      A threshold and maximum pixel value

    Correct answer
    C

    A camera index or a path to a video file

    Explanation

    cv.VideoCapture accepts an integer camera index or a path to an existing video file.

  14. 14

    Which camera is most commonly referenced by index 0?

    1. A

      The second external camera

    2. B

      The computer's screen-capture device

    3. C

      The computer's default webcam

    4. D

      The first saved video file

    Correct answer
    C

    The computer's default webcam

    Explanation

    Camera index 0 commonly refers to the default webcam. Additional cameras may use indices such as 1 or 2.

  15. 15

    What does capture.read() return when reading a video?

    1. A

      Only the video's filename and duration

    2. B

      A threshold value and a binary mask

    3. C

      The camera index and frame dimensions

    4. D

      A success Boolean and the next video frame

    Correct answer
    D

    A success Boolean and the next video frame

    Explanation

    capture.read() returns a Boolean indicating success and the frame that was read.

  16. 16

    Why is a loop commonly used when reading a video with OpenCV?

    1. A

      Video is processed one frame at a time

    2. B

      The loop changes the camera into a file path

    3. C

      OpenCV can display only one pixel per loop

    4. D

      Each video must be converted into a still image first

    Correct answer
    A

    Video is processed one frame at a time

    Explanation

    Video reading uses a loop to retrieve and display successive frames individually.

  17. 17

    What action ends the video-reading process in the example?

    1. A

      Reaching the first frame restarts the capture

    2. B

      Pressing the letter d causes the loop to break

    3. C

      Pressing any number automatically saves the video

    4. D

      Calling imshow closes every OpenCV window

    Correct answer
    B

    Pressing the letter d causes the loop to break

    Explanation

    The example checks whether the pressed key corresponds to d; if so, it breaks out of the loop.

  18. 18

    What should be done with a video capture after it is no longer needed?

    1. A

      Increase the capture resolution before exiting

    2. B

      Convert the capture object into a grayscale image

    3. C

      Pass the capture object to cv.imread

    4. D

      Release the capture and destroy the OpenCV windows

    Correct answer
    D

    Release the capture and destroy the OpenCV windows

    Explanation

    The example releases the capture device and destroys all windows after the loop ends.

  19. 19

    What does a negative OpenCV assertion error commonly indicate in the described examples?

    1. A

      The image contains too many color channels

    2. B

      The requested image has been automatically resized

    3. C

      The computer has successfully finished processing the media

    4. D

      OpenCV could not find or read the specified media

    Correct answer
    D

    OpenCV could not find or read the specified media

    Explanation

    The error commonly occurs when OpenCV cannot locate or read an image, video, or additional frame at the specified location.

  20. 20

    Why are large images often resized or rescaled before display or processing?

    1. A

      To prevent OpenCV from reading any image data

    2. B

      To add more pixel information to the image

    3. C

      To reduce computational strain and processing requirements

    4. D

      To guarantee that every image becomes a color image

    Correct answer
    C

    To reduce computational strain and processing requirements

    Explanation

    Large media files contain more information and require more processing, so downscaling can reduce computational strain.

  21. 21

    How is a frame's width represented in the described NumPy shape indexing?

    1. A

      By frame.shape[2] only

    2. B

      By frame.shape[0]

    3. C

      By frame.shape[-1] only

    4. D

      By frame.shape[1]

    Correct answer
    D

    By frame.shape[1]

    Explanation

    In the described image representation, frame.shape[1] is the width and frame.shape[0] is the height.

  22. 22

    If an image is rescaled with a factor of 0.750.750.75, what happens to its dimensions?

    1. A

      The dimensions remain unchanged while colors change

    2. B

      Both width and height are multiplied by 0.750.750.75

    3. C

      Only the width is multiplied by 0.750.750.75

    4. D

      Both dimensions are divided by 0.750.750.75

    Correct answer
    B

    Both width and height are multiplied by 0.750.750.75

    Explanation

    The rescaling function multiplies both the original width and height by the scale factor.

  23. 23

    Which interpolation method is used in the example for resizing?

    1. A

      cv.INTER_NEAREST_ONLY

    2. B

      cv.INTER_AREA

    3. C

      cv.INTER_CHANNEL

    4. D

      cv.INTER_BINARY

    Correct answer
    B

    cv.INTER_AREA

    Explanation

    The example uses cv.INTER_AREA as the interpolation method for resizing.

  24. 24

    Why is downscaling generally preferred when changing a camera frame's resolution?

    1. A

      Cameras can display only images with fewer than three channels

    2. B

      A camera generally cannot capture beyond its maximum capability

    3. C

      Upscaling automatically removes all image noise

    4. D

      Downscaling always increases the camera's optical resolution

    Correct answer
    B

    A camera generally cannot capture beyond its maximum capability

    Explanation

    A camera that captures at a maximum resolution such as 720720720P generally cannot produce genuine 108010801080P output by software rescaling.

  25. 25

    What is the main limitation of the capture.set resolution method described?

    1. A

      It can resize only images that are larger than a monitor

    2. B

      It changes only the color channels of an image

    3. C

      It works only on grayscale still images

    4. D

      It is intended for live video rather than existing video files

    Correct answer
    D

    It is intended for live video rather than existing video files

    Explanation

    The described resolution-changing method works for live video from a camera or webcam, not for already existing standalone video files.

  26. 26

    What does a blank image created with np.zeros provide for drawing?

    1. A

      A video stream connected to the default webcam

    2. B

      A grayscale histogram of the source image

    3. C

      A black canvas on which shapes or text can be drawn

    4. D

      A fully white image containing detected contours

    Correct answer
    C

    A black canvas on which shapes or text can be drawn

    Explanation

    An array of zeros creates a black image that can serve as a blank canvas.

  27. 27

    Why does a blank drawing canvas need a shape such as 500×500×3500 \times 500 \times 3500×500×3 for a color image?

    1. A

      The last dimension stores the image's filename and path

    2. B

      The first dimension specifies the number of drawing commands

    3. C

      The three dimensions represent three separate image files

    4. D

      The three dimensions represent height, width, and color channels

    Correct answer
    D

    The three dimensions represent height, width, and color channels

    Explanation

    A color image array uses dimensions for height, width, and the three color channels.

  28. 28

    What does assigning the color value (0,255,0)(0,255,0)(0,255,0) produce in OpenCV's BGR format?

    1. A

      White

    2. B

      Blue

    3. C

      Green

    4. D

      Red

    Correct answer
    C

    Green

    Explanation

    OpenCV uses BGR ordering, so (0,255,0)(0,255,0)(0,255,0) represents green.

  29. 29

    What does a thickness of −1-1−1 mean when drawing a rectangle or circle?

    1. A

      The shape is filled

    2. B

      The border is one pixel wide

    3. C

      The shape is invisible

    4. D

      The shape is drawn only outside the image

    Correct answer
    A

    The shape is filled

    Explanation

    A thickness of −1-1−1 instructs OpenCV to fill the rectangle or circle.

  30. 30

    Which function draws a rectangle in OpenCV?

    1. A

      cv.box

    2. B

      cv.put_rectangle_text

    3. C

      cv.draw_square_only

    4. D

      cv.rectangle

    Correct answer
    D

    cv.rectangle

    Explanation

    The rectangle is drawn using cv.rectangle, with corner points, color, and thickness supplied as arguments.

  31. 31

    Which function draws a circle in OpenCV?

    1. A

      cv.round_shape

    2. B

      cv.draw_arc_only

    3. C

      cv.put_circle_text

    4. D

      cv.circle

    Correct answer
    D

    cv.circle

    Explanation

    The circle is drawn using cv.circle, which takes a center, radius, color, and thickness.

  32. 32

    Which function draws a standalone line between two points?

    1. A

      cv.line

    2. B

      cv.draw_edge_window

    3. C

      cv.segment_only

    4. D

      cv.connect_pixels_text

    Correct answer
    A

    cv.line

    Explanation

    OpenCV uses cv.line to draw a line between two specified points.

  33. 33

    What does cv.putText require in order to place text on an image?

    1. A

      Text, an origin, a font, a scale, a color, and a thickness

    2. B

      A camera index, a frame rate, and a threshold

    3. C

      Only the text string and the image filename

    4. D

      A contour list, a mask, and a histogram

    Correct answer
    A

    Text, an origin, a font, a scale, a color, and a thickness

    Explanation

    cv.putText uses the text, starting position, font face, font scale, color, and thickness to render text.

  34. 34

    What is the primary visual difference between a BGR image and a grayscale image?

    1. A

      BGR represents only intensity, while grayscale represents three colors

    2. B

      BGR is binary, while grayscale always contains four channels

    3. C

      BGR contains video frames, while grayscale contains only text

    4. D

      BGR represents three color channels, while grayscale represents intensity

    Correct answer
    D

    BGR represents three color channels, while grayscale represents intensity

    Explanation

    A BGR image has blue, green, and red channels; a grayscale image represents pixel intensity without separate color channels.

  35. 35

    Which color-conversion code converts an OpenCV BGR image to grayscale?

    1. A

      cv.COLOR_BGR2HSV

    2. B

      cv.COLOR_RGB2BGR

    3. C

      cv.COLOR_BGR2GRAY

    4. D

      cv.COLOR_GRAY2BGR

    Correct answer
    C

    cv.COLOR_BGR2GRAY

    Explanation

    cv.COLOR_BGR2GRAY converts a BGR image into grayscale.

  36. 36

    What is the main purpose of applying a blur to an image?

    1. A

      To convert every pixel into a binary label

    2. B

      To reduce noise and unwanted variations

    3. C

      To guarantee that every edge becomes sharper

    4. D

      To increase the number of color channels

    Correct answer
    B

    To reduce noise and unwanted variations

    Explanation

    Blurring can reduce noise caused by poor lighting, camera sensors, or other unwanted image variations.

  37. 37

    What does the Canny edge detector attempt to identify?

    1. A

      Edges and prominent intensity transitions

    2. B

      The file format of a video

    3. C

      The exact camera model used to capture an image

    4. D

      The names of people in an image

    Correct answer
    A

    Edges and prominent intensity transitions

    Explanation

    Canny is an edge-detection algorithm that identifies edge-like transitions in an image.

  38. 38

    What generally happens to detected edges when an image is blurred before applying Canny?

    1. A

      The Canny algorithm is replaced by a histogram

    2. B

      Fewer edges are usually detected because noise is reduced

    3. C

      The image gains additional color channels

    4. D

      Every pixel becomes an edge regardless of its intensity

    Correct answer
    B

    Fewer edges are usually detected because noise is reduced

    Explanation

    Blurring removes some noise and fine variations, often reducing the number of edges detected by Canny.

  39. 39

    What does dilation do to detected edges?

    1. A

      It generally makes edge regions thicker

    2. B

      It converts all edges into text labels

    3. C

      It changes the image from BGR directly to HSV

    4. D

      It always removes every edge from the image

    Correct answer
    A

    It generally makes edge regions thicker

    Explanation

    Dilation expands foreground regions, so edge structures generally become thicker.

  40. 40

    What is the typical purpose of erosion after dilation?

    1. A

      To shrink or thin the expanded structures

    2. B

      To calculate the number of histogram bins

    3. C

      To add a new color channel to the image

    4. D

      To enlarge the image while preserving aspect ratio

    Correct answer
    A

    To shrink or thin the expanded structures

    Explanation

    Erosion reduces foreground regions and can partially reverse the expansion caused by dilation.

  41. 41

    What does cv.resize do when given a destination size of 500×500500 \times 500500×500?

    1. A

      It crops a 500×500500 \times 500500×500 region without changing the original image

    2. B

      It changes only the image's brightness to a value of 500500500

    3. C

      It creates 500500500 separate copies of the image

    4. D

      It resizes the image to that destination size, potentially changing its aspect ratio

    Correct answer
    D

    It resizes the image to that destination size, potentially changing its aspect ratio

    Explanation

    The described call resizes the image to 500×500500 \times 500500×500 and ignores the original aspect ratio unless dimensions are chosen accordingly.

  42. 42

    How does array slicing crop an image?

    1. A

      It detects the external contours automatically

    2. B

      It selects a range of rows and columns from the image array

    3. C

      It changes every pixel to the average image intensity

    4. D

      It removes only the image's color channels

    Correct answer
    B

    It selects a range of rows and columns from the image array

    Explanation

    Because images are arrays, slicing row and column ranges selects a rectangular region of the image.

  43. 43

    What is translation in image processing?

    1. A

      Shifting an image along the xxx-axis, the yyy-axis, or both

    2. B

      Replacing each pixel with its median neighbor

    3. C

      Rotating an image around its center

    4. D

      Changing a color image into grayscale

    Correct answer
    A

    Shifting an image along the xxx-axis, the yyy-axis, or both

    Explanation

    Translation shifts an image horizontally, vertically, or in both directions.

  44. 44

    What is the effect of a negative xxx translation value?

    1. A

      The image shifts to the right

    2. B

      The image rotates clockwise

    3. C

      The image shifts downward

    4. D

      The image shifts to the left

    Correct answer
    D

    The image shifts to the left

    Explanation

    In the described translation convention, negative xxx values shift the image left.

  45. 45

    What is the effect of a positive yyy translation value?

    1. A

      The image shifts downward

    2. B

      The image shifts left

    3. C

      The image flips horizontally

    4. D

      The image shifts upward

    Correct answer
    A

    The image shifts downward

    Explanation

    Positive yyy values shift the image downward, while negative yyy values shift it upward.

  46. 46

    Around which point does the rotation function rotate an image when no point is supplied?

    1. A

      The upper-left corner only

    2. B

      The center of the image

    3. C

      The first detected contour

    4. D

      The lower-right corner only

    Correct answer
    B

    The center of the image

    Explanation

    When the rotation point is None, the function uses the image center as the rotation point.

  47. 47

    What is the effect of a negative rotation angle in the described convention?

    1. A

      The image rotates clockwise

    2. B

      The image becomes grayscale

    3. C

      The image translates left

    4. D

      The image rotates counterclockwise

    Correct answer
    A

    The image rotates clockwise

    Explanation

    The example states that positive angles rotate counterclockwise and negative angles rotate clockwise.

  48. 48

    Why can black triangular regions appear after rotating an image?

    1. A

      The image was automatically thresholded before rotation

    2. B

      The rotation converts all blue pixels to black

    3. C

      The rotated canvas contains areas with no source-image pixels

    4. D

      The image's histogram has too few bins

    Correct answer
    C

    The rotated canvas contains areas with no source-image pixels

    Explanation

    Rotating an image can expose canvas regions that are not covered by the original image; these regions default to black.

  49. 49

    What do the flip codes 000, 111, and −1-1−1 represent in the described OpenCV usage?

    1. A

      000 flips vertically, 111 horizontally, and −1-1−1 both ways

    2. B

      000 flips horizontally, 111 vertically, and −1-1−1 rotates

    3. C

      000 rotates, 111 crops, and −1-1−1 resizes

    4. D

      000 blurs, 111 thresholds, and −1-1−1 detects edges

    Correct answer
    A

    000 flips vertically, 111 horizontally, and −1-1−1 both ways

    Explanation

    The material specifies that 000 means vertical flipping, 111 means horizontal flipping, and −1-1−1 means both vertical and horizontal flipping.

  50. 50

    What is a contour?

    1. A

      A numerical label assigned to a detected face

    2. B

      A curve or line joining continuous points along an object's boundary

    3. C

      A rectangular window used to compute a blur

    4. D

      A list containing the colors used by a camera

    Correct answer
    B

    A curve or line joining continuous points along an object's boundary

    Explanation

    Contours represent object boundaries formed by curves or lines joining continuous boundary points.

  51. 51

    How do contours differ mathematically from edges?

    1. A

      They are related boundary concepts but are not mathematically identical

    2. B

      They are exactly the same operation under every definition

    3. C

      Contours describe colors, while edges describe file paths

    4. D

      Edges are always filled regions, while contours are always histograms

    Correct answer
    A

    They are related boundary concepts but are not mathematically identical

    Explanation

    The content notes that contours and edges can be treated similarly in many programming contexts, but they are mathematically different.

  52. 52

    Which findContours retrieval mode returns all contours in the image without focusing only on external contours?

    1. A

      cv.RETR_EXTERNAL

    2. B

      cv.RETR_NONE

    3. C

      cv.RETR_LIST

    4. D

      cv.RETR_BINARY_ONLY

    Correct answer
    C

    cv.RETR_LIST

    Explanation

    cv.RETR_LIST returns all contours. cv.RETR_EXTERNAL returns only external contours, while cv.RETR_TREE preserves hierarchical relationships.

  53. 53

    What does cv.RETR_EXTERNAL retrieve?

    1. A

      Only the first contour found

    2. B

      Every contour together with its pixel histogram

    3. C

      Only the external contours

    4. D

      Only contours nested inside other contours

    Correct answer
    C

    Only the external contours

    Explanation

    cv.RETR_EXTERNAL retrieves only the outermost contours.

  54. 54

    What does cv.RETR_TREE preserve?

    1. A

      The hierarchical relationships among contours

    2. B

      The RGB values of every contour pixel

    3. C

      The order in which video frames were captured

    4. D

      The original camera exposure settings

    Correct answer
    A

    The hierarchical relationships among contours

    Explanation

    cv.RETR_TREE returns contours along with their hierarchical organization, such as nested shapes.

  55. 55

    What is the purpose of CHAIN_APPROX_SIMPLE?

    1. A

      To compress redundant contour points while preserving the essential shape

    2. B

      To convert contours into grayscale images

    3. C

      To retrieve only contours at the outermost level

    4. D

      To increase the number of points along every contour

    Correct answer
    A

    To compress redundant contour points while preserving the essential shape

    Explanation

    CHAIN_APPROX_SIMPLE compresses contour representations, such as representing a straight line with its endpoints rather than every intermediate point.

  56. 56

    What is a color space?

    1. A

      A numerical ranking of image quality

    2. B

      A list of all files in an image directory

    3. C

      A system for representing pixel colors

    4. D

      A method for detecting camera movement

    Correct answer
    C

    A system for representing pixel colors

    Explanation

    A color space is a system used to represent the colors of pixels.

  57. 57

    What does HSV stand for?

    1. A

      Height, scale, and visibility

    2. B

      Histogram, shape, and variance

    3. C

      Horizontal, spatial, and vertical

    4. D

      Hue, saturation, and value

    Correct answer
    D

    Hue, saturation, and value

    Explanation

    HSV represents hue, saturation, and value and is described as a color space related to how humans conceive of color.

  58. 58

    Why can an OpenCV image appear to have inverted colors when displayed with Matplotlib?

    1. A

      Matplotlib automatically thresholds every image

    2. B

      OpenCV stores images using only grayscale intensities

    3. C

      OpenCV uses BGR ordering while Matplotlib expects RGB ordering

    4. D

      Matplotlib reverses the image vertically before display

    Correct answer
    C

    OpenCV uses BGR ordering while Matplotlib expects RGB ordering

    Explanation

    OpenCV conventionally reads images as BGR, whereas Matplotlib interprets the channels as RGB, causing red and blue to appear swapped.

  59. 59

    Which conversion corrects an OpenCV BGR image for display as RGB in Matplotlib?

    1. A

      cv.COLOR_RGB2GRAY

    2. B

      cv.COLOR_BGR2RGB

    3. C

      cv.COLOR_GRAY2BGR

    4. D

      cv.COLOR_BGR2HSV

    Correct answer
    B

    cv.COLOR_BGR2RGB

    Explanation

    cv.COLOR_BGR2RGB swaps the blue and red channel ordering so the image is correctly interpreted as RGB.

  60. 60

    How can a grayscale image be converted to HSV according to the content?

    1. A

      Convert grayscale directly to HSV with no intermediate step

    2. B

      Convert grayscale to a contour hierarchy first

    3. C

      Convert grayscale to RGB only after applying a histogram

    4. D

      Convert grayscale to BGR first, then convert BGR to HSV

    Correct answer
    D

    Convert grayscale to BGR first, then convert BGR to HSV

    Explanation

    The material states that grayscale cannot be converted directly to HSV in the described workflow; it should first be converted to BGR.

  61. 61

    What does cv.split do to a BGR image?

    1. A

      It divides the image into four equal spatial quadrants

    2. B

      It separates the image into foreground and background masks

    3. C

      It converts all channels into one histogram

    4. D

      It separates the image into blue, green, and red channel arrays

    Correct answer
    D

    It separates the image into blue, green, and red channel arrays

    Explanation

    cv.split separates a color image into its individual channel arrays.

  62. 62

    Why are individual color-channel arrays displayed as grayscale images?

    1. A

      OpenCV deletes the color information permanently during splitting

    2. B

      Grayscale display means that the channel contains no pixel values

    3. C

      Each channel is automatically converted into a contour

    4. D

      Each channel is a one-channel intensity array

    Correct answer
    D

    Each channel is a one-channel intensity array

    Explanation

    A separated channel contains one intensity value per pixel, so OpenCV displays it as a grayscale image.

  63. 63

    What does cv.merge do?

    1. A

      It combines all contours into a single boundary

    2. B

      It merges separate images by averaging their histograms

    3. C

      It combines separate channel arrays into a multichannel image

    4. D

      It joins multiple video files into one capture device

    Correct answer
    C

    It combines separate channel arrays into a multichannel image

    Explanation

    cv.merge combines individual color-channel arrays back into a multichannel image.

  64. 64

    What is a blur kernel or window?

    1. A

      A rectangle used only for drawing text

    2. B

      A file containing the trained face-recognition model

    3. C

      A neighborhood of pixels used to calculate a new pixel value

    4. D

      A list of camera indices supported by OpenCV

    Correct answer
    C

    A neighborhood of pixels used to calculate a new pixel value

    Explanation

    A blur kernel is a window placed over an image; surrounding pixels in that window influence the computed center pixel.

  65. 65

    What does a kernel size of 3×33 \times 33×3 specify?

    1. A

      A three-pixel-wide border and a three-pixel radius

    2. B

      A window containing three rows and three columns

    3. C

      Three color channels and three video frames

    4. D

      Three images with three histogram bins each

    Correct answer
    B

    A window containing three rows and three columns

    Explanation

    A 3×33 \times 33×3 kernel has three rows and three columns of pixels.

  66. 66

    How does averaging blur calculate the new center pixel?

    1. A

      It replaces the center pixel with a random channel value

    2. B

      It assigns the center pixel the maximum possible intensity

    3. C

      It uses the average of the surrounding pixel intensities

    4. D

      It uses only the darkest surrounding pixel

    Correct answer
    C

    It uses the average of the surrounding pixel intensities

    Explanation

    Averaging blur computes the center value from the average of the surrounding pixels in the kernel.

  67. 67

    What generally happens when the averaging-blur kernel increases from 3×33 \times 33×3 to 7×77 \times 77×7?

    1. A

      The image is converted into a contour hierarchy

    2. B

      The image becomes more blurred

    3. C

      The image gains two additional color channels

    4. D

      The image becomes automatically sharper

    Correct answer
    B

    The image becomes more blurred

    Explanation

    A larger averaging window incorporates more neighboring pixels, generally producing stronger blur.

  68. 68

    How does Gaussian blur differ from simple averaging blur?

    1. A

      Gaussian blur always produces more blur than every other method

    2. B

      Gaussian blur uses no neighboring pixels at all

    3. C

      Gaussian blur assigns different weights to neighboring pixels

    4. D

      Gaussian blur changes only the image's width and height

    Correct answer
    C

    Gaussian blur assigns different weights to neighboring pixels

    Explanation

    Gaussian blur weights neighboring pixels rather than treating all surrounding pixels equally.

  69. 69

    What is a typical characteristic of Gaussian blur compared with averaging blur?

    1. A

      It always removes every edge from the image

    2. B

      It requires a binary image rather than a color or grayscale image

    3. C

      It replaces every pixel with the maximum intensity

    4. D

      It often produces less abrupt and more natural-looking blur

    Correct answer
    D

    It often produces less abrupt and more natural-looking blur

    Explanation

    The material describes Gaussian blur as more natural and generally less blurred than averaging for comparable kernel sizes.

  70. 70

    How does median blur determine the new center pixel?

    1. A

      It uses the first pixel encountered in the kernel

    2. B

      It uses the median of the neighboring pixel intensities

    3. C

      It uses the weighted mean of all color channels

    4. D

      It uses the minimum possible pixel value

    Correct answer
    B

    It uses the median of the neighboring pixel intensities

    Explanation

    Median blur replaces the center value using the median of the surrounding values.

  71. 71

    For what type of noise is median blur especially useful?

    1. A

      Salt-and-pepper noise

    2. B

      Noise created by incorrect contour hierarchies

    3. C

      Noise caused only by missing color channels

    4. D

      Noise caused only by excessive image dimensions

    Correct answer
    A

    Salt-and-pepper noise

    Explanation

    Median blurring is described as effective for reducing salt-and-pepper noise and substantial image noise.

  72. 72

    What distinguishes bilateral filtering from traditional blurring methods?

    1. A

      It uses only the farthest pixels from the center

    2. B

      It removes all color information before filtering

    3. C

      It converts every image into a binary mask

    4. D

      It blurs while attempting to preserve edges

    Correct answer
    D

    It blurs while attempting to preserve edges

    Explanation

    Bilateral filtering applies smoothing while retaining important image edges.

  73. 73

    What does a larger bilateral-filter spatial sigma imply?

    1. A

      The image is automatically converted to grayscale

    2. B

      Pixels farther from the center can influence the calculation

    3. C

      The filter uses fewer neighboring pixels

    4. D

      Only pixels with identical colors influence the calculation

    Correct answer
    B

    Pixels farther from the center can influence the calculation

    Explanation

    A larger spatial sigma allows pixels farther away from the central pixel to affect the blur.

  74. 74

    What is the basic behavior of a bitwise AND between two binary images?

    1. A

      It inverts every active and inactive pixel

    2. B

      It preserves only regions active in exactly one image

    3. C

      It preserves every region active in either image

    4. D

      It preserves regions that are active in both images

    Correct answer
    D

    It preserves regions that are active in both images

    Explanation

    Bitwise AND returns the intersection: pixels remain active only where both input images are active.

  75. 75

    What is the basic behavior of a bitwise OR between two binary images?

    1. A

      It preserves only regions active in neither image

    2. B

      It preserves only regions active in both images

    3. C

      It preserves regions active in either or both images

    4. D

      It reverses the colors of one input image

    Correct answer
    C

    It preserves regions active in either or both images

    Explanation

    Bitwise OR combines active regions from both images, including their intersection.

  76. 76

    What is the basic behavior of a bitwise XOR between two binary images?

    1. A

      It turns every pixel into its grayscale average

    2. B

      It preserves every region regardless of activity

    3. C

      It preserves regions active in both images

    4. D

      It preserves regions active in exactly one of the images

    Correct answer
    D

    It preserves regions active in exactly one of the images

    Explanation

    XOR returns the non-intersecting regions: pixels active in one input but not both.

  77. 77

    What does bitwise NOT do to a binary image?

    1. A

      It inverts active and inactive pixel values

    2. B

      It returns only the intersection with another image

    3. C

      It removes all pixels outside the image center

    4. D

      It averages the image with a second source image

    Correct answer
    A

    It inverts active and inactive pixel values

    Explanation

    Bitwise NOT changes active pixels to inactive and inactive pixels to active.

  78. 78

    What is the purpose of masking in image processing?

    1. A

      To replace all image colors with grayscale

    2. B

      To increase the resolution of every image

    3. C

      To identify the camera that captured the image

    4. D

      To focus processing on selected regions of an image

    Correct answer
    D

    To focus processing on selected regions of an image

    Explanation

    Masking isolates selected portions of an image so unwanted regions can be ignored.

  79. 79

    What requirement must a mask satisfy when used with an image in the described operation?

    1. A

      The mask must have the same dimensions as the image

    2. B

      The mask must be a text file rather than an array

    3. C

      The mask must contain three more channels than the image

    4. D

      The mask must always be twice as large as the image

    Correct answer
    A

    The mask must have the same dimensions as the image

    Explanation

    The material emphasizes that a mask must have the same dimensions as the image or the operation will fail.

  80. 80

    How is the masked image produced in the example?

    1. A

      By applying bitwise XOR to the image filename

    2. B

      By applying a bitwise AND between the source image and the mask

    3. C

      By adding the source image to its histogram

    4. D

      By rotating the source image around the mask center

    Correct answer
    B

    By applying a bitwise AND between the source image and the mask

    Explanation

    The masked image is produced with a bitwise AND operation using the source image and a mask.

  81. 81

    What does an image histogram visualize?

    1. A

      The number of cameras connected to a computer

    2. B

      The geometric center of every detected face

    3. C

      The order of contours in an image

    4. D

      The distribution of pixel intensities

    Correct answer
    D

    The distribution of pixel intensities

    Explanation

    A histogram plots how frequently different pixel-intensity values occur.

  82. 82

    What does the horizontal axis of the described grayscale histogram represent?

    1. A

      The image's color-channel names

    2. B

      The sequence of video frames

    3. C

      Pixel-intensity intervals or bins

    4. D

      The number of image rows

    Correct answer
    C

    Pixel-intensity intervals or bins

    Explanation

    The histogram's horizontal axis represents bins covering possible pixel intensities, from 000 through 255255255.

  83. 83

    What does the vertical axis of the described histogram represent?

    1. A

      The width of the image in pixels

    2. B

      The number of contours detected per frame

    3. C

      The number of pixels in each intensity bin

    4. D

      The number of color channels in each pixel

    Correct answer
    C

    The number of pixels in each intensity bin

    Explanation

    The vertical axis shows how many pixels have intensities within each bin.

  84. 84

    How is a color histogram different from a grayscale histogram?

    1. A

      It contains no pixel-intensity information

    2. B

      It can represent separate distributions for the blue, green, and red channels

    3. C

      It always has exactly one bin

    4. D

      It can be computed only from binary masks

    Correct answer
    B

    It can represent separate distributions for the blue, green, and red channels

    Explanation

    A color histogram can plot intensity distributions separately for each color channel.

  85. 85

    What is the purpose of computing a histogram with a mask?

    1. A

      To analyze pixel intensities only within a selected region

    2. B

      To convert all image channels into contours

    3. C

      To determine the camera index used for capture

    4. D

      To increase the total number of pixels in the image

    Correct answer
    A

    To analyze pixel intensities only within a selected region

    Explanation

    A mask restricts histogram computation to the selected part of the image.

  86. 86

    What does simple thresholding do when a pixel intensity is below the threshold?

    1. A

      It replaces the pixel with its neighborhood median

    2. B

      It marks the pixel as a detected face

    3. C

      It sets the pixel to the maximum value

    4. D

      It sets the pixel to zero or black

    Correct answer
    D

    It sets the pixel to zero or black

    Explanation

    In the described binary thresholding rule, values below the threshold become zero.

  87. 87

    What does simple binary thresholding do when a pixel intensity is above the threshold?

    1. A

      It changes the pixel into a camera index

    2. B

      It sets the pixel to the selected maximum value, such as 255255255

    3. C

      It always sets the pixel to zero

    4. D

      It replaces the pixel with a contour coordinate

    Correct answer
    B

    It sets the pixel to the selected maximum value, such as 255255255

    Explanation

    Pixels above the threshold are assigned the maximum value, typically 255255255 for a white binary pixel.

  88. 88

    What is the main limitation of simple thresholding?

    1. A

      The threshold value must be manually specified

    2. B

      It automatically changes the image dimensions

    3. C

      It cannot produce binary images

    4. D

      It requires a video rather than an image

    Correct answer
    A

    The threshold value must be manually specified

    Explanation

    Simple thresholding depends on a manually chosen threshold value, which may not work well across varying image regions.

  89. 89

    How does inverse binary thresholding differ from ordinary binary thresholding?

    1. A

      It assigns the maximum value to pixels below the threshold instead

    2. B

      It computes a median instead of comparing intensities

    3. C

      It assigns zero to every pixel regardless of intensity

    4. D

      It changes only the image's width and height

    Correct answer
    A

    It assigns the maximum value to pixels below the threshold instead

    Explanation

    Inverse thresholding reverses the usual mapping: pixels below the threshold become white and pixels above it become black.

  90. 90

    What is the central idea of adaptive thresholding?

    1. A

      The threshold is determined by the camera index

    2. B

      The threshold is always set to exactly 255255255

    3. C

      The threshold is replaced by a contour hierarchy

    4. D

      The threshold is computed locally rather than fixed for the entire image

    Correct answer
    D

    The threshold is computed locally rather than fixed for the entire image

    Explanation

    Adaptive thresholding determines threshold values from local neighborhoods, allowing different image regions to use different thresholds.

  91. 91

    What does the block size represent in adaptive thresholding?

    1. A

      The number of cameras used to capture the image

    2. B

      The total number of color channels in the image

    3. C

      The number of output classes in a neural network

    4. D

      The neighborhood used to compute a local threshold

    Correct answer
    D

    The neighborhood used to compute a local threshold

    Explanation

    The block size specifies the local neighborhood or window used to calculate the adaptive threshold.

  92. 92

    How does Gaussian adaptive thresholding differ from mean adaptive thresholding?

    1. A

      It ignores the local neighborhood entirely

    2. B

      It uses weighted neighborhood values when computing the local threshold

    3. C

      It converts the image directly into a color histogram

    4. D

      It always uses a manually fixed global threshold

    Correct answer
    B

    It uses weighted neighborhood values when computing the local threshold

    Explanation

    Gaussian adaptive thresholding applies weights to neighborhood pixels, unlike the simple mean method.

  93. 93

    How do gradients relate to edges in the course's programming discussion?

    1. A

      Edges are calculated only from histograms, never gradients

    2. B

      They can be treated as edge-like regions, although they are mathematically different

    3. C

      They are mathematically identical in every context

    4. D

      Gradients refer only to color channels, never boundaries

    Correct answer
    B

    They can be treated as edge-like regions, although they are mathematically different

    Explanation

    The content distinguishes gradients and edges mathematically but notes that gradients can be treated as edge-like regions in programming contexts.

  94. 94

    What does the Laplacian method compute?

    1. A

      The average color of every detected face

    2. B

      The number of bins in a color histogram

    3. C

      Image gradients using second-derivative information

    4. D

      The dimensions of the camera sensor

    Correct answer
    C

    Image gradients using second-derivative information

    Explanation

    The Laplacian method computes gradient information in the grayscale image and highlights edge-like transitions.

  95. 95

    Why is the absolute value taken after computing Laplacian gradients?

    1. A

      Negative values indicate that the image was not resized

    2. B

      Image pixel values cannot represent negative intensities

    3. C

      The absolute value converts every image into HSV

    4. D

      Absolute values create additional color channels

    Correct answer
    B

    Image pixel values cannot represent negative intensities

    Explanation

    Gradient calculations can produce negative values, but image intensities cannot be negative, so absolute values are used before converting to an image datatype.

  96. 96

    In which directions does the Sobel method compute gradients in the example?

    1. A

      Along the time direction of a video

    2. B

      Only along the diagonal direction

    3. C

      Along the xxx and yyy directions

    4. D

      Only along the color-channel direction

    Correct answer
    C

    Along the xxx and yyy directions

    Explanation

    Sobel computes separate gradient images in the xxx and yyy directions.

  97. 97

    How are the Sobel xxx and Sobel yyy results combined in the example?

    1. A

      By applying inverse thresholding to only the xxx result

    2. B

      By replacing both with the original BGR image

    3. C

      By multiplying their filenames

    4. D

      With a bitwise OR operation

    Correct answer
    D

    With a bitwise OR operation

    Explanation

    The two Sobel gradient images are combined using a bitwise OR operation.

  98. 98

    Why is Canny often preferred for cleaner edge detection in the described comparison?

    1. A

      It automatically identifies the names of objects

    2. B

      It is a multistage algorithm designed to produce cleaner edge results

    3. C

      It does not use any intensity information

    4. D

      It works only on images with no noise

    Correct answer
    B

    It is a multistage algorithm designed to produce cleaner edge results

    Explanation

    Canny is described as a more advanced multistage edge detector that often produces cleaner edges than the basic Laplacian or Sobel results.

  99. 99

    What is the difference between face detection and face recognition?

    1. A

      Detection finds whether a face is present; recognition identifies whose face it is

    2. B

      Detection requires labels; recognition never uses image data

    3. C

      Detection and recognition are identical terms for the same task

    4. D

      Detection identifies a person; recognition only changes image brightness

    Correct answer
    A

    Detection finds whether a face is present; recognition identifies whose face it is

    Explanation

    Face detection locates or confirms faces, whereas face recognition attempts to identify the person associated with a face.

  100. 100

    What does a classifier do in face detection?

    1. A

      It converts all face images into histograms

    2. B

      It resizes every detected face to the same dimensions

    3. C

      It decides whether an image region is positive or negative for a face

    4. D

      It records the camera's maximum resolution

    Correct answer
    C

    It decides whether an image region is positive or negative for a face

    Explanation

    A classifier determines whether a given image region contains a face or does not contain a face.

  101. 101

    What type of training data does a face classifier require?

    1. A

      Only video filenames and camera indices

    2. B

      Only blank images with no objects

    3. C

      Only one image of each person

    4. D

      Many images both with faces and without faces

    Correct answer
    D

    Many images both with faces and without faces

    Explanation

    Classifiers must be trained on many positive examples containing faces and negative examples without faces.

  102. 102

    What is a Haar cascade in the described OpenCV workflow?

    1. A

      A NumPy array used only for drawing rectangles

    2. B

      A pretrained classifier that can detect visual objects such as faces

    3. C

      A histogram equalization method for grayscale images

    4. D

      A color-space conversion between BGR and HSV

    Correct answer
    B

    A pretrained classifier that can detect visual objects such as faces

    Explanation

    Haar cascades are pretrained classifiers supplied for detecting objects, including frontal faces.

  103. 103

    How are local binary pattern classifiers described relative to Haar cascades?

    1. A

      They are identical to simple global thresholding

    2. B

      They are used only to resize video frames

    3. C

      They are described as unable to detect faces

    4. D

      They are described as more advanced and less prone to image noise

    Correct answer
    D

    They are described as more advanced and less prone to image noise

    Explanation

    The content describes local binary pattern classifiers as more advanced and less sensitive to noise than Haar cascades.

  104. 104

    Why is a face image converted to grayscale before Haar-cascade detection?

    1. A

      Grayscale images contain more color information than BGR images

    2. B

      The classifier relies mainly on structural edges rather than skin color

    3. C

      Haar cascades require three color channels for every detection

    4. D

      Converting to grayscale automatically identifies the person's name

    Correct answer
    B

    The classifier relies mainly on structural edges rather than skin color

    Explanation

    The described detection method focuses on object structure and edges, so color information is unnecessary.

  105. 105

    What does detectMultiScale return in the face-detection example?

    1. A

      A single string containing the person's identity

    2. B

      A histogram for every color channel

    3. C

      A list of all pixels that were converted to grayscale

    4. D

      Rectangular coordinates for detected face regions

    Correct answer
    D

    Rectangular coordinates for detected face regions

    Explanation

    detectMultiScale returns rectangular regions represented by coordinates such as xxx, yyy, width, and height.

  106. 106

    What does the minimum-neighbors parameter influence in Haar-cascade detection?

    1. A

      The number of pixels used in a Gaussian kernel

    2. B

      The number of color channels in the source image

    3. C

      The maximum width of the video frame

    4. D

      How many neighboring detections support calling a region a face

    Correct answer
    D

    How many neighboring detections support calling a region a face

    Explanation

    Minimum neighbors specifies how much neighboring detection support is required before a candidate region is accepted as a face.

  107. 107

    What trade-off results from increasing the minimum-neighbors value?

    1. A

      The video frame rate increases while every face is guaranteed to be found

    2. B

      All faces become colored, but no rectangles are drawn

    3. C

      The image becomes larger, but the classifier stops using edges

    4. D

      Fewer false detections may occur, but some real faces may be missed

    Correct answer
    D

    Fewer false detections may occur, but some real faces may be missed

    Explanation

    Increasing minimum neighbors makes detection stricter, which can reduce noise and false positives but may lower sensitivity.

  108. 108

    Why might a Haar cascade detect a stomach or neck as a face?

    1. A

      The grayscale conversion labels all body parts as faces

    2. B

      The classifier recognizes every bright pixel as a face

    3. C

      Haar cascades can be sensitive to image noise and face-like structures

    4. D

      The detection function searches only for circular objects

    Correct answer
    C

    Haar cascades can be sensitive to image noise and face-like structures

    Explanation

    Haar cascades can produce false positives when non-face regions contain structures that resemble the learned face patterns.

  109. 109

    What is the first major step when training the built-in face recognizer?

    1. A

      Collect face image arrays and their corresponding labels

    2. B

      Draw a circle around every pixel

    3. C

      Convert every label into a histogram bin

    4. D

      Delete all images without changing the model

    Correct answer
    A

    Collect face image arrays and their corresponding labels

    Explanation

    The workflow builds a feature list containing face arrays and a label list identifying the person associated with each face.

  110. 110

    Why are person names converted into numerical labels?

    1. A

      The labels determine the camera's resolution

    2. B

      Numerical labels add color information to grayscale faces

    3. C

      Names cannot be stored in any Python data structure

    4. D

      A numerical mapping makes the training representation easier for the model to use

    Correct answer
    D

    A numerical mapping makes the training representation easier for the model to use

    Explanation

    Each person's name is mapped to a numerical index, such as the person's position in the people list, for model training.

  111. 111

    What does the built-in face recognizer's train method use?

    1. A

      Only the Haar cascade XML text

    2. B

      A histogram without any face-image data

    3. C

      The feature arrays and their corresponding numerical labels

    4. D

      Only the filenames of the training images

    Correct answer
    C

    The feature arrays and their corresponding numerical labels

    Explanation

    Training uses the extracted face arrays as features and the associated numerical labels as targets.

  112. 112

    Why is the trained face-recognition model saved to a YAML file?

    1. A

      YAML files automatically improve the model's accuracy

    2. B

      It can be loaded later without repeating the entire training process

    3. C

      YAML files convert face images into RGB format

    4. D

      Saving to YAML removes the need for any training images

    Correct answer
    B

    It can be loaded later without repeating the entire training process

    Explanation

    Saving the trained model allows it to be reused in another program or directory without rebuilding and retraining it.

  113. 113

    What does the face recognizer's predict operation produce?

    1. A

      The original image in a different color space

    2. B

      A predicted numerical label and a confidence-related value

    3. C

      A new training set containing unlabeled images

    4. D

      Only the coordinates of every image contour

    Correct answer
    B

    A predicted numerical label and a confidence-related value

    Explanation

    The recognizer predicts a label for the face region and returns a confidence-related value.

  114. 114

    Why can the built-in face recognizer produce unreliable predictions in the example?

    1. A

      It was trained only on color histograms rather than faces

    2. B

      It cannot process grayscale images at all

    3. C

      It was trained on a relatively small dataset and is not the most advanced model

    4. D

      It always predicts the first person alphabetically

    Correct answer
    C

    It was trained on a relatively small dataset and is not the most advanced model

    Explanation

    The example uses only about 100100100 training images and the built-in recognizer is less robust than more advanced deep-learning approaches.

  115. 115

    What is a key advantage of a deep-learning model for image classification?

    1. A

      It eliminates the need to resize input images

    2. B

      It guarantees perfect accuracy with ten images

    3. C

      It requires no training data or validation data

    4. D

      It can learn complex visual patterns from large training datasets

    Correct answer
    D

    It can learn complex visual patterns from large training datasets

    Explanation

    Deep-learning models are powerful because they can learn complex visual features, especially when trained with substantial data.

  116. 116

    Why is a GPU useful when training a deep computer-vision model?

    1. A

      It converts all images into grayscale without preprocessing

    2. B

      It automatically labels every image correctly

    3. C

      It replaces the need for a neural-network architecture

    4. D

      It can accelerate the computationally intensive training process

    Correct answer
    D

    It can accelerate the computationally intensive training process

    Explanation

    A GPU, or graphical processing unit, can significantly speed up neural-network training computations.

  117. 117

    Why must images in a dataset generally be resized before entering a neural network?

    1. A

      Different image sizes automatically prevent grayscale conversion

    2. B

      Resizing changes every image into a binary mask

    3. C

      The model expects inputs with consistent dimensions

    4. D

      Resizing is required to create Haar-cascade XML files

    Correct answer
    C

    The model expects inputs with consistent dimensions

    Explanation

    Neural networks generally require all input images to have the same dimensions, such as 80×8080 \times 8080×80.

  118. 118

    What does setting the image channel count to 111 indicate in the model setup?

    1. A

      The model uses grayscale images

    2. B

      The model has one convolutional layer

    3. C

      The model uses one image per training class

    4. D

      The model detects only one face in every image

    Correct answer
    A

    The model uses grayscale images

    Explanation

    A single image channel indicates grayscale input rather than a three-channel color image.

  119. 119

    Why are the top ten character folders selected in the Simpsons example?

    1. A

      They are the only folders containing grayscale images

    2. B

      They contain only images without any characters

    3. C

      They are selected randomly regardless of image count

    4. D

      They provide the ten classes with the largest numbers of available images

    Correct answer
    D

    They provide the ten classes with the largest numbers of available images

    Explanation

    The workflow counts images in each character folder, sorts the folders by count, and selects the first ten.

  120. 120

    What is the purpose of splitting data into training and validation sets?

    1. A

      The model trains on one portion and evaluates itself on another

    2. B

      The split converts all images into two color channels

    3. C

      The split ensures that every image is used only for visualization

    4. D

      The split removes the need for labels

    Correct answer
    A

    The model trains on one portion and evaluates itself on another

    Explanation

    Training data is used to fit the model, while validation data provides a separate evaluation during training.

  121. 121

    If the validation ratio is 0.20.20.2, how is the dataset divided in the described workflow?

    1. A

      Approximately 80%80\%80% is used for training and 20%20\%20% for validation

    2. B

      Half is used for training and half for validation

    3. C

      All data is used for training and none for validation

    4. D

      Approximately 20%20\%20% is used for training and 80%80\%80% for validation

    Correct answer
    A

    Approximately 80%80\%80% is used for training and 20%20\%20% for validation

    Explanation

    A validation ratio of 0.20.20.2 assigns about 20%20\%20% of the data to validation and the remaining 80%80\%80% to training.

  122. 122

    What does normalization do to the feature values in the described model pipeline?

    1. A

      It scales the feature values into the range from 000 to 111

    2. B

      It changes grayscale images into three-channel images

    3. C

      It converts every feature into a class name

    4. D

      It removes all labels from the training data

    Correct answer
    A

    It scales the feature values into the range from 000 to 111

    Explanation

    The feature arrays are normalized so their values lie in the range [0,1][0,1][0,1], which can help the network learn more effectively.

  123. 123

    What does one-hot encoding do to class labels?

    1. A

      It converts a model into a Haar cascade

    2. B

      It removes the need to specify the number of classes

    3. C

      It converts integer labels into binary class vectors

    4. D

      It converts binary images into color images

    Correct answer
    C

    It converts integer labels into binary class vectors

    Explanation

    One-hot encoding represents each class as a binary vector with one active class position.

  124. 124

    What is the purpose of an image data generator?

    1. A

      To replace validation data with test filenames

    2. B

      To synthesize variations of existing images and introduce training randomness

    3. C

      To calculate only the grayscale histogram

    4. D

      To detect faces without using any trained model

    Correct answer
    B

    To synthesize variations of existing images and introduce training randomness

    Explanation

    An image data generator creates modified variations of existing images, which can improve training by introducing additional variation.

  125. 125

    What does the batch size specify during model training?

    1. A

      The number of classes removed from the dataset

    2. B

      The number of color channels in each image

    3. C

      The number of samples processed together in one training step

    4. D

      The number of validation sets created per image

    Correct answer
    C

    The number of samples processed together in one training step

    Explanation

    The batch size determines how many examples are processed together during each training update.

  126. 126

    What is the purpose of a learning-rate schedule?

    1. A

      To assign names to detected faces

    2. B

      To resize images at fixed spatial intervals

    3. C

      To determine the number of histogram bins

    4. D

      To adjust the learning rate during training

    Correct answer
    D

    To adjust the learning rate during training

    Explanation

    A learning-rate schedule changes the learning rate at selected stages to support model optimization.

  127. 127

    Why is a separate preparation function used before classifying a new image?

    1. A

      It converts the trained model back into a YAML file

    2. B

      It removes the need to use OpenCV for reading the image

    3. C

      It ensures the new image has the same grayscale, size, and shape format as training inputs

    4. D

      It guarantees that the model will predict the correct class

    Correct answer
    C

    It ensures the new image has the same grayscale, size, and shape format as training inputs

    Explanation

    The preparation function converts the image to grayscale, resizes it, and reshapes it to match the format used during training.

  128. 128

    Why can a model with a stated accuracy near 70%70\%70% still make visibly incorrect predictions?

    1. A

      Accuracy values below 100%100\%100% mean the model cannot make predictions

    2. B

      Accuracy summarizes performance overall and does not guarantee correctness on every image

    3. C

      A validation accuracy of 70%70\%70% means exactly 70%70\%70% of every image is correct

    4. D

      A model's accuracy applies only to image dimensions, not classifications

    Correct answer
    B

    Accuracy summarizes performance overall and does not guarantee correctness on every image

    Explanation

    Overall accuracy is an aggregate metric; individual predictions may still be wrong even when the model performs reasonably on average.

Question 1 of 128
Question 1 of 128

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent