Sequencing

Pandora will check if the requested steps sequencing is correct following the permitted transition defined by the Pandora Machine (transitions)

Pandora Machine defines 3 possible states:
  • begin

  • cost_volume

  • disparity_map

and 9 transitions, each one corresponding to a stereo step described in Step by step chapter:

Pandora machine starts at the begin state. To go from a state to another one, transitions are called and triggered by specific name. It corresponds to the name of Pandora steps you can write in configuration file.

The following diagram highligts all states and possible transitions.

../_images/Machine_state_diagram.png

A transition (i.e a pandora’s step) can be triggered several times. You must respect the following naming convention: stepname.xxx where xxx can be the string you want. See Same step, multiple times for an example with multiple usage of filter transition.

The most important thing to remember is to build your configuration file following the previous diagram by using transition name on pipeline section of your file.

Note

The only step of pipeline key configuration file that does not depend on machine state is the right_disp_map step (see Outputs). This one, if needed, must be written at the top of pipeline section as shown in SSD measurment ,filtered disparity map and compute right map.

If you want to understand in more details how Pandora machine works, please consult our Pandora machine state tutorial notebook.

Examples

SSD measurment and filtered disparity map

Configuration to produce a disparity map, computed by SSD method, and filterd by median filter method.

{
    "input":
    {
        "left_mask": null,
        "right_mask": null,
        "disp_min_right": null,
        "disp_max_right": null,
        "img_left": "img_left.png",
        "img_right": "img_left.png",
        "disp_min": -100,
        "disp_max": 100
    },
    "pipeline":
    {
        "matching_cost":
        {
            "matching_cost_method": "ssd",
            "window_size": 5,
            "subpix": 1
        },
        "disparity":
        {
            "disparity_method": "wta",
            "invalid_disparity": "NaN"
        },
        "filter":
        {
            "filter_method": "median"
        }
    }
}
../_images/machine_state_example1.gif

SSD measurment ,filtered disparity map and compute right map

The same configuration as the previous example but right disparity map is also computed.

{
    "input":
    {
        "left_mask": null,
        "right_mask": null,
        "disp_min_right": null,
        "disp_max_right": null,
        "img_left": "img_left.png",
        "img_right": "img_left.png",
        "disp_min": -100,
        "disp_max": 100
    },
    "pipeline":
    {
        "right_disp_map":
        {
          "method": "accurate"
        },
        "matching_cost":
        {
            "matching_cost_method": "ssd",
            "window_size": 5,
            "subpix": 1
        },
        "disparity":
        {
            "disparity_method": "wta",
            "invalid_disparity": "NaN"
        },
        "filter":
        {
            "filter_method": "median"
        }
    }
}

An impossible sequencing

{
    "input":
    {
        "left_mask": null,
        "right_mask": null,
        "disp_min_right": null,
        "disp_max_right": null,
        "img_left": "img_left.png",
        "img_right": "img_left.png",
        "disp_min": -100,
        "disp_max": 100
    },
    "pipeline":
    {
        "matching_cost":
        {
            "matching_cost_method": "ssd",
            "window_size": 5,
            "subpix": 1
        },
        "filter":
        {
            "filter_method": "median"
        }
        "disparity":
        {
            "disparity_method": "wta",
            "invalid_disparity": "NaN"
        },
        "filter":
        {
            "filter_method": "median"
        }
    }
}

With this configuration, you receive the following error

Problem during Pandora checking configuration steps sequencing. Check your configuration file.
(...)
transitions.core.MachineError: "Can't trigger event filter from state cost_volume!"

Before the start, Pandora Machine is in the “begin” state. The configuration file defines matching_cost as the first step to be triggered. So, Pandora Machine go from begin state to cost_volume state. Next, the filter is going to be triggered but this is not possible. This step can be triggered only if the Pandora Machine is in disp_map.

../_images/machine_state_example2.gif

Same step, multiple times

{
    "input": {
        "left_mask": null,
        "right_mask": null,
        "disp_min_right": null,
        "disp_max_right": null,
        "img_left": "img_left.png",
        "img_right": "img_left.png",
        "disp_min": -100,
        "disp_max": 100
    },
    "pipeline":
    {
        "matching_cost":
        {
            "matching_cost_method": "ssd",
            "window_size": 5,
            "subpix": 1
        },
        "disparity":
        {
            "disparity_method": "wta",
            "invalid_disparity": "NaN"
        },
        "filter.1":
        {
            "filter_method": "median"
        }
        "filter.2":
        {
            "filter_method": "bilateral"
        }
    }
}
../_images/machine_state_example3.gif

Multiscale

Configuration to produce a disparity map, computed by SSD method with mutliscale processing (3 scales)

{
    "input":
    {
        "left_mask": null,
        "right_mask": null,
        "disp_min_right": null,
        "disp_max_right": null,
        "img_left": "img_left.png",
        "img_right": "img_left.png",
        "disp_min": -100,
        "disp_max": 100
    },
    "pipeline":
    {
        "matching_cost":
        {
            "matching_cost_method": "ssd",
            "window_size": 5,
            "subpix": 1
        },
        "disparity":
        {
            "disparity_method": "wta",
            "invalid_disparity": "NaN"
        },
        "multiscale": {
            "multiscale_method": "fixed_zoom_pyramid",
            "num_scales": 3
        }
    }
}
../_images/machine_state_example4.gif