<a id="easyobject-objects"></a>

# Objects, Holes and their Features

Objects and holes are both represented by the class [`ECodedElement`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html), so they are managed in the same way and share the same functions. Use [`IsObject`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5d21b5a22b34fc2cd82488b0f1b4d217) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a0ebc5538599a5b4c6e7e7293ea99700e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a26f021cf200ca5320a57cecf88c35a59) or [`IsHole`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#aa6d8220200a8c2f3cce9b923921ec73f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a03f461974c490243e74b91de72b23083) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#adb4ced35f83b7ff972e34914a923ec4e) to determine the type of the coded element.

<a id="easyobject-objects-holes"></a>

## Holes Construction

A hole is a set of connected pixels that is entirely surrounded by a parent object. A hole has no child. Objects inside a hole are considered to be separate objects.

To get the holes of a specific object, use [`GetHoles`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#aa2085dfe54be939b0bed6dd0e108b692) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ae25a5203bb8068cbfb2ca3470c537294) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a42b90c7fee4f2c8c9aa483021a4ba894).

With an [object selection](selecting_and_sorting_blobs.html.md#easyobject-object-selection), you can also add the holes of all the objects of a coded image using [`EObjectSelection::AddHoles`](../../../doxygen_cpp/classeVision_1_1EObjectSelection.html#a55f2e9237cdf39145ce62d557ac8c2b7) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EObjectSelection.html#ac4dae66d3b07ef813cfb121fc15f6785) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EObjectSelection.html#a07d8629e8b357e512995473c4ed976dd) and add the holes of all the objects of the selection using [`EObjectSelection::AddHolesOfSelectedObjects`](../../../doxygen_cpp/classeVision_1_1EObjectSelection.html#a083e0ed9a47e539652b5516c92851c0d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EObjectSelection.html#a04c10072ada31dbdeac214f7226b0a91) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EObjectSelection.html#aa6141dd3e4f859be4a8c8ff4636c4749).

![Raw image](assets/images/easyobject/holesconstructiongrayscale.webp)![Encoding the white layer (3 objects and 3 holes)](assets/images/easyobject/holesconstructionwhitelayer.webp)![Encoding the black layer (4 objects and 3 holes)](assets/images/easyobject/holesconstructionblacklayer.webp)

#### SEE ALSO
See the [code snippets](../../../resources/code_snippets/matching_and_measurement/easyobject/holesextraction.html.md) showing how to extract the holes from the objects.

<a id="easyobject-objects-features"></a>

## Features

**EasyObject** can compute various features for each object and use these features for filtering or sorting.

There are two main categories of features:

* Cacheable features that will be computed only once on the first invocation. These features corresponds to methods prefixed with `Get` in C++ or properties in C# and Python.
* Non-cacheable features that will be reevaluated at every invocation. These features corresponds to method prefixed with `Compute`.
  * Note that these features usually requires an additional parameter or are slower to compute.

<a id="easyobject-objects-features-frame"></a>

Most features will be expressed in the [frame of reference](../../basic_operations/frame_and_alignment.html.md) used when *encoding* the image. However, some features are computed at the pixel level. In the tables below, the frame of reference is indicated in the corresponding column:

- *Frame* means  that the result is expressed with regard to the frame that was used when *encoding* the image.
- *Pixel* means that local pixel coordinates are used, irrespective of the frame.

<a id="easyobject-objects-gravity-center"></a>

### Gravity Center

| Feature                                              | Method                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Data type                                                                                                                                                                                                                           | [Frame of reference](#easyobject-objects-features-frame)   |
|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| Gravity center<br /><br/>\\\\<br/>(X and Y)          | [`GetGravityCenter`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a66e421b1ce6588c1cf572d9da8939fa2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#aecb5edc985078821d437178e8b85af24) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a6344670e34401f569da8ff77864fce44)<br /><br/>\\\\<br/>[`GetGravityCenterX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ac02576be08fb43b5cd74a6ab4e0c7e24) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a6e89b5d85f08867bfcbdc520cc798e90) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a52939cece9828e1a11198f35d4709d0c)<br /><br/>\\\\<br/>[`GetGravityCenterY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ad2530327fce961ca7d6a918859b37f75) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a9e2d1fc6cf13ae7dec82f7fde8e51a81) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#afa46d8fddaaaf40d6b4bc8e1be2604b1) | [`EPoint`](../../../doxygen_cpp/structeVision_1_1EPoint.html) [<sub>.NET</sub>](../../../doxygen_cs/structeVision_1_1EPoint.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EPoint.html)<br /><br/>\\\\<br/>Float | frame                                                               |
| Weighted gravity center<br /><br/>\\\\<br/>(X and Y) | [`ComputeWeightedGravityCenter`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5da623dd37476c23540fb904b5fd946e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a270ccad2a553b938b8fa8061995d520f) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a311f49724aa212608ece30cb32c7a1e3)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | [`EPoint`](../../../doxygen_cpp/structeVision_1_1EPoint.html) [<sub>.NET</sub>](../../../doxygen_cs/structeVision_1_1EPoint.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EPoint.html)                          | frame                                                               |
![image](assets/images/easyobject/feature_gravity_center.webp)

The **gravity center** is the average of the coordinates, expressed in a frame of reference, of all the pixel of the blob:

$$
 G = \frac{1}{N} \sum_{i=1}^N p_i 
$$

The **weighted gravity center** requires an input image and is the average of the coordinates, expressed in a frame of reference, of all the pixel of the blob, weighted by the corresponding pixel value of the given image:

$$
 G_w = \frac{\sum_{i=1}^N I(p_i) p_i}{\sum_{i=1}^N I(p_i)} 
$$

<a id="easyobject-objects-size-and-extent"></a>

### Size and Extent

| Feature                                                                                                             | Method                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Data type                                                                                                                                                                                                                                                                               | [Frame of reference](#easyobject-objects-features-frame)   |
|---------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| Area (pixel count)                                                                                                  | [`GetArea`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ab7701cf7280c9d9c58c2b067d666c82f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a807e9297872bc0f37f3d4c9d49f29e7f) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ab6c096859609e22b51074e2890e4d008)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | `unsigned int`                                                                                                                                                                                                                                                                          | pixel                                                               |
| Bounding box limit<br /><br/>\\\\<br/>(top, bottom, left, right)                                                    | [`GetTopLimit`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5964e81a772abf2a96ee92152a88319b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a591bbcfb46f789c026a7a3d2515e7761) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a585e1420acc785e61ca0da4be590f8fd)<br /><br/>\\\\<br/>[`GetBottomLimit`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ad317287d36c2434c11b7bb4e2927b090) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#af6f925bf3339559c721907e58957c152) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ae648feaaa6b97230677df991f5917c7d)<br /><br/>\\\\<br/>[`GetLeftLimit`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a695ef43de670db8e32895337cea44da4) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a3481601f3bf36a7c05462a404fb2c417) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a58bcb3e9b2b519ce2a6e6e8b972cab47)<br /><br/>\\\\<br/>[`GetRightLimit`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a3768183f35cfc9b1a2a114bdb72b48e6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a41fbf2240634a18d22a318b3bced427d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ad686e144d5284b931574c6d19f333670)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `int`                                                                                                                                                                                                                                                                                   | pixel                                                               |
| Feret box<br /><br/>\\\\<br/>(center X and Y, height, width with distinct orientation angles at 22, 45, 68 degrees) | [`ComputeFeretBox`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a57b6255c10c96e0e6780ff4bb1bacbe6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a372aadd42d0995ebff8f3c1ec710b791) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a286e90c5da56726d9841bcaae097bc84)<br /><br/>\\\\<br/>[`GetFeretBox22Box`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ab1902e5e76383fa8182ba008bffb2b51) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ad180db4af74e9637b7d92af69f24c646) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ad4e94d7611c542da35e02c1c63845223)<br /><br/>\\\\<br/>[`GetFeretBox22Center`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a0594f70c81e0e41f5d73aa24e4fc3ac2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a6d9c4a1cc9a6af269ec3ae77c2b1f5f6) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a6491d12dd97da4971a40386826fd4d88)<br /><br/>\\\\<br/>[`GetFeretBox22CenterX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a2d1c02346356f60bbdf0f8215829407b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a5a7ce7ecbef209e603f2e425569513e5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ad32710924290bc7cddc8df26f59bb63e)<br /><br/>\\\\<br/>[`GetFeretBox22CenterY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a82d0aaaba17457866a29c1f563196e9c) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#adfd665516d5b911bca9e45ca730dfc46) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a01345cd2ae46b2a8ab050e9d521ccf1e)<br /><br/>\\\\<br/>[`GetFeretBox22Height`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a1a1c04e647814d933c690537a9e69cc3) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#aae9c8e2a61475fc9bbe0b591236171c9) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a759f1d5075061b4c8071172dea7399e2)<br /><br/>\\\\<br/>[`GetFeretBox22Width`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a8b307f45ea2b30994d5d131f498da995) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ac205f09e2eedd73cd3dcf6f1d2a3d969) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a2d598f1993cf88ed64663eb372b55c41)<br /><br/>\\\\<br/>[`GetFeretBox45Box`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a1f10ff3f31ea38691faf7f04e4698a21) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ab326bf720fa6c240d10e4bd8698fd648) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a204a8f64e5c89380eddace18cb2e225f)<br /><br/>\\\\<br/>[`GetFeretBox45Center`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a990b530e97942b9160d5c5e8564059e7) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#aec0ba9b59aa3ae7b7a2a9a37db02c75e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a4072eb6d4db2090bf2233bcf1fb95eda)<br /><br/>\\\\<br/>[`GetFeretBox45CenterX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#aa6b58153d4f64bf3dede77154f9e14da) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a616f63342877d6578137c11c4e9f8eba) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a7640a68e0462e2b0ac486799d1c6d95c)<br /><br/>\\\\<br/>[`GetFeretBox45CenterY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a6b99b78d9c78217a119a45ac8612ee66) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a116cfb6e319e9419cf709e87b5840c75) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#af5d750eb8a299203b67173fbd5d46381)<br /><br/>\\\\<br/>[`GetFeretBox45Height`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5af8323461f50b8e98965fe12c620150) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#af1ddbe675e30f03af1e7f08158c392d3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#adfdf2637568c22c1bf380ff0652e8b7a)<br /><br/>\\\\<br/>[`GetFeretBox45Width`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a01c08d96a921592381168c96873a2e08) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a776533c995bb8caec0f3b603bf2e8449) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a288f38b648f47851b90546e871952007)<br /><br/>\\\\<br/>[`GetFeretBox68Box`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a77a258be83870bef68c1281d02d6916d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a3aa5135e327153e13fefbe7177168ecd) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a21904b3d9bb53a5ee2b0ca9a93e491c2)<br /><br/>\\\\<br/>[`GetFeretBox68Center`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a45b5e55081b7ee36f600149cf3877a34) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a978ca71dce9e0d140b2716ceb91e73b7) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ad45a4341be5e564a3b302dd3a5d69931)<br /><br/>\\\\<br/>[`GetFeretBox68CenterX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#aaa6240e2becb8a9168b46ee947ea5c06) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ac761174e010747c044e127bd81838582) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a2444c222e6910d66e600836128b28771)<br /><br/>\\\\<br/>[`GetFeretBox68CenterY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a488a032e1587ac5a6d86f4c75eb35121) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ab8e489b2443c3d579fbe1bd91abf597f) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a89b4c58838c9a2ac3ff66a479dd2be6c)<br /><br/>\\\\<br/>[`GetFeretBox68Height`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5516c54a617af82096f87e7d75abf189) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a14aa34f17c7e3d6304e20399a9b383a0) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a09e7c9756fc17b0076f2fe4811b50f6e)<br /><br/>\\\\<br/>[`GetFeretBox68Width`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ab688e2ff4124150365636d8cc338ae0b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a0b39a442c2dd31667656b05c829e895f) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#aee25e1ad304ca59a8da6e0e6ce199f3a) | [`ERotatedBoundingBox`](../../../doxygen_cpp/classeVision_1_1ERotatedBoundingBox.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ERotatedBoundingBox.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ERotatedBoundingBox.html)<br /><br/>\\\\<br/>`float` | frame                                                               |
| Min. enclosing rectangle<br /><br/>\\\\<br/>(angle, center X and Y, height, width)                                  | [`GetMinimumEnclosingRectangle`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a6d45ce303696897fb459d0591911afb2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a046dd0b682a21a07960715df1604a006) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a8249526d64069f8533c9e7a18f5efa79)<br /><br/>\\\\<br/>[`GetMinimumEnclosingRectangleAngle`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a57da64ed5bae440c8fd094cd0ae1da58) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a029424890afcd06bdc51f6fe1d9ed436) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a552d641b899c877bb2f99b28acdced81)<br /><br/>\\\\<br/>[`GetMinimumEnclosingRectangleCenter`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a60bb832f2746f2cc3e8ebd04d1437810) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ade63060002d598886ddb33df921e0398) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a0ebf4cfe6196805f4b301bf0972eb666)<br /><br/>\\\\<br/>[`GetMinimumEnclosingRectangleCenterX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a135ecbe6ff1f688205300192398bb42b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a317c021651aea1b867fd56a4c0e64f0d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ab60bc1ad77cc26510387bbe40225eb30)<br /><br/>\\\\<br/>[`GetMinimumEnclosingRectangleCenterY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#afc2d8cabd6270b731baba96b6f5ecac6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a04c779241465d42e682e823e8240fc2b) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a457c92cc1b069c4106e281833f6c3aeb)<br /><br/>\\\\<br/>[`GetMinimumEnclosingRectangleHeight`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a4ff53c782422ebf966136fb178da070b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a5ea0f3ff97ec2e26b30ec8d778e7fbbb) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a8b31004a4bd9efb81a3adf675d71cfd6)<br /><br/>\\\\<br/>[`GetMinimumEnclosingRectangleWidth`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#aa54ec611e733427331888634f44940c6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a90ecea1f45432107ce1e69e1c0d3943e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a20e6a39d47d63ee20c417798baf7f3ba)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | [`ERotatedBoundingBox`](../../../doxygen_cpp/classeVision_1_1ERotatedBoundingBox.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ERotatedBoundingBox.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ERotatedBoundingBox.html)<br /><br/>\\\\<br/>`float` | frame                                                               |

A **Feret box** is a rectangle with the minimum surface rotated at a specified angle that contains all the pixels center points of an object.

- **Bounding box** is the Feret box at 0°.
- **Minimum enclosing rectangle** is the Feret box with the minimum surface across all the possible angles.
- **Width** of a **Feret box rectangle** is the length of the rectangle side that exhibits the smallest angle with the X-axis. This is NOT necessarily the smallest side!
- The **height** of a Feret box rectangle is the length of the other side of the rectangle.
- Use [`ComputeFeretBox`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a57b6255c10c96e0e6780ff4bb1bacbe6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a372aadd42d0995ebff8f3c1ec710b791) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a286e90c5da56726d9841bcaae097bc84) to compute a Feret box with an arbitrary angle.
  - The angle is measured clockwise from the X axis to the width side of the rectangle as shown in the image below:
    ![image](assets/images/easyobject/EasyObject_FeretAngle.svg)

<a id="easyobject-objects-misc-features"></a>

### Miscellaneous

| Feature                                                           | Method                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Data type                                                                                                                                                                                                                           | [Frame of reference](#easyobject-objects-features-frame)   |
|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| Starting point of the object contour<br /><br/>\\\\<br/>(X and Y) | [`GetContour`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a8c536b68d3e767a1780a8e7e3cbb494e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#af82d37fe472a5537a7a3e0d8c3872a9b) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#aaf8e5aaa1d174fd1e7f75aa64309e4fc)<br /><br/>\\\\<br/>[`GetContourX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a387010c296fc2b604451249f75cb4841) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a507494e1e30ccf09fdc9e48ad38e5de2) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a3a286a4e1bfb479875034bdc2c61aa4f)<br /><br/>\\\\<br/>[`GetContourY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ad0e071c2c7615719c647c92ae2751599) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ab1a19b4911698ff5ddcb88069ce5c776) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#abe3527d2e5d156e053a3e675c6f3f0ba) | [`EPoint`](../../../doxygen_cpp/structeVision_1_1EPoint.html) [<sub>.NET</sub>](../../../doxygen_cs/structeVision_1_1EPoint.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EPoint.html)<br /><br/>\\\\<br/>`int` | pixel                                                               |
| Path of the object contour                                        | [`GetContourPath`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#abf69bb81c4dc214f6a1ee3c33a98eb80) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#abb7ae3f9b7b34df0f40731605b6de590) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a72ab93817187fcee96f59454b7a09036)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | [`EPathVector`](../../../doxygen_cpp/classeVision_1_1EPathVector.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EPathVector.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EPathVector.html)        | pixel                                                               |
| Pixel gray-level value<br /><br/>\\\\<br/>(min and max)           | [`ComputePixelMax`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a89394e4898d070af0754d2c77eae122d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a8b12f9f5a74e5740439eb687b3842cbb) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a09f5c440867e6d4c9c08e504a9c16c18)<br /><br/>\\\\<br/>[`ComputePixelMin`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a8db00401dc0f8fd31a8a9f0d5e2820ba) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#af7f7445432f714281ffe16b59ab5773a) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a657d26057b1a27017ba46bbf336f1698)                                                                                                                                                                                                                                                                                                                                                    | [`EBW8`](../../../doxygen_cpp/structeVision_1_1EBW8.html) [<sub>.NET</sub>](../../../doxygen_cs/structeVision_1_1EBW8.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EBW8.html)                                  | n.a.                                                                |

#### NOTE
The object perimeter in pixels can be measured indirectly by tracing the object contour with contouring methods and counting the pixels.

<a id="easyobject-objects-ellipse-of-inertia"></a>

### Moments and Ellipse of Inertia

![image](assets/images/easyobject/feature_ellipse_of_inertia.webp)

| Feature                                                                  | Method                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Data type   | [Frame of reference](#easyobject-objects-features-frame)   |
|--------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|---------------------------------------------------------------------|
| Eccentricity of the ellipse of inertia                                   | [`GetEccentricity`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ad3c2c7243fee40b6a3eae4bc0d5d1258) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a892e032c4ee6e94de57fbe53ac6c3e4c) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a308f14fe10ab638e78159f13f1d8774d)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `float`     | frame                                                               |
| Moments                                                                  | [`GetCentralMoment`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a6ed90230e7a30d87e43b930963982223) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#aa7282efda88a910eb349be7419c36316) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a0ee0dcf6a38702195ecd607f8159899e)<br /><br/>\\\\<br/>[`GetMoment`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a04e3a404c44427098c8dfee65e18d8d9) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a34888bacbbdfa525e519a64a7390ee24) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ab3aad539475c8f4e83af5e27005a639b)<br /><br/>\\\\<br/>[`GetNormalizedCentralMoment`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5fb4ae99b281280f879b2426abd0f6f2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a1516853b4590578beb54d89c3883d771) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ad34a059967ca678e32b1e692c01b101b)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `float`     | frame                                                               |
| Ellipse<br /><br/>\\\\<br/>(angle, height, width)                        | [`GetEllipseAngle`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a56017d9ff7f410cc6162376f1d9f8f2d) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ae08b3ece5c1b171091e0964ea47b13d4) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#abebe3d23bf1c93ca1f56115e2206eb1c)<br /><br/>\\\\<br/>[`GetEllipseHeight`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a07e2817a009bc3edef75a6c0da432d13) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a6db257ed4624e24075aec092805ac28c) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#aa9a42579ecdc9fce128c8bd998a3eb08)<br /><br/>\\\\<br/>[`GetEllipseWidth`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ae154db2506e7637071b887ec0916a2ea) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a91d2f20ddb2b5a657288cb4366d4fb04) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ab9fa2a41c2e2a9fd6e38d485e1419190)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | `float`     | frame                                                               |
| Centered moments of inertia<br /><br/>\\\\<br/>(Sigma: X, XX, XY, Y, YY) | [`GetSigmaX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a66e2f34bcdc561b08cd8711b3c19b972) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a69fd4fc624bbd0cde11561385f31b0c5) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a08cf7edf6892324bc4be197ba0c3e3a1)<br /><br/>\\\\<br/>[`GetSigmaXX`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a6087a6502d0f8588e167dbb3fa377ecb) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a4a94c15d6d2ab258ad92958fc88312bc) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a78fa30501e0f5fc0d1c92de2a7063834)<br /><br/>\\\\<br/>[`GetSigmaXY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a4d6e99ce8e7ea9eb449767873f077a3b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#af6bca4634d8b1e4cbe4cb65e4f38f820) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ae368b7c366019cc7710305016dd89477)<br /><br/>\\\\<br/>[`GetSigmaY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a1d3f15619caf80308ec349601a999ec6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ac99c21cb11e989c154b4f1ef47811c97) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a6238fc9129cd38eba8384823a3150aa6)<br /><br/>\\\\<br/>[`GetSigmaYY`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a985050f11f9e1e66548b84d271010804) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#ae53e4deb8c74b8edf2a1c8358f6ee292) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a40a960d7f1bc9b34962bc847460d289e) | `float`     | frame                                                               |

Given $N$ is the number of pixels of the blob, $x_i$ and $y_i$ the x and y coordinates of the $i$-th pixel of the blob, expressed in the frame of reference used to encode the image, the [`raw moment`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a04e3a404c44427098c8dfee65e18d8d9) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a34888bacbbdfa525e519a64a7390ee24) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ab3aad539475c8f4e83af5e27005a639b) of order $(p, q)$ is:

$$
 M_{pq} = \sum_{i=1}^N x_i^p y_i^q. 
$$

The [`central moment`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a6ed90230e7a30d87e43b930963982223) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#aa7282efda88a910eb349be7419c36316) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a0ee0dcf6a38702195ecd607f8159899e) of order $(p, q)$ is:

$$
 \mu_{pq} = \sum_{i=1}^N (x_i - \bar{x})^p (y_i - \bar{y})^q. 
$$

where $\bar{x}$ and $\bar{y}$ are the averages of all the $x_i$ and $y_i$.

The [`normalized central moment`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#a5fb4ae99b281280f879b2426abd0f6f2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a1516853b4590578beb54d89c3883d771) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#ad34a059967ca678e32b1e692c01b101b) of order $(p, q)$ is:

$$
 \eta_{pq} = \frac{\mu_{pq}}{\mu_{00}^{1+\frac{p+q}{2}}}. 
$$

The centered moments of inertia $\sigma_x$, $\sigma_y$, and $\sigma_{xy}$ are defined as:

$$
 \sigma_x = \frac{\mu_{02}}{N} = \frac{1}{N} \sum_{i=1}^N (y_i - \bar{y})^2 
$$

$$
 \sigma_y = \frac{\mu_{20}}{N} = \frac{1}{N} \sum_{i=1}^N (x_i - \bar{x})^2
$$

$$
 \sigma_{xy} = \frac{\mu_{11}}{N} =  \frac{1}{N} \sum_{i=1}^N (x_i - \bar{x}) (y_i - \bar{y}) 
$$

They can be grouped into the tensor of inertia:

$$

\left( \begin{array}{cc}
\sigma_x & \sigma_{xy} \\
\sigma_{xy} & \sigma_y
\end{array}\right).
$$

$\sigma_{xx}$ and $\sigma_{yy}$ are the largest and smallest eigenvalues of this matrix and are also called the first and second centered principal axis of inertia:

$$
 \sigma_{xx} = \frac{\sigma_x + \sigma_y}{2} + \frac{\sqrt{4\sigma_{xy}^2 + (\sigma_x - \sigma_y)^2}}{2} 
$$

$$
 \sigma_{yy} = \frac{\sigma_x + \sigma_y}{2} - \frac{\sqrt{4\sigma_{xy}^2 + (\sigma_x - \sigma_y)^2}}{2}. 
$$

The width ($w$), height ($h$), and angle ($\theta$) of the ellipse of inertia are:

$$
 w = 4 \sqrt{\sigma_{xx}} 
$$

$$
 h = 4 \sqrt{\sigma_{yy}} 
$$

$$
 \theta =  \frac{1}{2}\arctan\left( \frac{2 \sigma_{xy}}{\sigma_x - \sigma_y} \right).
$$

The eccentricity, or object elongation, is:

$$
 \sqrt{1 - \frac{\sigma_{yy}}{\sigma_{xx}}}. 
$$

#### NOTE
The moments of inertia $\sigma_x$, $\sigma_y$, and $\sigma_{xy}$ are also commonly noted as $I_x$, $I_y$, and $I_{xy}$.

The moments of inertia around the X or Y axis are also the variance of the Y and X coordinates of the blobs respectively.

<a id="easyobject-objects-convex-hull"></a>

### Convex Hull

The [`convex hull`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#ae0c61291f53047a6a8d7edbc449e9651) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#a94454ee1877dadde8758e07bf06d7d5e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#aab3c03a55d3a9567051196eef0e0ee10) hull of a shape is the convex polygon of minimum area that completely surrounds an object. The convex hull can be used to characterize the object footprint, as well as to observe concavities.

Given that the number of vertices of the convex hull is variable, they are stored in a [`EPathVector`](../../../doxygen_cpp/classeVision_1_1EPathVector.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EPathVector.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EPathVector.html) container.

The convex hull is computed in pixel coordinates.

![image](assets/images/easyobject/feature_convex_hull.webp)

<a id="easyobject-objects-drawing"></a>

## Graphic Representation

The objects can be drawn onto the source image by means of [`ECodedImage2::Draw`](../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a5d7c466c4a883bb60de710d3fba8a018) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedImage2.html#afbd310e1a51562e3cf5f1c7801bdd049) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedImage2.html#a0a9c71274421f2dd5b10cc0cf4980a18). The following features also have a graphical representation that can be drawn by the means of [`ECodedImage2::DrawFeature`](../../../doxygen_cpp/classeVision_1_1ECodedImage2.html#a34dc05727d86c6f245c626ac38547208) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedImage2.html#a8a0315bf562262a9242d2da02d06c77c) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedImage2.html#a1840ecc38ea367b3568df40f2c8fb016).

#### Drawable features and their default appearance.

| Objects                        | Graphic                                      |
|--------------------------------|----------------------------------------------|
| Bounding box                   | ![image](assets/images/easyobject/90005.jpg) |
| Contour                        | ![image](assets/images/easyobject/90006.jpg) |
| Convex hull                    | ![image](assets/images/easyobject/90007.jpg) |
| Ellipse                        | ![image](assets/images/easyobject/90008.jpg) |
| Feret box                      | ![image](assets/images/easyobject/90009.jpg) |
| Feret box with an angle of 22° | ![image](assets/images/easyobject/90010.jpg) |
| Feret box with an angle of 45° | ![image](assets/images/easyobject/90011.jpg) |
| Feret box with an angle of 68° | ![image](assets/images/easyobject/90012.jpg) |
| Gravity center                 | ![image](assets/images/easyobject/90013.jpg) |
| Minimum enclosing rectangle    | ![image](assets/images/easyobject/90014.jpg) |
| Weighted gravity center        | ![image](assets/images/easyobject/90015.jpg) |

<a id="easyobject-objects-runs"></a>

## Runs

For the sake of computational efficiency, the objects are described as lists of runs. A run is a sequence of adjacent pixels that share homogeneous properties (such as being above a given threshold). These runs are merged in objects by the image encoder.

![image](assets/images/easyobject/runs.webp)

**EasyObject** can work at object level, and at run level which allows faster processing in critical cases. This is useful to compute custom features on objects then list all runs belonging to a given object. Use  [`ECodedElement::GetRunsIterator`](../../../doxygen_cpp/classeVision_1_1ECodedElement.html#abcd74e3a67216e9fd6185105142eafc3) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1ECodedElement.html#aab4c60052747c42d74eb43c82be936ff) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1ECodedElement.html#a588d46b3c4b6c7425a017e92a5452d5c) to get an [`EObjectRunsIterator`](../../../doxygen_cpp/classeVision_1_1EObjectRunsIterator.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EObjectRunsIterator.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EObjectRunsIterator.html) iterator object.

#### SEE ALSO
See the [code snippets](../../../resources/code_snippets/matching_and_measurement/easyobject/objectruniterator.html.md) showing how to loop over the runs of an object.
