> ## 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.

# Hypotheses for White Gap elements

> White Gap hypotheses come from histograms of object projections: understand threshold coefficients, upper and lower limits, and each hypothesis property.

FlexiLayout Studio formulates **White Gap** hypotheses by creating histograms of candidate objects.

By default, FlexiLayout Studio looks for a White Gap between **Any Text** objects. To look for a White Gap between other types of object (for example, between **Separators**), write a constraint in the **Advanced pre-search relations** field on the **Advanced** tab of the **White Gap** element's **Properties** dialog box.

For example, to find a White Gap in an area where all types of objects may occur, write the following expression:

```text theme={null}
Type: PictureObject + SeparatorObject+ AnyText + PunctuationMark + CheckMarkObject;
```

## How a histogram is created

FlexiLayout Studio projects all objects of a certain type detected in the search area onto the horizontal or vertical axis. The projection is the sum of the objects' widths or heights, and the linear size of each object of the given type is added to the projection.

When looking for a horizontal gap, FlexiLayout Studio creates a projection on the vertical axis. When looking for a vertical gap, it creates a projection on the horizontal axis.

For example, to find a vertical White Gap among the text objects, FlexiLayout Studio sums up the heights of all text objects that are located in the search area above a particular point on the horizontal axis and that intersect the search area of the element.

FlexiLayout Studio then looks for regions where the height of the histogram is less than a particular value. These regions correspond to areas in which the number of objects is relatively small and their projection is less than a certain predefined value.

A certain number of objects must be allowed in the White Gap because real images often contain speckles and other noise introduced during scanning. This noise must be ignored when looking for gaps between columns or paragraphs, and it does not significantly affect the overall profile.

Suppose there are text objects H1, H2,..., H9 in the search area. In the following figure, these objects are highlighted in black. The search area also contains other types of objects (highlighted in red).

<Frame>
  <img src="https://mintcdn.com/abbyy/lqYknuOmCa79141v/images/flexi-capture/fls/WhiteGap_I.gif?s=6538ce28003779056c6cf6c68a30d1a2" alt="Diagram of a search area with text objects H1 through H9 highlighted in black and other object types highlighted in red" width="306" height="195" data-path="images/flexi-capture/fls/WhiteGap_I.gif" />
</Frame>

To find the vertical White Gap, FlexiLayout Studio sums up the projections of the text objects on the horizontal axis. The resulting histogram is shown in the following figure. Non-text objects are ignored in the histogram.

<Frame>
  <img src="https://mintcdn.com/abbyy/lqYknuOmCa79141v/images/flexi-capture/fls/WhiteGap_II.gif?s=987089d418188a3bdc7b470834ee57ad" alt="Diagram of the histogram formed by summing the projections of the text objects on the horizontal axis, with non-text objects ignored" width="334" height="213" data-path="images/flexi-capture/fls/WhiteGap_II.gif" />
</Frame>

Next, FlexiLayout Studio finds the histogram maximum (marked as **Max** in the figure). The value of the maximum level is then multiplied by the value set in **Threshold coefficient (%)** (`K=0.2`). The result is the maximum allowed level of the White Gap (marked as **White Gap threshold** in the figure). If the resulting **White Gap threshold** > 0, other objects may be present in the area of the White Gap.

Once the **White Gap threshold** has been calculated, it is compared with the values set in **Lower threshold limit** and **Upper threshold limit**. If **White Gap threshold** \< **Lower threshold limit**, the **White Gap threshold** is assigned the value of the **Lower threshold limit**, and this value is used to look for the White Gap. If **White Gap threshold** > **Upper threshold limit**, the **White Gap threshold** is assigned the value of the **Upper threshold limit**.

Next, the heights on the histogram are compared with the **White Gap threshold** to find areas where the level of the histogram is less than the **White Gap threshold**.

The **Min width/height** property sets the minimum absolute width of the White Gap. If the value is **W2**, the two other hypotheses are discarded.

A **White Gap** hypothesis has the following properties:

| Property                                | Description                                                                                                                                                                                                                                               |
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Element name**                        | The full name of the element.                                                                                                                                                                                                                             |
| **Page**                                | The number of the page on which the element was detected.                                                                                                                                                                                                 |
| **Surrounding rect**                    | The coordinates of the rectangle which surrounds the region of the hypothesis.                                                                                                                                                                            |
| **Width**                               | The width of the region of the hypothesis.                                                                                                                                                                                                                |
| **Height**                              | The height of the region of the hypothesis.                                                                                                                                                                                                               |
| **Orientation**                         | The orientation of the detected White Gap.                                                                                                                                                                                                                |
| **Histogram maximum in search area**    | The peak of the histogram in the search area.                                                                                                                                                                                                             |
| **White Gap threshold**                 | The point in the histogram under which FlexiLayout Studio starts formulating White Gap hypotheses.                                                                                                                                                        |
| **Histogram maximum within hypothesis** | The peak of the histogram maximum within the hypothesis.                                                                                                                                                                                                  |
| **Detected**                            | Shows whether the object described by the element has been found (`true`) or whether a null hypothesis has been formulated (`false`).                                                                                                                     |
| **From the best path**                  | Shows whether the found hypothesis belongs to the best path in the tree of hypotheses (`true`) or not (`false`).                                                                                                                                          |
| **Pre-search quality**                  | How well the hypothesis matches the properties of the element specified by the settings in the **Properties** dialog box and by the code in the **Advanced pre-search relations** field.                                                                  |
| **Post-search quality**                 | The quality of the hypothesis after the conditions in the **Advanced post-search relations** field have been applied.                                                                                                                                     |
| **Chain quality**                       | The quality of the chain of hypotheses, from the first subelement of the group to the current subelement. Chain quality is calculated by multiplying the qualities of all the subelements in the chain and is used to compare rival chains of hypotheses. |

## Related topics

* [White Gap](/flexi-capture/fls/template/white-gap)
* [Search area](/flexi-capture/fls/template/search-constraints)
* [Additional search constraints](/flexi-capture/fls/template/advanced-constraints)
