Skip to main content
emobility.academy
B.Tech / BEParking & path planningIntermediate About 5 weeksADAS & AUTOSAR

Rear-View Camera with Dynamic Parking Guidelines

Build a rear-view camera system in Python and OpenCV that calibrates the camera, corrects lens distortion and overlays static distance lines and dynamic trajectory guidelines that bend with the steering angle, with accuracy checked against floor markings.

Tools: Python · OpenCV

Rear-View Camera with Dynamic Parking Guidelines: Students using a diagnostic scan tool on an electric car at DIYguru
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Reversing collisions with pedestrians, posts and other cars are common in car parks, and rear cameras with guidelines are now widely fitted. Correct guidelines need camera calibration, a ground-plane model and the vehicle's turning geometry; poorly calibrated lines mislead drivers. This project builds the whole chain and measures overlay accuracy.

Objectives

  • Calibrate a wide-angle camera's intrinsics and distortion.
  • Estimate the camera's pose relative to the ground plane.
  • Draw static distance markers and dynamic guidelines from a steering input.
  • Measure overlay accuracy against known floor positions.

What you need

Tools and toolboxes

  • Python — Calibration, overlay rendering and evaluation scripts.
  • OpenCV — calibrateCamera or the fisheye module for distortion, solvePnP for ground pose, projectPoints for drawing guidelines.
  • NumPy — Vehicle kinematic arcs and coordinate transforms.
  • MATLAB Computer Vision Toolbox (optional) — Camera Calibrator app as a cross-check of intrinsics.

Software

  • Python 3 with OpenCV and NumPy
  • MATLAB with Computer Vision Toolbox (optional)

Extra parts and data

  • Wide-angle USB camera — Stands in for the rear camera; a fisheye-style lens represents production rear cameras.
  • Printed checkerboard and floor tape or chalk markers — Needed for calibration and for measuring overlay accuracy at known distances.

Key concepts

Intrinsic calibration
Finding focal length, principal point and lens distortion from images of a known pattern, so pixels can be related to rays in space.
Ground-plane homography
A mapping between floor coordinates and image pixels, valid for points on the floor, found from the camera's pose.
Dynamic guidelines
Lines that show the path the rear wheels will trace for the current steering angle, computed from the turning radius about the rear axle's centre.

Step-by-step guide

  1. 1

    Define requirements

    Specify the display: static lines at 0.5, 1, 2 and 3 m behind the bumper, vehicle-width lines, and dynamic lines for steering angles across the full range. Set an accuracy target, for example overlay position error below 5 cm at 1 m and 10 cm at 3 m. Choose vehicle parameters: width, wheelbase, rear overhang and maximum steering angle. Note that a potentiometer or slider will stand in for the steering angle sensor.

    Checkpoint: A requirements list with distances, accuracy targets and vehicle parameters.

  2. 2

    Calibrate the camera

    Capture 20 to 30 images of a checkerboard at different positions, angles and distances, covering the image corners where distortion is strongest. For wide lenses use cv2.fisheye.calibrate, otherwise cv2.calibrateCamera. Check the reprojection error and visually check undistorted images: straight lines in the scene should look straight. Save the intrinsics and distortion coefficients. Keep the checkerboard flat on a rigid board, and repeat the calibration with a fresh image set to check that the intrinsics are stable.

    Checkpoint: Reprojection error below about half a pixel and straight lines in undistorted images.

  3. 3

    Mount the camera and find its pose

    Mount the camera on a cart, trolley or table edge at a height and downward tilt similar to a rear camera, and define the vehicle frame at the bumper centre on the floor. Place markers on the floor at measured positions and click their pixel locations. Solve for the camera pose with cv2.solvePnP using these correspondences. Check by reprojecting the markers and measuring pixel errors.

    Checkpoint: Reprojected floor markers within a few pixels of their true image positions.

  4. 4

    Draw static guidelines

    Define 3D points on the floor for distance lines and vehicle-width lines, project them into the image with cv2.projectPoints using the pose and intrinsics, and draw them on the live video with colour coding (red near, yellow middle, green far). Decide whether to draw on the distorted image (projecting with distortion) or on an undistorted view, and justify the choice.

    Checkpoint: Static lines visually aligned with tape lines placed at the same distances.

  5. 5

    Compute dynamic guidelines

    For a given steering angle, compute the turning radius about the rear axle from the wheelbase, then the arcs traced by the left and right rear corners while reversing up to 3 m. Sample points along each arc on the floor plane and project them into the image. Read the steering angle from a slider or keyboard and update the arcs each frame. Handle straight steering as a special case.

    Checkpoint: Arcs that bend smoothly with the steering input and match a hand-calculated arc for one angle.

  6. 6

    Measure accuracy

    Lay floor tape along the predicted arc for several steering angles using a string-and-pivot method from the computed turning centre, and place distance markers. Compare the projected overlay with the tape in the image, converting pixel errors into floor distance using the homography. Repeat after remounting the camera to see how sensitive the result is to pose changes. Measure tape positions with a steel rule so the reference is trustworthy.

    Checkpoint: A table of overlay errors at each distance and steering angle.

  7. 7

    Improve robustness and latency

    Measure frame rate and end-to-end latency on your laptop and, optionally, on a Raspberry Pi. Precompute projections for a set of steering angles to reduce per-frame cost. Add a check that warns when the camera pose has drifted, for example by checking a fixed reference marker. Record the effect of each change. Measure latency by filming a timer shown on a screen together with its displayed camera image, and repeat with the overlay on and off.

    Checkpoint: Measured frame rate and latency with and without precomputation.

  8. 8

    Report

    Document calibration, pose estimation, guideline geometry, accuracy results and performance. Explain sources of error: calibration, pose, uneven floors and the vehicle model. Show screenshots at several steering angles. State the system is a bench demonstration and that a production system would need validated calibration procedures in the factory. Include the calibration parameters, camera mounting height and tilt, and the vehicle geometry used, so the overlay can be reproduced on another set-up.

    Checkpoint: A report with accuracy tables and annotated screenshots.

Testing & validation

  • Calibration reprojection error.
  • Overlay floor-position error at each distance and steering angle.
  • Sensitivity of overlay error to camera pose changes.
  • Frame rate and latency.

Expected results

A calibrated rear-view camera overlay with static and steering-dependent guidelines, with measured positional accuracy at set distances and angles.

Take it further

  • Add obstacle detection behind the car and highlight the guideline segment it blocks.
  • Produce a top-down surround-style view from the rear camera.
  • Read steering angle from a CAN message via a USB-CAN adapter.

Viva and review questions

Why do guidelines only work on a flat floor?

The projection assumes all guideline points lie on the ground plane; slopes or kerbs change the real geometry and the lines no longer match.

Why calibrate distortion for a rear camera?

Wide lenses bend straight lines strongly near the edges, so without distortion correction projected guidelines would be misplaced.

How is the turning radius found from the steering angle?

With the kinematic bicycle model the rear axle centre turns on a radius equal to wheelbase divided by the tangent of the steering angle.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 ADAS & AUTOSAR projects