Vision · University · about 35 min
Segmentation by threshold, what the threshold is really measuring, and where it fails.
[1 mark]Why does the test r > 150 fail to find a red ball on the nearly white mat, even in a simulator with no lighting model?
[1 mark]Four pixels: white mat, a red ball, the same ball in shadow, and a pale pink wall. What does this print?
pixels = [(230, 225, 220), (200, 40, 30), (120, 30, 25), (240, 200, 180)] bright = sum(1 for (r, g, b) in pixels if r > 150) dominant = sum(1 for (r, g, b) in pixels if r - max(g, b) > 60) chroma = sum(1 for (r, g, b) in pixels if r / (r + g + b + 1) > 0.5) print(bright, dominant, chroma)
[1 mark]In a 64 pixel wide picture from the 320 pixel camera, the red pixels' centroid is at column 40. What is the bearing in degrees to 1 decimal place, using f = 92.4?
[1 mark]In pixel = illumination x reflectance x sensor response, which factor is a property of the object?
[1 mark]Which of these break a colour threshold that worked in the lab?
Tick every answer that is true.
[1 mark]Why is a specular highlight worse for a chromaticity test than a shadow?
A red ball is ahead of the robot. Take a 64 by 48 picture with camera_image(64, 48) and print three things: naive:, the percentage of the picture that passes a plain r > 150 test; red:, how many pixels pass a test that looks at colour rather than brightness; and bearing:, the bearing in degrees of the centroid of those pixels.
from bugbot import * import math connect() F = 92.4 W, H = 64, 48 img = camera_image(W, H)
Plan your program here, then type it in and press Run.
r / (r + g + b), and find the threshold that separates the ball from the mat. How wide is the gap between the two populations?