Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      86 of 114

      How far is it?

      Two cameras stand side by side, baseline metres apart, both looking straight ahead with the same lens f (the pinhole cameras from “Far looks smaller”). The same point lands x_left pixels right of the middle of the left camera’s photo and x_right pixels right of the middle of the right camera’s. Write depth(x_left, x_right, f, baseline): how many metres ahead is the point?

      The avenue from “Far looks smaller”, photographed by two cameras 1 m apart. One photo alone only says which way a tree is, not how far. The two cameras’ lines cross at the tree, and on the photos that shows up as a shift between them. Your depth says how far ahead a point is from where it lands on both photos.

      Two cameras side by side, 1 m apart, photograph the same avenue.from above4 m8 m16 mtwo cameras, 1 m apartthe left camera’s photothe right camera’s photo
      Your functiondepth(x_left, x_right, f, baseline)
      x_leftwhere the point lands on the left camera's photo, in pixels right of its middlee.g. 250
      x_rightwhere it lands on the right camera's photo, in pixels right of its middlee.g. 150
      fboth cameras' focal length (how far the photo is from the pinhole), in pixelse.g. 400
      baselinehow far apart the two cameras are, in metrese.g. 1
      returnshow many metres ahead of the cameras the point is
      solution.pyLoading Python
      Sign in for an AI hint
      ← Far looks smallerDid the box hit? →