ssoss


Namessoss JSON
Version 0.3.16 PyPI version JSON
download
home_page
SummarySafe Sightings of Signs and Signals Package
upload_time2023-04-09 04:20:49
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords gpx sight distance traffic signals video
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Safe Sightings of Signs and Signals (SSOSS)

SSOSS is a software tool that automates the difficult aspects of verifying if traffic signs and signals are visible or obstructed on a roadway network. This is a 
streamlined and repeatable process to monitor signs and signals along any roadway using a simple input file (.CSV), GPS recorded data file (.GPX) and a synchronized recorded video file.

## Features
* Video Synchronization Helper Tools: Python methods are provided to export the video frames and help to synchronize the video file.
* Automated data processing: The SSOSS scripts uses a combination of GPS and video data to extract images of traffic signals and/or roadway signs.
* Image Labeling and animated GIF image tools: Python functions are included to label images or create an animated GIF from multiple images 

## Requirements
- Python 3.8
- Required libraries: pandas, numpy, opencv-python, geopy, gpxpy, imageio, tqdm, lxml 

## Installation
To install SSOSS, follow these steps:

    python3 -m pip install ssoss

## Usage
To use the SSOSS program, 
1. Setup the necessary input files in A and B. 
2. Follow the data processing commands in Part C. Jupyter Notebook available as example

### A. Input Files
Data related to the static road objects (signs and traffic signals) need to be saved in a CSV file for used in processing.
The intersection CSV file has the following format (as a minimum):

ID, Streetname 1, Streetname 2, Center_Latitude, Center_Longitude, Posted Speed (MPH) of NB Approach, Posted Speed (MPH) of EB Approach, 
Posted Speed (MPH) of SB Approach, Posted Speed (MPH) of WB Approach, NB Approach Compass Heading, EB Approach Compass Heading,
SB Approach Compass Heading, WB Approach Compass Heading

### B. Data Collection
Collect data simultaneously:
1. GPX recording
   a. Use GPX Version 1.0 with logging every second
2. Video Recording
   a. Record at 5 Megapixel resolution or more
   b. Record at 30 frames per second or higher

### C. Data Processing: Argparse Command Line
```Shell
(ssoss_virtual_env) python ssoss_cli.py -h
```

#### Basic Usage
```Shell
(ssoss_virtual_env) python ssoss_cli.py --static_objects signals.csv --gpx_file drive.gpx --video_file vid.mov 
                                        --sync_frame 456 --sync_timestamp 2022-10-24T14:21:54.32Z
```



#### Python Notebook

```python
    import ssoss as ss

signals_csv = "signal"  # .csv is omitted
gpx_file = "drive_1"  # .gpx is omitted

signal_project = ProcessRoadObjects(signals_csv, gpx_file)
sightings = signal_project.intersection_checks()

vid_file = "drive_1.MP4"
video = ss.ProcessVideo(vid_file)
video.sync(200, "2022-10-24T14:21:54.988Z")  # See Sync Process below
video.extract_sightings(sightings, signal_project)
```

At this point, progress bars should load while the images are saved to the output folder.

#### Sync GPX & Video Process
Synchronizing the GPX file and the video could be one of the largest sources of error. The ProcessVideo Class has
a helper function to perform a accurate synchronization time. The extract_frames_between method can export all the 
video frames between two time vales. When looking at the GPX points, the approximate video time can be estimated 
and all the frames can be extracted. This method is:

```Shell
        (ssoss_virtual_env) python ssoss_cli.py -video_file vid.mov --frame_extract_start 4 --frame_extract_end 6
```

Check the printed logs to see the saved output location. Default is:
./out/[video filename]/frames/###.jpg
where ### is the frame number of the image.

Use the frame number and the GPX recorded time to line up the best point to synchronize the video using the Sync method.

## Documentation

### Helper Function: GIF Creator
Create a gif from multiple images around the sight distance location. This can be helpful if the lens is out of focus
at an extracted frame, or just more context before and after a sight distance is needed.

```python
        video.extract_sightings(sightings, signal_project, gen_gif=True)
```
Saves .gif file in ./out/[video filename]/gif/

### Heuristic

For Each GPX Point:
* What are the closest & approaching intersections
  * Based on compass heading of moving vehicle and input data (.csv), which approach leg is vehicle on?
    * What is the approach speed of that approach leg, and look up sight distance for that speed
      * Is the current GPX point greater than that sight distance and the next point is less than the sight distance,
        * If yes, then calculate acceleration between those two points and estimate the time the vehicle 
        traveled over the sight distance.
        * If no, go to next GPX point

From the sight distance timestamp and synchronized video file, the frame is extracted that is closest to that time.

## Contributions
Contributions are welcome to the SSOSS project! If you have an idea for a new feature or have found a bug, please open an issue or submit a pull request.

## License
The SSOSS project is licensed under the MIT License. See LICENSE for more information.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ssoss",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "gpx,sight distance,traffic signals,video",
    "author": "",
    "author_email": "Matt Redmond <mr2742@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/a4/e574ead7202b01474df895e1443db33176ddd19de08c918f47d027e11b35/ssoss-0.3.16.tar.gz",
    "platform": null,
    "description": "# Safe Sightings of Signs and Signals (SSOSS)\n\nSSOSS is a software tool that automates the difficult aspects of verifying if traffic signs and signals are visible or obstructed on a roadway network. This is a \nstreamlined and repeatable process to monitor signs and signals along any roadway using a simple input file (.CSV), GPS recorded data file (.GPX) and a synchronized recorded video file.\n\n## Features\n* Video Synchronization Helper Tools: Python methods are provided to export the video frames and help to synchronize the video file.\n* Automated data processing: The SSOSS scripts uses a combination of GPS and video data to extract images of traffic signals and/or roadway signs.\n* Image Labeling and animated GIF image tools: Python functions are included to label images or create an animated GIF from multiple images \n\n## Requirements\n- Python 3.8\n- Required libraries: pandas, numpy, opencv-python, geopy, gpxpy, imageio, tqdm, lxml \n\n## Installation\nTo install SSOSS, follow these steps:\n\n    python3 -m pip install ssoss\n\n## Usage\nTo use the SSOSS program, \n1. Setup the necessary input files in A and B. \n2. Follow the data processing commands in Part C. Jupyter Notebook available as example\n\n### A. Input Files\nData related to the static road objects (signs and traffic signals) need to be saved in a CSV file for used in processing.\nThe intersection CSV file has the following format (as a minimum):\n\nID, Streetname 1, Streetname 2, Center_Latitude, Center_Longitude, Posted Speed (MPH) of NB Approach, Posted Speed (MPH) of EB Approach, \nPosted Speed (MPH) of SB Approach, Posted Speed (MPH) of WB Approach, NB Approach Compass Heading, EB Approach Compass Heading,\nSB Approach Compass Heading, WB Approach Compass Heading\n\n### B. Data Collection\nCollect data simultaneously:\n1. GPX recording\n   a. Use GPX Version 1.0 with logging every second\n2. Video Recording\n   a. Record at 5 Megapixel resolution or more\n   b. Record at 30 frames per second or higher\n\n### C. Data Processing: Argparse Command Line\n```Shell\n(ssoss_virtual_env) python ssoss_cli.py -h\n```\n\n#### Basic Usage\n```Shell\n(ssoss_virtual_env) python ssoss_cli.py --static_objects signals.csv --gpx_file drive.gpx --video_file vid.mov \n                                        --sync_frame 456 --sync_timestamp 2022-10-24T14:21:54.32Z\n```\n\n\n\n#### Python Notebook\n\n```python\n    import ssoss as ss\n\nsignals_csv = \"signal\"  # .csv is omitted\ngpx_file = \"drive_1\"  # .gpx is omitted\n\nsignal_project = ProcessRoadObjects(signals_csv, gpx_file)\nsightings = signal_project.intersection_checks()\n\nvid_file = \"drive_1.MP4\"\nvideo = ss.ProcessVideo(vid_file)\nvideo.sync(200, \"2022-10-24T14:21:54.988Z\")  # See Sync Process below\nvideo.extract_sightings(sightings, signal_project)\n```\n\nAt this point, progress bars should load while the images are saved to the output folder.\n\n#### Sync GPX & Video Process\nSynchronizing the GPX file and the video could be one of the largest sources of error. The ProcessVideo Class has\na helper function to perform a accurate synchronization time. The extract_frames_between method can export all the \nvideo frames between two time vales. When looking at the GPX points, the approximate video time can be estimated \nand all the frames can be extracted. This method is:\n\n```Shell\n        (ssoss_virtual_env) python ssoss_cli.py -video_file vid.mov --frame_extract_start 4 --frame_extract_end 6\n```\n\nCheck the printed logs to see the saved output location. Default is:\n./out/[video filename]/frames/###.jpg\nwhere ### is the frame number of the image.\n\nUse the frame number and the GPX recorded time to line up the best point to synchronize the video using the Sync method.\n\n## Documentation\n\n### Helper Function: GIF Creator\nCreate a gif from multiple images around the sight distance location. This can be helpful if the lens is out of focus\nat an extracted frame, or just more context before and after a sight distance is needed.\n\n```python\n        video.extract_sightings(sightings, signal_project, gen_gif=True)\n```\nSaves .gif file in ./out/[video filename]/gif/\n\n### Heuristic\n\nFor Each GPX Point:\n* What are the closest & approaching intersections\n  * Based on compass heading of moving vehicle and input data (.csv), which approach leg is vehicle on?\n    * What is the approach speed of that approach leg, and look up sight distance for that speed\n      * Is the current GPX point greater than that sight distance and the next point is less than the sight distance,\n        * If yes, then calculate acceleration between those two points and estimate the time the vehicle \n        traveled over the sight distance.\n        * If no, go to next GPX point\n\nFrom the sight distance timestamp and synchronized video file, the frame is extracted that is closest to that time.\n\n## Contributions\nContributions are welcome to the SSOSS project! If you have an idea for a new feature or have found a bug, please open an issue or submit a pull request.\n\n## License\nThe SSOSS project is licensed under the MIT License. See LICENSE for more information.",
    "bugtrack_url": null,
    "license": "",
    "summary": "Safe Sightings of Signs and Signals Package",
    "version": "0.3.16",
    "split_keywords": [
        "gpx",
        "sight distance",
        "traffic signals",
        "video"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba708bc53af9f6fb13a1bdd504e9aea9159844ca7afb188abed02496e70b9f8e",
                "md5": "f19cc784c4a3e2c3d5b4ef9c4b6edd23",
                "sha256": "bd5800911ca8f2a5e56e04e0392fede9cb471f78eda3f115ee2ffcc9992f1be7"
            },
            "downloads": -1,
            "filename": "ssoss-0.3.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f19cc784c4a3e2c3d5b4ef9c4b6edd23",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 30155,
            "upload_time": "2023-04-09T04:20:47",
            "upload_time_iso_8601": "2023-04-09T04:20:47.331629Z",
            "url": "https://files.pythonhosted.org/packages/ba/70/8bc53af9f6fb13a1bdd504e9aea9159844ca7afb188abed02496e70b9f8e/ssoss-0.3.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "12a4e574ead7202b01474df895e1443db33176ddd19de08c918f47d027e11b35",
                "md5": "b9340d4d76ebe176527ca6b05f170f2c",
                "sha256": "8655457dfe8fde44252a42ea91d7565d1a9c6f6829fcfb936737006e644afd26"
            },
            "downloads": -1,
            "filename": "ssoss-0.3.16.tar.gz",
            "has_sig": false,
            "md5_digest": "b9340d4d76ebe176527ca6b05f170f2c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 26702,
            "upload_time": "2023-04-09T04:20:49",
            "upload_time_iso_8601": "2023-04-09T04:20:49.457126Z",
            "url": "https://files.pythonhosted.org/packages/12/a4/e574ead7202b01474df895e1443db33176ddd19de08c918f47d027e11b35/ssoss-0.3.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-09 04:20:49",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "ssoss"
}
        
Elapsed time: 0.05414s