-
Notifications
You must be signed in to change notification settings - Fork 8
Retrieving Camera Data
Data retrieval programs can be used by users to retrieve data from camera(s). This retrieved data can be in several available formats which can be requested by the user. The data retrieved by using these programs can be used in applications such as image analysis, etc. Multiple programs are currently used to retrieve data from given camera(s) and store it in certain formats. These singleton programs are namely: archiver.py, archiver_url.py and StreamDownloader.py. Combining these programs into a wrapper would allow ease of access to the user.
Creating a wrapper function to encapsulate these singleton programs would make data retrieval much more easier for the end user. This would also provide all the functionalities that the individual functions would provide. This single merging program would handle all required inputs and stores output according to user’s choice. This wrapper function would be able to handle any type input given by the user and use a suitable data retrieval program.
The user provides an input CSV file with information pertaining to respective input columns predefined by the usage of the wrapper program. The CSV file should be in the same directory as the wrapper and if it is not present, the program would provide an option to the user to create this file. The column data of this CSV file would allow the wrapper function to choose the necessary data retrieval program for any given operation, thus providing ease of use. Refer to the description header of each data retrieval program to understand the functionality of each program.
It reads the excel file and checks required output type. If it is a video it reads the columns corresponding to StreamDownloader’s requirements and passes them to the function. If this process cannot be completed or camera does not support video, appropriate error messages are displayed.
If the output type is an image it looks for camera id to check whether it is in the CAM2 database. If it is present in the database it retrieves information using archiver.py and uses the CAM2 database. It passes required inputs for the program from the excel file and reports an errors along the way. If the camera is not in the database, it checks the url field of the the excel file and passes the required information to archiver_url.py.
If all the inputs and required information are obtained then the program asks the user for confirmation to proceed and the output file name. It then begins data collection and stores data in the required output folder providing feedback to the user at regular intervals if required.
Required information for each file:
archiver.py : python archiver.py "camera_id" "is_video" "duration" "interval"
Sr no: | Input Argument | Description |
---|---|---|
1. | camera_id | is the camera ID in the database. |
2. | is_video | is 1 for a MJPEG stream, 0 for a JPEG stream. |
3. | duration | is the archiving duration in seconds. |
4. | interval | is the interval between two frames in seconds (or 0 for the maximum frame rate possible). |
archiver_url.py: python archiver.py "input_file" "duration" "interval"
Sr no: | Input Argument | Description |
---|---|---|
1. | input_file | is the path to the two-column space-separated input file. The first column is the integer camera ID, and the second column is the camera URL. |
2. | duration | is the archiving duration in seconds. |
3. | interval | is the interval between two frames in seconds (or 0 for the maximum frame rate possible). |
StreamDownloader.py: python StreamDownloader.py "url" "filename" "runtime (secs)" "fps"
Sr no: | Input Argument | Description |
---|---|---|
1. | url | A link to a camera stream |
2. | filename | an output filename without extension |
3. | runtime (secs) | a desired runtime |
4. | fps | the desired output frames per second. |
Functions are called from the Wrapper function corresponding to the information from the column fields in the CSV file. The wrapper function calls the functions based on the below cases:
i) Column A, B, C, D – Use archiver.py
ii) Column E, F, C, D – Use archiver_url.py
iii) Column F, G, H, I – Use StreamDownloader.py
There are three ways to fill in the CSV file to retrieve the information needed. Use the program as per your requirements.
To download images from a particular camera in the CAM2 database fill in the following columns and leave everything else blank.
Column: | Input Argument | Description |
---|---|---|
A. | camera_id | is the camera ID in the database. |
B. | is_video | is 1 for a MJPEG stream, 0 for a JPEG stream. |
C. | duration | is the archiving duration in seconds. |
D. | interval | is the interval between two frames in seconds (or 0 for the maximum frame rate possible). |
To download images from a given URL(s) fill in the following columns and leave everything else blank. Note: Multiple Camera IDs and Camera URLs can be given to download from multiple cameras at once. (Dependency: This uses the Python Imaging Library)
Column: | Input Argument | Description |
---|---|---|
E. | StoreCAM_ID | Integer Camera ID(s) is the name with which it is saved in a directory. |
F. | camera URL | URL(s) of the camera |
C. | duration | is the archiving duration in seconds. |
D. | interval | is the interval between two frames in seconds (or 0 for the maximum frame rate possible). |
To download video in .AVI format and also store individual frames fill in the following columns and leave everything else blank. (Dependency: This uses ffmpeg)
Column: | Input Argument | Description |
---|---|---|
F. | url | A link to a camera stream |
G. | filename | an output filename without extension |
H. | runtime (secs) | a desired runtime |
I. | fps | the desired output frames per second. |
©️ 2016 Cam2 Research Group