Wiki

The most recent version of this page is a draft.DiffThis version (14 Feb 2022 22:35) was approved by Andre Straker-Payne.

This is an old revision of the document!


Time-of-Flight Auxiliary Tools

The ADI Time-of-Flight Evaluation package provides additional tools for the user. These tools are generally secondary software that provide analysis of data generated by the Time-of-Flight signal chain.

These tools are in the bin\tools folder of the installed software.

In general the auxiliary tools require Python.

These tools have been only tested on Windows 10 64-bit
Setting up Python
  1. Open the “Anaconda prompt (Miniconda3)”
  2. In the Miniconda prompt, create the virtual environment via environment.yaml
    1. cd <TOF installation folder>\bin\tools\FSF
    2. conda env create --file environment.yaml --name tof-tools-py39
Using Python
  1. Open the “Anaconda prompt (Miniconda3)”
  2. In the Miniconda prompt, create the virtual environment via environment.yaml
    1. cd <TOF installation folder>\bin\tools
    2. conda activate tof-tools-py39

Depth Compute

IMPORTANT: before using, activate the Conda environment as described in Setting up Python.

Overview

tofi_compute_depth application processes the input raw files captured using ADI ToF system and generates Radial-Depth/AB/XYZ output images.

Getting Python ready:

  1. Open the “Anaconda prompt (Miniconda3)”
  2. In the Miniconda prompt, create the virtual environment via environment.yaml
    1. cd <TOF installation folder>\bin\tools
    2. conda activate tof-tools-py39

Tool help

tofi_compute_depth --I=<input_fsf_or_raw_file> --O=<output_path> --CCB=<calibration> --MODE=<mode>
tofi_compute_depth (-h | --help) 
tofi_compute_depth --version

Command Line Parameters:
  -h --help      Show this screen
  --version      Show version
  --I=<s>        Input file or folder
  --O=<s>        Output folder
  --CCB=<s>      Calibration Binary [default: 0]
  --MODE=<n>     mode of operation(Mode=10 for 1MP)  
  --INI=<s>      INI File (optional)

Unit Testing Command Line Parameters:
  --CONFIG=<s>   Configuration File [default: 0]
  --b=<s>        Benchmark enable. [default: 0]
  --iterate=<n>  Benchmark number of iterations [default: 1]

Example Usage

tofi_compute_depth.exe --I=input_raw_file_folder --CCB=cal_file --MODE=mode --O=output_path

Note: The 'mode' setting much match the capture mode of the data in the .bin or .fsf file(s) and the calibration file (.ccb) should be the corresponding calibration file used for data capture.

Example for processing single raw file

tofi_compute_depth.exe --I=./test_data/MP/raw/frame_1001229429.bin --O=./test_data/MP/  --CCB=./test_data/MP/test_data_example_040638.ccb --MODE=10

Note: The filenames mentioned in the above example are for reference only, they need to be replaced with correct input/output/calibration CCB filenames. Microsoft power shell is used as command shell.

Example for fsf file input with 1 or more frames

tofi_compute_depth.exe --I ./test_data/QMP/example_12230.fsf --O=./test_data/QMP/ --CCB ./test_data/QMP/fsf_test_12230.ccb --MODE=0

Output

* The output files will be generated in <output_path> folder specified while running the tofi_compute_depth.

Visualize Depth Image

* Dependency : Requires Python 3.1(or later), numpy, and matplotlib libraries for visualization. * The output AB (active brightness) and Radial depth images can be visualized using the python scripts 'visualize_ab.py' and 'visualize_depth.py', with a specific filename.

python visualize_ab.py <file> [width] [height]
positional arguments:
  file     path to AB data file
optional arguments:
  width      width of the image (default is 1024)
  height      height of the image (default is 1024)

python visualize_depth.py <file> [width] [height]
positional arguments:
  file     path to RadialDepth data file
optional arguments:
  width      width of the image (default is 1024)
  height      height of the image (default is 1024)

Example

python visualize_ab.py test_data\MP\AB\frame_1001229429_0.bin 1024 1024

Example

python visualize_depth.py test_data\MP\RadialDepth\frame_1001229429_0.bin 1024 1024  

Visualize Point Cloud

* Dependency : Requires Python 3.1(or later) and Open3D library for visualization. Open3D can be installed using python installer package as “pip install open3D”. * The output XYZ image (point cloud) can be visualized using the python script “visualize_pointcloud.py”

python visualize_pointcloud.py [-h] [--version] <width> <height> <xyz_file>

positional arguments:
  width       width of the image
  height      height of the image
  xyz_file    path to xyz file

optional arguments:
  -h, --help  show this help message and exit
  --version   show program's version number and exit

Example

python .\visualize_pointcloud.py 1024 1024 .\test_data\MP\XYZ\frame_1001229429_0.bin

Known Issues

* The application may crash if wrong calibartion/config data is used. * Frames/sec value may be reported incorrectly as 'inf', define argument '--b=1' to return a valid frames/sec estimate.


FSF Extraction

IMPORTANT: before using, activate the Conda environment as described in Setting up Python.

FSF is a video file format that is used by Microsoft to store various video data such as RAW, DEPTH, AB and XYZ. It supports the concept of streams for each of the data type. This format allows us to capture all video information in a single file or separate files per stream.

Run the python file to extract FSF information (AB, Depth, Point-Cloud), the python file uses a JSON file bound.json to get the values of depth_min/depth_max/ab_min/ab_max.

Getting Python ready

  1. Open the “Anaconda prompt (Miniconda3)”
  2. In the Miniconda prompt, create the virtual environment via environment.yaml
    1. cd <TOF installation folder>\bin\tools
    2. conda activate tof-tools-py39

Example usage with the example FSF file that is included

Extract all frames

python fsf_extract.py data/example_XYZ.fsf 

Extract frame 0 only

python fsf_extract.py data/example_XYZ.fsf 0 0 

Extract frame 1, 2, 3

python fsf_extract.py data/example_XYZ.fsf 1 3

Output is placed into the output folder

  • frame_x_ab_lin.png
  • frame_x_ab_log.png
  • frame_x_depth_z.png
  • frame_x_depth_z_gray16.png
  • frame_x_depth_r.png
  • frame_x_depth_r_gray16.png
  • frame_x.ply

/srv/wiki.analog.com/data/pages/resources/eval/user-guides/eval-adsd3100-nxz/tof_auxtools_cli.txt · Last modified: 12 Apr 2022 23:15 by Harshvardhan Bhatia