File Exchange

image thumbnail

Analyzing Traffic Using a Webcam, a Raspberry Pi and ThingSpeak

version 1.2.0.0 (919 KB) by MathWorks Internet of Things Team
Develop a traffic monitoring algorithm and analyze traffic data sent to ThingSpeak

36 Downloads

Updated 05 Jan 2018

View License

In this IoT project, we use a Raspberry Pi, a web cam and ThingSpeak to analyze traffic on a busy highway. With Simulink we design and deploy a traffic monitoring algorithm to the Raspberry Pi, and we analyze and visualize the traffic patterns using ThingSpeak, an IoT analytics platform, and MATLAB. This article features channel 38629 on ThingSpeak.
For more information about ThingSpeak, see https://www.mathworks.com/products/thingspeak.html

Cite As

MathWorks Internet of Things Team (2020). Analyzing Traffic Using a Webcam, a Raspberry Pi and ThingSpeak (https://www.mathworks.com/matlabcentral/fileexchange/52456-analyzing-traffic-using-a-webcam-a-raspberry-pi-and-thingspeak), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (27)

Sanjib Narzary

Jacobo Sánchez Coba

Onur Dora ÖZTÜRK

nbr

sa babuş

Tarik Dandin

SelamMUUUCCCCCCCCCCCU

popat jadhav

phil phil

raspeberry pi sensehat

Vishnu P Kumar

Shreif Ahmed

Oliver Mörth

Hello, I am using a Raspberry Pi model B and a LifeCam Studio (Microsoft) as the webcam. By increasing the resolution, I can identify more image errors (parts of the image are mixed up and not in the right position) and the counting doesn't work properly. Does anyone please know why this happens and how to solve this problem?

avadhesh verma

ABHI KRISHNA H

charushila raskar

When I run the m file getting following error but graph appears for Traffic Density for the week starting at a particular day.

Error using reshape
Product of known dimensions, 5655, not divisible into total number of elements, 39586.

Error in traffic_analysis_final_updated_old (line 176)
dailymeaneast = mean(reshape(eastTraffic, floor(length(alltrafficData)/7),[]));

charushila raskar

Thanks a lot M.Khan.Its working.

M.Khan

SDL Video Display and FinalOutput are for debugging purpose only. To view these two displays, you need to enable the subsystem 'raspberrypi_viptrafficfd3_Density/Car Density/Enabled Subsystem'. To enable this subsystem, double click on the block 'raspberrypi_viptrafficfd3_Density/Car Density/Debug Flag' and set the Constant Value to 1. Redeploy the generated code and it should display the outputs.

charushila raskar

Thanks for including model. when I run the model on Raspberrypi I am not getting the SDL video display output and the final output..but get the camera output.Please help.

Hans Scharler

Thanks for including the model!

Matthew Zwetolitz

has anyone re-created this model or received the original to run the experiment??

Muhammad Kalifardi

hello sir, can you ad simulink model please?

charushila raskar

how to get the total no of vehicles

Neven Lazarov

You forgot to include the model

vcmorini

Hello,

Where is the simulink model?

Thanks

Omar Madrigal

please add the model

tendres

+1 on looking for the missing model

saeed amindin

the model missing. please add a new file with model for downloading.

Liu Hongxiang

where can I find this model ,I'm very intereted in this project!

Mikhail

It seems that you've forgotten to share the Simulink model used for car detection.

Updates

1.2.0.0

Updated traffic monitoring algorithm and added Simulink model to the submission.

1.1.0.1

Updated description.

1.1.0.1

Updated license

1.1.0.0

Initial release.

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux