CAM2 Image Archiver

Copyright 2017 Purdue University

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class CAM2ImageArchiver.CAM2ImageArchiver.CAM2ImageArchiver(num_processes=1, result_path='results/', image_difference_percentage=90)[source]

Bases: object

Retrieves images from cameras specified through a csv file. The csv file either contains the urls of the cameras, or the ID numbers of each camera in the database. image_difference_percentage: Percentage difference between two frames

retrieve_csv(camera_url_file, duration, interval, result_path, remove_after_failure=True)[source]

Retrieves images from cameras specified through a csv file. The csv file either contains the urls of the cameras, or the ID numbers of each camera in the database. Reads camera urls from csv file and archives the images at the requested directory.

archive(camObjects, duration=1, interval=1, result_path=None, remove_after_failure=True)[source]

Archives images from array of cameras. Places directory of all results at the given path.

camObjects

list – A list of cameras dictionary-like object from Client containing camera’s data

duration

int – Duration of parsing images

interval

int – Interval of time in duration to get image. For example, duration=10, interval=2, will generate 5 images

result_path

str – Name of folder where image is saved

remove_after_failure

Boolean – Indicator to decide whether to remove a camera object after parsing failure

Example

Check test cases in test_camera.py

_CAM2ImageArchiver__get_camera_from_object(cam)

Reads converts CAM2 Camera API Camera Object to Archiver Camera Object

cam

dictionary-like object – A camera dictionary-like object most likely instantiated from camera class in CameraDatabaseClient repo

Returns:
Return type:A camera object instantiated from camera class in Archiver repo