Book a free call

Computer Vision for Obstacle Detection: How Machines Spot Hazards

Computer vision for obstacle detection lets machines see what stands in their way and stop or steer around it. Here is how the system works and where it is used.

Hertiv engineering teamReviewed by a senior engineer
6 min read
Computer Vision for Obstacle Detection: How Machines Spot Hazards
On this page

Short answer

Computer vision for obstacle detection is the use of cameras and software to find objects in a machine's path, measure how far away they are, and decide whether to stop, slow down or steer around them. It turns raw video into a live map of what is ahead, so a robot, vehicle or drone can move without hitting people, walls or equipment.

What is computer vision for obstacle detection?

Computer vision for obstacle detection is a system that watches the space in front of a machine, finds the objects in it, and works out which ones block the way. A camera feeds video to software that spots shapes, estimates their distance, and raises a warning or a stop command when something is too close.

The idea is simple: a machine that moves should know what is in front of it before it arrives. A warehouse robot, a delivery drone and a driver-assistance system all need the same answer, which is whether the path ahead is clear. Object detection is the core skill behind it, because the system must first recognise that something is there before it can judge the risk.

Obstacle detection is not the same as mapping a whole room. It cares about one question at a time: is there something in the way, and how close is it? That narrow focus is what makes it fast enough to run while a machine is moving.

How does an obstacle detection system work?

An obstacle detection system runs four jobs in a loop, many times per second. First it captures an image, then it finds the objects in that image, then it estimates how far away each object is, and finally it decides what the machine should do.

StepWhat happensWhat it produces
CaptureCameras take frames of the scene aheadRaw images, 10 to 30 per second
DetectSoftware finds objects and draws boxes around themA list of objects with positions
MeasureDepth sensing or motion gives the distance to each objectDistance in metres for each object
DecideRules compare distance and speed with safe limitsSlow down, stop or steer

The loop repeats constantly, so the machine always works from a fresh picture of the scene. If the camera misses a frame, the system uses the last good one and slows down rather than guessing. That habit, of slowing down when unsure, is what keeps people safe around moving machines.

Which sensors feed obstacle detection?

Most systems combine more than one sensor, because each type fails in a different way. A camera sees shape and colour but struggles in darkness. A depth sensor measures distance well but has a short range. Radar works in rain and fog but sees less detail.

Teams usually start with a normal camera, since it is cheap and the software for it is mature. Then they add a second sensor for the cases the camera cannot handle. A warehouse robot might add an ultrasonic sensor for close objects, while a road vehicle adds radar for bad weather.

  • Cameras. Cheap, detailed, and good at recognising what an object is.
  • Depth cameras. Measure distance directly, useful indoors at short range.
  • Lidar. Builds a precise 3D map, but costs more and needs care in rain.
  • Radar. Works in fog and rain, but with less detail than a camera.
  • Ultrasonic. Cheap and reliable for objects very close to the machine.

Using two sensor types together is called sensor fusion. When the camera and the radar agree, the system trusts the result. When they disagree, it slows down and treats the nearer reading as true.

Where is obstacle detection used?

Obstacle detection shows up wherever a machine moves on its own or helps a person move. Warehouse robots use it to avoid workers and shelving. Delivery robots use it to stop for pedestrians on a pavement. Drones use it to avoid trees, wires and buildings.

Road vehicles use it in driver-assistance features such as automatic emergency braking. The camera watches the road ahead, and when a car or pedestrian appears too close, the system warns the driver or brakes on its own. Vehicle detection covers the road side of this in more detail.

Factories also use fixed cameras for safety. Computer vision for safety watches work zones and stops a machine when a person steps into a dangerous area. The same detection idea applies, but the camera stays still and the people move.

How do teams test obstacle detection?

Testing matters more than the model itself, because a missed obstacle can hurt someone. Teams test in stages, starting safe and getting closer to real conditions only when each stage passes.

  1. Record real scenes. Film the actual routes, at the times of day and in the weather the machine will face.
  2. Label the obstacles. Mark every object that should be detected, including small and partly hidden ones.
  3. Measure misses, not just hits. Count how often the system fails to see an obstacle, since a miss is the dangerous error.
  4. Test at low speed. Run the machine slowly with a person watching, and stop it by hand if needed.
  5. Test the failures. Cover a camera, dim the lights, and add rain or dust to see how the system reacts.
  6. Log every stop. Keep a record of each warning so the team can find patterns and fix the weak spots.

A team should also test what happens when the system is unsure. The right answer is almost always to slow down and ask for help, not to keep going at full speed.

Example (hypothetical): a warehouse robot

Example (hypothetical): a warehouse runs 20 robots that carry boxes along marked lanes. Each robot moves at 1 metre per second and its camera checks the lane 15 times per second. A worker steps into a lane 6 metres ahead of a robot.

The camera spots the worker in the first frame, and the depth sensor puts the worker at 6 metres. The robot's rule is to slow down at 4 metres and stop at 2 metres. At 1 metre per second it covers the first 2 metres in 2 seconds, then slows, and stops with about 1 metre to spare.

Over one shift the robots make 400 trips and the system records 12 stops for people in lanes. Each stop costs about 20 seconds, so the total delay is 4 minutes across the whole shift. That is a small price for keeping the lanes safe, and the log shows the team exactly where people cross most often.

What are the common mistakes?

The most common mistake is testing only in good conditions. A system that works in bright light can fail at dusk, in rain, or when a camera lens is dirty. Teams should test in the worst conditions the machine will face, not the best.

Another mistake is trusting a single sensor. One camera can be blinded by sunlight or blocked by dust. A second sensor type, even a cheap one, catches many of those failures.

A third mistake is ignoring small and partly hidden obstacles. A low box, a cable on the floor, or a person half hidden behind a shelf are exactly the cases that cause accidents. Labelled test data should include them on purpose.

Finally, teams sometimes set the stop distance too short. Braking takes time, and a fast machine needs more room than it feels like. Measure the real stopping distance at full speed, then add a margin, and set the stop rule from that number.

Key takeaways

  • Obstacle detection answers one question: is something in the way, and how close is it?
  • The system runs a loop of capture, detect, measure and decide, many times per second.
  • Combining two sensor types catches failures that one sensor would miss.
  • Test misses, not just hits, and test in the worst conditions the machine will face.
  • When the system is unsure, slowing down is the safe answer.

Frequently asked questions

How fast does obstacle detection need to be?

Fast enough to react before the machine reaches the obstacle. A slow robot can check a few times per second, while a fast vehicle needs many more checks in the same time. The speed of the machine sets the speed of the loop, so faster machines need faster cameras and more computing power.

Is a camera enough on its own?

Often, for slow indoor machines in good light. Outdoors, or at higher speeds, a second sensor such as radar or depth sensing covers the cases where a camera struggles, such as darkness, rain or glare from low sun.

What is the difference from object detection?

Object detection finds and names things in an image. Obstacle detection adds distance and a decision about whether the object blocks the path, then tells the machine to slow down, stop or steer around it.

Can obstacle detection work in the dark?

Yes, with the right sensors. Infrared cameras and radar work without visible light, while normal cameras need extra lighting to see anything. The choice depends on where the machine runs and how fast it moves.

How much does an obstacle detection system cost?

It varies widely with the sensors and the machine. A single camera and a small computer suit a slow indoor robot, while a road vehicle needs several sensors and more computing power. See vendor sites for current prices before budgeting.

Do I need a lot of training data?

You need labelled video from the real routes, including the hard cases such as small, partly hidden and poorly lit obstacles. A few hundred well-chosen clips beat thousands of easy ones.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Running a machine that moves near people?

A senior engineer replies within one business day. Or see our Computer Vision service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call