Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Calculate Spatial Information / Temporal Information according to ITU-T P.910

Project description

SITI: Spatial Information / Temporal Information

PyPI version

A command-line-based tool to calculate spatial information (SI) and temporal information (TI) according to ITU-T P.910.

The command outputs SI and TI information to stdout, in JSON format, or alternatively as CSV.

Author: Werner Robitza

Important Note / Breaking Changes:

  • Version 0.x produces incorrect values due to wrong reading of the data using PyAV. Version 1.x and above produces correct values in the sense of corresponding to this implementation. As there are no test vectors for SI / TI implementations, and filter calculations differ depending on how you implement them, the values obtained with this tool may not be comparable with output from other tools.
  • Version 1.x now outputs the same number of values for SI and TI, inserting a null value for the first frame’s TI. Also, the output format has been changed.

Contents:

Requirements

  • Python 3
  • FFmpeg libraries (to run pyav)

Under Ubuntu, to get ffmpeg libraries:

sudo apt install libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libavresample-dev

Installation

Run:

pip3 install --user siti

Alternatively, clone this repository and then:

pip3 install --user .

Usage

usage: siti [-h] [-of {json,csv}] [-q] [-n NUM_FRAMES] input

positional arguments:
  input                 input file

optional arguments:
  -h, --help            show this help message and exit
  -of {json,csv}, --output-format {json,csv}
                        output format
  -q, --quiet           do not show progress bar
  -n NUM_FRAMES, --num-frames NUM_FRAMES
                        number of frames to calculate

Background

The following info is given about SI / TI in ITU-T Recommendation P.910 (“Subjective video quality assessment methods for multimedia applications”):

Spatial Information

The spatial perceptual information (SI) is based on the Sobel filter. Each video frame (luminance plane) at time n (Fn) is first filtered with the Sobel filter [Sobel(Fn)]. The standard deviation over the pixels (stdspace) in each Sobel-filtered frame is then computed. This operation is repeated for each frame in the video sequence and results in a time series of spatial information of the scene. The maximum value in the time series (maxtime) is chosen to represent the spatial information content of the scene. This process can be represented in equation form as:
image1

Temporal information

The temporal perceptual information (TI) is based upon the motion difference feature, Mn(i, j), which is the difference between the pixel values (of the luminance plane) at the same location in space but at successive times or frames. Mn(i, j) as a function of time (n) is defined as:

image2

here Fn(i, j) is the pixel at the ith row and jth column of nth frame in time. The measure of temporal information (TI) is computed as the maximum over time (maxtime) of the standard deviation over space (stdspace) of Mn(i, j) over all i and j.

More motion in adjacent frames will result in higher values of TI

License

siti, Copyright (c) 2017-2019 Werner Robitza

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

History

v0.5 (2019-04-10)

  • Fix error when invoking np print settings

v0.4 (2019-01-04)

  • Fix README

v0.3 (2018-06-12)

  • Fix error with containers that declare no frame numbers

v0.2 (2018-04-12)

  • Set magnitude-based approach as default

v0.1 (2017-10-24)

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for siti, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size siti-1.0.4-py3-none-any.whl (6.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size siti-1.0.4.tar.gz (14.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page