How to DETECT COLORS from CAMERA CAPTURE and OUTPUT them?

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

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

Hello,

There are resources here:

This may be of interest:
https://processing.org/reference#image

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

:)