# Building Generalization

When building outlines are derived from image segmentation and classification methods, they usually do not have straight edges and rectangular corners. Furthermore, vector representations consist of many redundant points. However, simple geometric shapes are often required, for example for three-dimensional modeling of buildings or simply for cartographic representation of the results.

For this purpose, eCognition contains an algorithm for generalization of two-dimensional building outlines: ‘vector orthogonalization’. This algorithm generalizes polygons into rectilinear (orthogonal) polygons based on a specified granularity. A key parameter of this algorithm is the “main direction”, which defines the polygon direction (x-axis in degrees, range -90…90), because the resulting individual polygons will be orthogonal and rotated at this (local or global) angle.

As a user, you can select 3 options for the main direction:

- Set one global value to orthogonalize all objects from the algorithm domain based on it (useful in exceptional cases)
- Select the auto-detect option so that eCognition will determined the main direction by the largest sum of edges with the same angle. Sometimes this results in meaningful (good looking) results, but often other customized approaches are needed to determine the main direction for each object.
- Select a vector attribute feature which contains main directions for each vector object. But the attribute column needs to be filled in forehand.

This sample project shows the use of the 'vector orthogonalization' algorithm in general. In addition, a Customized Algorithm shows a way to calculate the main direction based on the largest object edge, either via the shape or via an edge filter. The material was provided by Christian Weise.

To use the ‘compute object directions based on longest edges’ please download the customized algorithm ‘CA - compute object directions based on longest edges - v02.dcp’ and load it into your project, after it you will find the ‘compute object directions based on longest edges’ in the algorithm list. The ‘Example Project - Building Generalization’ provides some use cases - starting with theoretically examples to learn how to use the ‘vector orthogonalization’ algorithm and how to use it in combination with the customized algorithm ‘compute object directions based on longest edges’.

The project requires eCognition version 10.2 or higher. You can drag & drop the ‘Project.dpr’ file into the eCognition Developer software to open the sample project.

Download ‘compute object directions based on longest edges’ algorithm

## Was this article helpful?

1 comment

Thank you for updating this!