The next generation of autonomous cars may be able to take control away from distracted drivers, if they detect the person in the driver's seat isn't safely operating the vehicle.

Engineering researchers at the University of Waterloo are developing algorithms that can work with on board cameras to detect when a driver is distracted — by looking at the position of their head, hands and duration of the movements.

Fakhri Karray, the research chair and director of the Centre for Pattern Analysis and Machine Intelligence at the university, said his team collected photos of thousands of people texting and driving in different conditions to help develop the behaviour recognition system. He worked with PhD candidates Arief Koesdwiady and Chaojie Ou, and postdoctoral fellow Safaa Bedawi for this research.

"We have provided the system also with other abnormal behavior, driving behaviour, and we taught the system to start working and generating classes," Karray told Craig Norris, host of The Morning Edition on CBC Radio.

He said they've separated the behaviours into two classes: normal and abnormal. The abnormal class includes movements such as drinking, eating and reaching behind the seat to get something. The system is able to distinguish between two similar actions like taking a phone call and texting based on the different combinations of head posture and the location of the hand and device.

"The system has provided us upwards of 92 per cent of accuracy and telling us when you are texting and when you are doing the normal driving," Karray said.

Autonomous car takes the wheel 

Karray said there are a number of ways this technology could be used.

"It could be a small gadget that could be commercialized later on," he said. The gadget could include a camera along with a processor that runs the system, and it could alert the driver when they aren't driving with proper care and attention.

A more advanced way of using the technology would be a complete takeover by the self-driving car.

"If there is two, three or four types of alerts, then the car could take over in the next generation of autonomous cars and it could start driving on its own," Karray said.

He said this type of research on driver behaviour recognition and prediction is becoming common among car manufacturers who want to produce cars that can "drive on their own by knowing the context and knowing the driver behaviour."

His team is already in conversation with car manufacturers to implement the technology. However, he said it will take at least three years before people will see the system incorporated into the next generation of autonomous vehicles.