readyforhires

Computer Vision test (Intermediate)

30 questions · 35 minutes · Free

Image processing with OpenCV and deep vision models.

Take the Computer Vision test

What it covers

Interview format

Sample questions

5 sample questions from the Computer Vision test, with the answers. Samples are taken out of the live test, so you will not meet these when you sit it.

  1. You are working on a project where you load an image using OpenCV and want to display it using matplotlib. What is the correct step to ensure the image is displayed with accurate color representation?

    1. Use `cv2.cvtColor(img, cv2.COLOR_RGB2BGR)` before displaying with matplotlib.
    2. Use `cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)` to convert to grayscale.
    3. Use `cv2.cvtColor(img, cv2.COLOR_BGR2RGB)` before displaying with matplotlib.
    4. Use `cv2.add(img, np.array([100, 100, 100]))` to adjust brightness.

    Answer: C. Use `cv2.cvtColor(img, cv2.COLOR_BGR2RGB)` before displaying with matplotlib.

    OpenCV loads images in BGR format, but matplotlib displays them in RGB format. To ensure correct color representation, it is necessary to convert the image from BGR to RGB before displaying it with matplotlib.

  2. Which OpenCV function and parameter combination is best suited for performing an affine transformation to rotate an image by a specific angle?

    1. cv2.warpAffine with a rotation matrix
    2. cv2.flip with a flip code
    3. cv2.warpPerspective with a homography matrix
    4. cv2.resize with scaling factors

    Answer: A. cv2.warpAffine with a rotation matrix

    cv2.warpAffine with a rotation matrix is the correct choice for performing an affine transformation to rotate an image. cv2.resize is for resizing, cv2.flip is for flipping, and cv2.warpPerspective is for perspective transformations, not affine.

  3. In OpenCV's Hough transform for line detection, how is the angle (theta) of the line represented?

    1. The Hough transform uses degrees for theta, ranging from 0 to 360.
    2. The Hough transform uses a fixed theta value for all lines detected.
    3. The Hough transform accumulates votes in polar coordinates (rho, theta), where theta represents the angle of the line relative to the x-axis, and it is typically measured in radians between 0 and π.
    4. The Hough transform only detects lines with angles between 0 and π/2 radians.

    Answer: C. The Hough transform accumulates votes in polar coordinates (rho, theta), where theta represents the angle of the line relative to the x-axis, and it is typically measured in radians between 0 and π.

    The Hough transform for line detection maps edge points in the Cartesian coordinate system to curves in the polar coordinate system (rho, theta). Theta represents the angle of the line, and it is defined between 0 and π radians. This range ensures that all possible lines are covered without redundancy, as angles beyond π would repeat the same lines. The other options either describe incorrect ranges for theta or misrepresent how the Hough transform accumulates votes.

  4. Which of the following statements accurately describes how OpenCV's contour detection algorithm works internally?

    1. OpenCV's contour detection uses the Hough Transform algorithm.
    2. OpenCV's contour detection is purely based on pixel intensity thresholding.
    3. Contour detection in OpenCV is based on the Fast Fourier Transform (FFT).
    4. The contour detection algorithm in OpenCV uses the Marching Squares algorithm internally.

    Answer: D. The contour detection algorithm in OpenCV uses the Marching Squares algorithm internally.

    OpenCV's contour detection function, cv2.findContours(), internally uses the Marching Squares algorithm to detect contours in binary images. The algorithm works by analyzing the gradient of pixel intensities and identifying edges. Other options are incorrect because they either describe unrelated algorithms or misrepresent how OpenCV's contour detection functions work.

  5. In a realistic project scenario, how is the angle parameter in OpenCV's Hough transform for line detection typically used?

    1. The angle parameter in the Hough transform is used to adjust the brightness of the image before line detection.
    2. The Hough transform is applied to detect straight lines in the image, and the angle parameter determines the range of angles considered for line detection.
    3. The angle parameter in the Hough transform is used to define the number of lines that can be detected in an image.
    4. The angle parameter in the Hough transform is used to determine the color space conversion for line detection.

    Answer: B. The Hough transform is applied to detect straight lines in the image, and the angle parameter determines the range of angles considered for line detection.

    The Hough transform for line detection uses an angle parameter that defines the range of angles (in degrees) for which lines are detected. This is essential for real-world applications where lines may be oriented in specific directions. The other options are either incorrect or not directly related to the Hough transform's angle behavior.

Frequently asked questions

How many questions are in the Computer Vision test?
30 questions (18 multiple choice, 9 multi-answer, 3 predict-the-output), with 35 minutes to answer them.
What does the Computer Vision test cover?
OpenCV image operations, CNN architectures (ResNet, EfficientNet), Object detection with YOLO, Image segmentation, Data augmentation.
Is the Computer Vision test free?
Yes. It is free to take with a readyforhires account.
What level is the Computer Vision test?
Intermediate, in AI & ML.

More AI & ML tests

Roles that test these skills

Companies that test these skills

All practice tests · All AI & ML tests

Last updated