Vision · University · about 30 min
One pixel is one ray. What that buys you, and what it does not.
[1 mark]The BugBot's camera is 320 pixels wide with a 120 degree field of view. What does this print?
import math f = (320 / 2) / math.tan(math.radians(120 / 2)) bearing = math.degrees(math.atan((240 - 160) / f)) print(round(f, 1), round(bearing, 1))
[1 mark]Which line works out the focal length in pixels correctly?
[1 mark]A blob's centre is at column 200. What is its bearing from straight ahead, in degrees to 1 decimal place, using f = 92.4?
[1 mark]The linear guess bearing = (u - 160) x 0.375 degrees is used instead of the pinhole formula. How many degrees wrong is it at column 200? Give 1 decimal place.
[1 mark]Why can a single pixel not tell you where an object is?
[1 mark]Which of these add the second constraint needed to get depth from a camera?
Tick every answer that is true.
[1 mark]A tag is seen at column 220 and the detector reports it 50 cm away. What does this print?
import math F = 92.4 bearing = math.degrees(math.atan((220 - 160) / F)) print(round(bearing, 1), round(50 * math.sin(math.radians(bearing)), 1), round(50 * math.cos(math.radians(bearing)), 1))
Tag 7 is on the mat and the robot is standing still, facing along +y. Print bearing:, the angle from straight ahead to the tag in degrees, and across:, how far to the right of the robot's nose line the tag actually is in centimetres.
from bugbot import *
import math
connect()
F = 92.4
set_cv("apriltag")
wait(0.3)Plan your program here, then type it in and press Run.
cy as well. Given the camera sits 5 cm above the mat, what would the row of a thing standing on the floor tell you, and what would it not? (The simulated tag detector always reports the middle row, 120, so work this one on paper, or try it with a ball and the blob detector, whose cy does move.)