# 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/33550
**Category:** Coding Questions
**Created:** [November 16, 2021, 12:54pm UTC](https://discourse.processing.org/t/how-to-detect-colors-from-camera-capture-and-output-them/33550 "2021-11-16T12:54:02Z")
**Posts on this page:** 1
**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:54pm UTC](https://discourse.processing.org/t/how-to-detect-colors-from-camera-capture-and-output-them/33550/1 "2021-11-16T12:54:02Z")

</div>

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

Something like this: [https://www.youtube.com/watch?v=EyuqP43jkQ8](https://www.youtube.com/watch?v=EyuqP43jkQ8) but then with Processing instead of JS.

```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
