Drives
Vizzion's Drives sample application illustrates a number of considerations when developing an application that retrieves Drive streams from on-vehicle cameras, including retrieval of a drive in pages, and extracting JPEG images from a M-JPEG video.
Retrieval of a Drive in Pages
The maximum number of images that can be returned in one GET /vehicles/{vehicleId}/streams request is 10 images, corresponding to 10 seconds, but many drives are more than 10 seconds in length. This sample application uses the offset parameter to fetch entire drives in pages of 10 images each.
Extracting JPEG Images from a Stream
The GET /vehicles/{vehicleId}/streams method returns an MJPEG video. This M-JPEG can be viewed in popular browsers and video players by setting the realtime property to True. To view and/or save individual images from the M-JPEG, the binary data of the video must be parsed and converted to JPEG images. The format of an M-JPEG video is:
Response |
---|
... --boundary Content-Type: image/jpeg Content-Length: 271437 EXIF: DateTimeOriginal 2022:07:23 15:33:03 GPSLatitude 43.761971 GPSLongitude 79.392647 GPSSpeed 104 GPSImgDirection 70 --boundary Content-Type: image/jpeg Content-Length: 272192 EXIF: DateTimeOriginal 2022:07:23 15:33:04 GPSLatitude 43.762058 GPSLongitude 79.392311 GPSSpeed 104 GPSImgDirection 71 |
This sample application searches the binary data for "Content-length", reads the specified number of bytes, uses the bytes to construct a JPEG image, and repeats the process until there are no more JPEG images.
Extracting EXIF from Images
Each image contains EXIF tags detailing the time, location, speed and heading of the image. This sample app shows how to extract the DateTimeOriginal tag (0x9003).
Downloads
Download | Details |
---|---|
Source code | Requires Visual Studio 2012 or later |