Length Measurement Examples¶
Running the Demo¶
This section corresponds to this example online, in addition to the measurement_using_stereo example folder in a VIAME installation. This folder contains examples covering fish measurement using stereo. This example is currently a work in progress.
Run CMake to automatically download the demo data into this example folder. Alternatively you can download the demo data directly.
Make sure you build VIAME with VIAME_ENABLE_PYTHON=True and VIAME_ENABLE_CAMTRAWL=True.
For simplicity this tutorial will assume that the VIAME source directory is [viame-source] and the build directory is [viame-build]. Please modify these as needeed to match your system setup. We also assume that you have built VIAME.
Additionally this example requires an extra python dependency to be installed. On Linux or Windows, ‘pip install ubelt’.
Running via the pipeline runner¶
To run the process using the sprokit C++ pipeline we use the the pipeline runner:
# First move to the example directory cd [viame-build]/install/examples/measurement_using_stereo # The below script runs pipeline runner on the measurement_example.pipe bash run_measurer.sh
This example runs at about 4.0Hz, and takes 13.3 seconds to complete on a 2017 i7 2.8Ghz Dell laptop.
Running via installed camtrawl python module¶
The above pipeline can alternatively be run as a python script.
# move to your VIAME build directory cd [viame-build] # Run the setup script to setup the proper paths and environment variables source install/setup_viame.sh # you may also want to set these environment variables # export KWIVER_DEFAULT_LOG_LEVEL=debug export KWIVER_DEFAULT_LOG_LEVEL=info export SPROKIT_PYTHON_MODULES=kwiver.processes:viame.processes:camtrawl_processes
You should be able to run the help command
python -m viame.processes.camtrawl.demo --help
The script can be run on the demodata via
python -m viame.processes.camtrawl.demo \ --left=camtrawl_demodata/left --right=camtrawl_demodata/right \ --cal=camtrawl_demodata/cal.npz \ --out=out --draw -f
Running via the standalone script¶
Alternatively you can run by specifying the path to camtrawl module (if you have a python environment you should be able to run this without even building VIAME)
# First move to the example directory cd [viame-source]/examples/measurement_using_stereo # Run the camtrawl module directly via the path python ../../plugins/camtrawl/python/viame/processes/camtrawl \ --left=camtrawl_demodata/left --right=camtrawl_demodata/right \ --cal=camtrawl_demodata/cal.npz \ --out=out --draw -f
Without the –draw flag the above example, this example runs at about 2.5Hz, and takes 20 seconds to complete on a 2017 i7 2.8Ghz Dell laptop.
With –draw it takes significantly longer (it runs at 0.81 Hz and takes over a minute to complete), but will output images like the one at the top of this readme as well as a CSV file.
Note that the KWIVER C++ Sprokit pipline offers a significant speedup (4Hz vs 2.5Hz), although it currently does not have the ability to output the algorithm visualization.
Calibration File Format¶
For the npz file format the root object should be a python dict with the following keys and values:
For the mat file, format the root structure should be a dict with the key Cal whose value is a dict with the following items: