Skip to content

Color Detection

Module Description

The Color Detection Module identifies and extracts dominant colors from an image based on the proportion of pixels they occupy — the larger the area covered by a color, the higher its significance. The module can extract between one and five colors per image. For each detected color, it provides the corresponding RGB value, HEX code, and the percentage of the image that the color represents.

Module ID: color_detection

Module Parameters

Name Type Default Description
colors number 3 Specifies how many dominant colors the system should extract per image or per video second. You can choose between one and five colors, depending on the level of detail you need.

Example

Send the following JSON as request body via POST to the /jobs/ endpoint:

{
  "sources": [
    "{url-to-your-video}"
  ],
  "modules": {
    "color_detection": {
      "colors": 3
    }
  }
}

In order to get the results you can request the /jobs/{JOB_ID}/detailed-results/ endpoint, the response looks like this:

{
  "limit": 100,
  "next": null,
  "offset": 0,
  "prev": null,
  "total": 35,
  "data": [
    {
      "detections": [],
      "frame_end": 0,
      "frame_start": 0,
      "id": "a70b03f2-e977-458f-a6bf-31ff4eb82b63",
      "media_type": "video",
      "meta": {
        "colors": [
          {
            "hex": "#d2c3b1",
            "proportion": 0.56,
            "rgb": [
              210,
              195,
              177
            ]
          },
          {
            "hex": "#33302f",
            "proportion": 0.27,
            "rgb": [
              51,
              48,
              47
            ]
          },
          {
            "hex": "#887b64",
            "proportion": 0.17,
            "rgb": [
              136,
              123,
              100
            ]
          }
        ],
        "indexed_identity": null
      },
      "module": "color_detection",
      "source": "storage://VSY8ihIGhR5qehVjWEWC",
      "tc_end": "00:00:00:00",
      "tc_start": "00:00:00:00",
      "thumbnail": null,
      "time_end": 0,
      "time_start": 0
    },
    {
      "detections": [],
      "frame_end": 30,
      "frame_start": 30,
      "id": "450080c7-247d-4bcc-b3fc-c356a1d31279",
      "media_type": "video",
      "meta": {
        "colors": [
          {
            "hex": "#d3c3b0",
            "proportion": 0.57,
            "rgb": [
              211,
              195,
              176
            ]
          },
          {
            "hex": "#34312f",
            "proportion": 0.26,
            "rgb": [
              52,
              49,
              47
            ]
          },
          {
            "hex": "#877a63",
            "proportion": 0.16,
            "rgb": [
              135,
              122,
              99
            ]
          }
        ],
        "indexed_identity": null
      },
      "module": "color_detection",
      "source": "storage://VSY8ihIGhR5qehVjWEWC",
      "tc_end": "00:00:01:00",
      "tc_start": "00:00:01:00",
      "thumbnail": null,
      "time_end": 1,
      "time_start": 1
    },
    ...
  ]
}