# How to DETECT COLORS from CAMERA CAPTURE and OUTPUT them?

**URL:** <https://discourse.processing.org/t/how-to-detect-colors-from-camera-capture-and-output-them/33553>\
**Category:** Libraries\
**Created:** [November 16, 2021, 12:59pm UTC](https://discourse.processing.org/t/how-to-detect-colors-from-camera-capture-and-output-them/33553 "2021-11-16T12:59:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![badbatman](https://avatars.discourse-cdn.com/v4/letter/b/da6949/32.png) [@badbatman](https://discourse.processing.org/u/badbatman)\
**Post date:** [November 16, 2021, 12:59pm UTC](https://discourse.processing.org/t/how-to-detect-colors-from-camera-capture-and-output-them/33553/1 "2021-11-16T12:59:05Z")

</div>

How can I gain the colors from a camera capture and output them in swatches?  
What are the steps to realize this?

Something like this: [https://www.youtube.com/watch?v=EyuqP43jkQ8](https://www.youtube.com/watch?v=EyuqP43jkQ8)

```auto
import processing.video.*;

Capture cam;

void setup() {
  size(640, 480);

  String[] cameras = Capture.list();
  
  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
      println(cameras[i]);
    }
    
    cam = new Capture(this, cameras[0]);
    cam.start();     
  }      
}

void draw() {
  if (cam.available() == true) {
    cam.read();
  }
  image(cam, 0, 0);
}

```

I’m new to processing so any advice is welcome.

Thank you,  
badbatman

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 16, 2021, 1:15pm UTC](https://discourse.processing.org/t/how-to-detect-colors-from-camera-capture-and-output-them/33553/2 "2021-11-16T13:15:15Z")

</div>

Hello,

There are resources here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

This may be of interest:  
[https://processing.org/reference#image](https://processing.org/reference#image)

And look for the tutorial on “Images and Pixels”.

`:)`
