# Amante-Fonseca

## Proposal of fuzzy sets

Nine categories are defined: red, brown, orange, yellow, green, cyan, blue, purple and pink. By default, each of the classes is represented by the following colour:

| Colour label | Index |    RGB value    | HEX value |
| ------------ | :---: | :-------------: | :-------: |
| Red          |   0   |  \[255, 33, 36] |  #FF2125  |
| Brown        |   1   | \[170, 121, 66] |  #AA7942  |
| Orange       |   2   |  \[255, 146, 0] |  #FF9200  |
| Yellow       |   3   |  \[255, 251, 0] |  #FFFB00  |
| Green        |   4   |   \[0, 255, 0]  |  #00FF00  |
| Cyan         |   5   |  \[0, 253, 255] |  #00FFFF  |
| Blue         |   6   |   \[0, 0, 255]  |  #0000FF  |
| Purple       |   7   | \[147, 33, 146] |  #932191  |
| Pink         |   9   | \[255, 64, 255] |  #FF40FF  |

{% hint style="info" %}
The colour associated with each label can be changed when calling the function that performs the segmentation. By default, they are the colours shown in the table above.
{% endhint %}

{% hint style="danger" %}
The indices of the colours must be positive integers. Negative integers are reserved for the internal calculation of the methods.
{% endhint %}

## Partition of the chromatic space

The H channel, whose values must be in range $$\[0, 360]$$, is partitioned using trapezoidal membership functions. For the sake of clarity, the parameters $$a$$, $$b$$, $$m$$, $$n$$ which uniquely determine the expression of the membership function are given. For more information, see section [Fuzzy Logic-based methods](https://mmunar97.gitbook.io/colour-segmentation/whats-behind/fuzzy-logic-based-methods/..#the-background-framework-fuzzy-logic-and-fuzzy-sets).

| Colour label | $$a$$ | $$b$$ | $$m$$ | $$n$$ |
| ------------ | :---: | :---: | :---: | :---: |
| Red          |  335  |   20  |  350  |   10  |
| Brown        |   10  |   35  |   20  |   30  |
| Orange       |   30  |   50  |   34  |   42  |
| Yellow       |   44  |  100  |   50  |   70  |
| Green        |   70  |  160  |  100  |  140  |
| Cyan         |  140  |  220  |  160  |  200  |
| Blue         |  200  |  290  |  220  |  260  |
| Purple       |  260  |  320  |  290  |  310  |
| Pink         |  310  |  350  |  315  |  335  |

{% hint style="warning" %}
In the definition of the red colour, it can be seen that it is not verified that $$a\<m\<n\<b$$. This is because the chromatic component H of the HSV colour space is circular, and the red colour is the one located on the boundary.
{% endhint %}

## Classification of achromatic colours

The study of Amante *et al.* proposes the classification of achromatic colours. This is because, depending on the values of the V and S channels, the colour can be more or less saturated. In this case, the achromatic colours are black, grey and white. For this classification, the S and V channels must be in range $$\[0, 1]$$. If $$p=(h,s,v)$$is an HSV-encoded pixel, the criterion is as follows:

* If $$v \leq V\_1$$, pixel is classified as black. Black colour is represented by index -1.
* If $$v>V\_2$$ and $$s\leq S\_1$$, pixel is classified as white. White colour is represented by index -2.
* If $$V\_1 < v \leq V\_2$$ and $$s\leq S\_1$$, pixel is classified as gray. Gray colour is represented by index -3.

The thresholds that appear have been experimentally fixed by Amante *et al.*, and they are $$V\_1=0.19$$, $$V\_2=0.81$$ and $$S\_1=0.14$$.

## References

> **Amante, José; Fonseca, Manuel J..** (2012). *Fuzzy Color Space Segmentation to Identify the Same Dominant Colors as Users*. Proceedings: DMS 2012 - 18th International Conference on Distributed Multimedia Systems. 48-53.
