Skip to main content
emobility.academy
M.TechCamera perceptionAdvanced About 8 weeksADAS & AUTOSAR

Camera Calibration and Bird's-Eye-View Transform for Lane and Parking Perception

Calibrate a camera's intrinsics and extrinsics in MATLAB and OpenCV, build a metric bird's-eye-view transform of the road and use it for lane and parking-slot measurement. BEV accuracy is checked against surveyed floor markings and its sensitivity to pitch and height errors is quantified.

Tools: MATLAB · Computer Vision Toolbox · OpenCV

Camera Calibration and Bird's-Eye-View Transform for Lane and Parking Perception: Students working on simulation software in the DIYguru computer lab
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Lane keeping, parking assistance and surround view need measurements in metres on the road plane, not pixels. A bird's-eye-view transform provides that, but only if intrinsics, mounting height and orientation are accurate and the road is flat. Errors in any of these distort the BEV and the downstream measurements built on it.

Objectives

  • Calibrate intrinsics and lens distortion with a checkerboard.
  • Estimate extrinsics (height, pitch, yaw, roll) from a ground-plane target.
  • Build an inverse perspective mapping to a metric BEV image.
  • Measure lane width, lateral offset and parking-slot geometry in the BEV.
  • Quantify BEV error and its sensitivity to extrinsic errors.

What you need

Tools and toolboxes

  • MATLAB — Analysis, scripting and comparison plots.
  • Computer Vision Toolbox — Camera Calibrator app, estimateExtrinsics and undistortion.
  • Automated Driving Toolbox — monoCamera and birdsEyeView objects for road-plane transforms.
  • OpenCV — Independent implementation of calibration and warpPerspective for comparison.
  • Python — OpenCV scripts and evaluation.

Software

  • MATLAB with Computer Vision Toolbox and Automated Driving Toolbox
  • Python 3 with OpenCV and NumPy
  • A tape measure and a recorded survey sheet of marking positions

Extra parts and data

  • Webcam or action camera with a rigid mount — A fixed, repeatable mounting is needed so calibrated extrinsics remain valid.
  • Printed checkerboard and floor tape or chalk markings — The checkerboard calibrates intrinsics; measured markings on a flat floor or closed car park give ground truth for the BEV.

Key concepts

Intrinsics and distortion
Focal lengths, principal point and radial and tangential distortion coefficients that describe the camera itself, independent of where it is mounted.
Extrinsics
The rotation and translation from the vehicle or ground frame to the camera: mounting height and pitch, yaw and roll angles.
Inverse perspective mapping
A homography that maps the road plane from the camera image to a top-down metric grid, valid only for points on that plane.
Flat-world assumption
IPM assumes all mapped points lie on one plane. Objects above the road, such as vehicles, appear stretched and slopes cause scale errors.

Step-by-step guide

  1. 1

    Define requirements and the vehicle frame

    Define what the BEV must deliver: for example a top-down image covering 3 to 25 m ahead and ±5 m sideways at 2 cm per pixel, with position error below a stated value within 15 m. Define the vehicle coordinate frame (origin, axes) following the convention used by Automated Driving Toolbox. Choose a flat test area such as a lab floor or a closed car park with permission.

    Checkpoint: A requirements note with BEV range, resolution, accuracy targets and a sketch of the frames.

  2. 2

    Calibrate intrinsics

    Capture 20 to 30 checkerboard images covering the whole field of view, including corners where distortion is strongest. Run the Camera Calibrator app in MATLAB with two radial coefficients (three for a wide lens) and tangential distortion, and remove images with high reprojection error. Repeat the calibration in OpenCV with cv2.calibrateCamera on the same images and compare focal lengths and distortion coefficients.

    Checkpoint: Mean reprojection error below about half a pixel and matching intrinsics from both tools.

  3. 3

    Mount the camera and survey ground points

    Fix the camera rigidly at a measured height, roughly windscreen height, looking forward with slight downward pitch. Lay out a grid of tape marks or a large checkerboard on the floor and measure each point's position in the vehicle frame with a tape measure. Record these ground-truth coordinates in a table. Keep some marks for validation only, not for estimating extrinsics.

    Checkpoint: A survey table of ground-point coordinates, split into estimation and validation points.

  4. 4

    Estimate extrinsics

    Detect the ground pattern in an undistorted image and use estimateExtrinsics in MATLAB (or cv2.solvePnP in OpenCV) with the estimation points to obtain camera rotation and translation. Convert to height, pitch, yaw and roll and compare height with the tape-measured value. Create a monoCamera object with the intrinsics, height and pitch, and check that imageToVehicle returns correct coordinates for the estimation points.

    Checkpoint: Estimated height within a few centimetres of measured and low reprojection error on ground points.

  5. 5

    Build the bird's-eye view

    Create a birdsEyeView object with the output area and image size from the requirements and transform the camera image. In OpenCV, compute a homography from four or more ground correspondences with cv2.findHomography and warp with cv2.warpPerspective to the same metric grid. Overlay a metre grid on both BEV images and inspect straight lines and right angles on the floor pattern.

    Checkpoint: BEV images from MATLAB and OpenCV in which floor lines appear straight and parallel with the grid aligned.

  6. 6

    Measure BEV accuracy

    Locate each validation mark in the BEV image, convert to metres and compute the position error against the survey. Plot error against distance from the camera. Repeat for three or four camera poses to check repeatability. Compare MATLAB and OpenCV pipelines on the same images to separate implementation differences from calibration error. Separate the error into longitudinal and lateral components, because lateral error matters most for lane keeping while longitudinal error matters more for parking depth. State whether errors grow linearly or faster with distance.

    Checkpoint: An error-versus-distance plot for validation points that meets or explains the accuracy target.

  7. 7

    Quantify sensitivity to extrinsic errors

    Perturb pitch by ±0.5 and ±1 degree, height by ±2 and ±5 cm and roll by ±0.5 degree in the transform, and recompute validation point errors. Plot error growth against perturbation and distance. This shows why vehicle pitch from braking or loading matters. Optionally record the camera while pitching the mount slightly to see the effect in real images. Express each sensitivity as centimetres of error per degree or per centimetre of perturbation at fixed distances such as 5, 10 and 20 m.

    Checkpoint: Sensitivity plots showing how each extrinsic error grows with distance.

  8. 8

    Apply BEV to lanes and parking slots

    Mark lane lines and a parking slot outline on the floor, or use recorded footage from a closed car park, and detect them in the BEV with thresholding and line fitting (Hough or RANSAC). Compute lane width, lateral offset of the camera from lane centre and slot width, depth and orientation in metres, then compare with tape measurements. Show how a vehicle in the image is stretched by the flat-world assumption.

    Checkpoint: Lane and slot measurements in metres compared with tape-measured values.

  9. 9

    Analyse and recommend

    Combine the results into recommendations: which calibration errors dominate at which distances, how often extrinsics should be re-estimated, and when online pitch estimation from lane vanishing points would be required. Compare the effort and accuracy of the MATLAB and OpenCV workflows. Discuss the flat-world limit for ramps and kerbs and how multi-camera surround view extends the method. Turn the findings into a short calibration procedure that another student could follow with the same camera and mount.

    Checkpoint: A written recommendation backed by the error and sensitivity results.

  10. 10

    Write the thesis chapter

    Present the camera model, calibration procedure, extrinsic estimation, BEV construction, accuracy and sensitivity results and the lane and parking applications. Include photographs of the setup, the survey table and all scripts. State the limitations: one camera, a flat test surface and static poses. Present a clear error budget that a reader could use to specify a calibration process. Add a short section comparing your measured error with the requirement set in the first step and explain any shortfall.

    Checkpoint: A chapter with an error budget and reproducible calibration scripts.

Testing & validation

  • Intrinsic reprojection error from both tools.
  • BEV position error against surveyed validation points by distance.
  • Sensitivity of BEV error to pitch, height and roll perturbations.
  • Lane width and parking slot dimensions against tape measurements.

Expected results

A calibrated monocular camera with a metric bird's-eye view, measured accuracy against surveyed points, an extrinsic error budget and working lane and parking measurements.

Research angle for your M.Tech thesis

Research questions: how do calibration and mounting errors propagate into metric BEV error, and how much can online extrinsic refinement recover? Metrics: position error by distance, lane width and slot dimension error, sensitivity coefficients. Baselines: static calibration with MATLAB and OpenCV. A clear error budget validated against surveyed points, followed by an online pitch-estimation method that measurably reduces error under perturbation, is a solid basis for a conference paper.

Take it further

  • Estimate pitch online from lane vanishing points and compare accuracy.
  • Stitch two or four cameras into a surround-view BEV.
  • Use the BEV in a parking-slot detector on recorded car-park video.
  • Calibrate a fisheye lens with the fisheye model and compare.

Viva and review questions

Why is the BEV only valid for points on the road plane?

The homography maps one plane; anything above it, such as a car body, is projected as if it lay on the road and appears stretched away from the camera.

Why do pitch errors matter more at long range?

Distant road points lie close to the horizon in the image, so a small angular error moves their mapped position by a large distance.

What is the difference between intrinsics and extrinsics?

Intrinsics describe the camera's optics and sensor; extrinsics describe where and at what angle it is mounted relative to the vehicle or ground.

Why keep separate validation ground points?

Points used to estimate extrinsics will fit well by construction; independent points show the true accuracy of the transform.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 ADAS & AUTOSAR projects