Challenge - 5 Problems
Image Drawing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output image after drawing a red line?
Given the following code that draws a red line on a blank image, what will be the color of the pixel at position (50, 50)?
Computer Vision
import numpy as np import cv2 img = np.zeros((100, 100, 3), dtype=np.uint8) cv2.line(img, (0, 0), (99, 99), (0, 0, 255), 2) pixel_color = img[50, 50].tolist() print(pixel_color)
Attempts:
2 left
💡 Hint
Remember OpenCV uses BGR color format, not RGB.
✗ Incorrect
The line is drawn from top-left to bottom-right with color (0,0,255) which is red in BGR. The pixel at (50,50) lies on this line, so its color is red.
❓ Model Choice
intermediate2:00remaining
Which OpenCV function draws a filled rectangle?
You want to draw a filled blue rectangle on an image. Which function and parameter combination is correct?
Attempts:
2 left
💡 Hint
In OpenCV, thickness=-1 fills the shape.
✗ Incorrect
The cv2.rectangle function draws rectangles. Setting thickness=-1 fills the rectangle with the given color.
❓ Hyperparameter
advanced2:00remaining
Choosing thickness for drawing a circle
You want to draw a green circle with a radius of 30 pixels on an image. Which thickness value will draw only the circle's outline with a thickness of 5 pixels?
Attempts:
2 left
💡 Hint
Thickness=-1 fills the circle, positive thickness draws outline.
✗ Incorrect
A positive thickness value draws the outline with that thickness. thickness=5 draws a 5-pixel thick outline.
🔧 Debug
advanced2:00remaining
Why does this text not appear on the image?
Consider this code snippet:
import numpy as np
import cv2
img = np.zeros((100, 200, 3), dtype=np.uint8)
cv2.putText(img, 'Hi', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
Why might the text not be visible when displaying the image?
Computer Vision
import numpy as np import cv2 img = np.zeros((100, 200, 3), dtype=np.uint8) cv2.putText(img, 'Hi', (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2) # Display code omitted
Attempts:
2 left
💡 Hint
Check if the image is actually shown or saved after drawing.
✗ Incorrect
The code draws text on the image correctly, but if the image is not displayed or saved, you won't see the text.
🧠 Conceptual
expert2:00remaining
Why use BGR color format in OpenCV instead of RGB?
OpenCV uses BGR color format by default instead of the more common RGB. What is the main reason for this choice?
Attempts:
2 left
💡 Hint
Think about how images are stored and captured by hardware.
✗ Incorrect
Many cameras and image formats store colors in BGR order, so OpenCV adopted this for efficiency and compatibility.