This Nighttime Forward Collision Warning is an Android app that uses OpenXC and a standard USB webcam to add "night vision" to a car with off-the-shelf parts. The webcam faces forward from the dashboard and uses edge detection to detect objects on the road in the path of the vehicle (i.e. deer). Samantha Skinger developed the first version of this app as a summer intern at Ford in 2012. The application is tuned for rural night driving and doesn't cope well with city lights or daylight.
Disclaimer This application is intended to be used with a display device that has a fixed, preferably permanent location in the vehicle. For example, mounted on the dash. Never mount anything on the dash such that the driver's view is impeded. While the night vision camera application may help increase visibility, the OpenXC platform does not make any claims of a safety benefit.
Hardware
- OpenXC-compatible Android Device (3.2 or later) that can access UVC video devices.
- USB Webcam supporting UVC and a 640x480 resolution in the YUYV format.
- OpenXC Vehicle Interface (VI) with vehicle-specific firmware
- OpenXC-supported vehicle
- USB hub (if you will be using the VI over USB in addition to the camera)
This application was tested with a webcam with the infrared filter removed and with IR illuminators on the front of the car. The visibility was not any greater than with headlights alone, but there may still be a workable passive IR solution that can improve detection distance.
Software
- Install the OpenXC Enabler to the device.
- Run
ndk-build
in theandroid-webcam
project folder to compile the native camera library. - Run
ndk-build
in thenightvision
project folder to compile the native nightvision extensions. - Install the
NightVisionActivity
application to the device. - Start the app once, then restart device to make sure the
VehicleMonitoringService
service is properly registered to begin at bootup and start monitoring the gear position. - Mount the Android device where it will be secure and visible to the driver when backing up, but not in the way of normal driving.
- Mount the USB webcam on dashboard or windshield and plug into the Android device. We recommend using velcro and attaching the camera to the back of the rearview mirror.
- Assuming the VI is attached to the OBD-II port, connect the tablet to it via USB or Bluetooth.
With Maven:
Follow the directions to install the Android Webcam library, then:
$ cd nightvision
$ ndk-build && mvn package android:deploy android:run
The app continuously reads vehicle data from the VI and watches for changes in
headlamp_status
to determine if the nighttime warning should be activated.
When enabled, the feed from the webcam is passed first to an implementation of the Sobel edge detection algorithm. The detection focuses on 50% of the display area around the center, since this is where the horizon of the road will be while driving.
Once the edges are detected, a rudimentary object detection algorithm finds clusters of edges that indicate an object on the road ahead. If an object is detected, it will be highlighted on the display and an alert will sound.
Copyright (c) 2012-2013 Ford Motor Company Licensed under the BSD license.