Detecting Cars in a Video of Traffic This example shows how to detect cars in a video of traffic. You can use Image Processing Toolbox™ to visualize and analyze videos or image sequences. This example uses VideoReader (MATLAB®), implay, and other Image Processing Toolbox functions to detect light-colored cars in a video of traffic. Note that VideoReader has platform-specific capabilities and may not be able to read the supplied Motion JPEG2000 video on some platforms. Step 1: Access Video with VideoReader The VideoReader function constructs a multimedia reader object that can read video data from a multimedia file. See the documentation for VideoReader for information on which formats are supported on your platform. Use VideoReader to access the video and get basic information about it. trafficVid = VideoReader('traffic.mj2') trafficVid = VideoReader with properties: General Properties: Name: 'traffic.mj2' Path: '/mathworks/devel/bat/BR2016ad/build/matlab/toolbox/imag...' Duration: 8 CurrentTime: 0 Tag: '' UserData: [ ] Video Properties: Width: 160 Height: 120 FrameRate: 15 BitsPerPixel: 24 VideoFormat: 'RGB24' The get method provides more information on the video such as its duration in seconds. get(trafficVid) obj = VideoReader with properties: General Properties: Name: 'traffic.mj2' Path: '/mathworks/devel/bat/BR2016ad/build/matlab/toolbox/imag...' Duration: 8 CurrentTime: 0 Tag: '' UserData: [ ] Video Properties: Width: 160 Height: 120 FrameRate: 15 BitsPerPixel: 24 VideoFormat: 'RGB24'