> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Match the FlexiLayout with images

> Match a FlexiLayout with images to detect objects and draw blocks: search order down the FlexiLayout tree, optional elements, and Match menu commands.

When matching a FlexiLayout with an image, ABBYY FlexiLayout Studio attempts to detect the objects on the image that correspond to the elements. It then uses the detected objects to draw blocks on the image.

The matching process goes down the FlexiLayout tree, trying to find all the objects described by the elements, and draws blocks based on the search constraints specified in the FlexiLayout.

## Element search order

Suppose a FlexiLayout has a Group element **A** consisting of two simple elements **a** and **b** and one Group element **B** (which, in turn, consists of two simple elements **aa** and **bb**). Suppose further that it also has two simple elements **c** and **d**. Elements **A**, **c** and **d** have the same nesting level:

```text theme={null}
Element A
   Element a
   Element b
   Element B
      Element aa
      Element bb
Element c
Element d
```

When matching this FlexiLayout with an image, the objects corresponding to these elements will be searched for in the following order: **a**, **b**, **aa**, **bb**, **c**, and **d**.

If all the objects corresponding to all the non-optional elements are found (any objects that are not found must correspond to optional elements), the FlexiLayout will be matched successfully. If at least one object corresponding to a non-optional element cannot be found, the matching process will be stopped and you will need to adjust the FlexiLayout.

## Match the FlexiLayout with images in a batch

<Steps>
  <Step title="Select one or more images in the batch" />

  <Step title="Run the Match command">
    Choose **Match** from the **Batch** menu or the shortcut menu.
  </Step>
</Steps>

## Match the FlexiLayout with an open image

Use this method to match the FlexiLayout and view the [tree of hypotheses](/flexi-capture/fls/hypotheses/hyp-tree).

<Steps>
  <Step title="Open an image" />

  <Step title="Run the Match command">
    Choose **Match** from the **Image** menu or the shortcut menu.
  </Step>
</Steps>
