How can we draw a graphe from a video capture ?!

Hi !!
I want to draw a graph that processes data from a video capture
something like RGB values ​​based on pixel location or brightness based on pixel location …
My project is blocked in this step so i will be so thankful for ur help🙏🏼

you can use the
https://processing.org/reference/loadPixels_.html
https://processing.org/reference/pixels.html

on the image ( not only on the canvas )

but possibly start with a picture first instead with a cam stream

I need to draw a graph with this informations about pixels … this is my problem
Anyway thx a loot ! :slight_smile:

after above 2 steps ( getting the color ‘c’ of all pixels ( in a FOR loop ) over all ( OF THE IMAGE ) )
you can read out from that color red(c ) green(c ) blue(c ) or hue(c ) brightness(c ) saturation(c )
compare it with limits and do statistic on it …
when you have that resulting array of information, you can show your code here
if you need help about doing a graph from it.

can you already give a example how that data you want to graph could look like?


does the PDE examples give you some idea?
PDE / File / Examples / Libraries / Video / Capture /

  • BrightnessTracking
  • HsvSpace

Hello,

If you know the pixel location and have some data (RGB or HSV) you can plot some nice graphs; x, y for pixel location and z for data and then rotate this graph to view it.

https://processing.org/ is a good place to start and has tutorials, references, examples and lists books available.

YouTube:

:slight_smile:

Yeah !
I Need get something like that ( second image ) … image

Thanks a looot !

Otherwise
I need just the code who can get Brightness values for each pixel & draw a graph like : Brightnes values in x axis end pixel’s location in y

did you try already the 2 examples i show you?
that gives you running ready code to start with?

but actually can start from basic example:
GettingStartedCapture

and get like the pixel color of mouse position

/**
 * Getting Started with Capture.
 * 
 * Reading and displaying an image from an attached Capture device. 
 */

import processing.video.*;

Capture cam;
color onepix;

void setup() {
  size(640, 480);
  String[] cameras = Capture.list();
  if (cameras == null) {
    println("Failed to retrieve the list of available cameras, will try the default...");
    cam = new Capture(this, 640, 480);
  } if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } else {
    println("Available cameras:");
    printArray(cameras);

    // The camera can be initialized directly using an element
    // from the array returned by list():
    cam = new Capture(this, cameras[0]); // select according list
    // Or, the settings can be defined based on the text in the list
    //cam = new Capture(this, 640, 480, "Built-in iSight", 30);
    // Start capturing the images from the camera
    cam.start();
  }
}

void draw() {
  if (cam.available() == true) {
    cam.read();
  }
  //image(cam, 0, 0, width, height);
  // The following does the same as the above image() line, but 
  // is faster when just drawing the image without any additional 
  // resizing, transformations, or tint.
  set(0, 0, cam);
  loadPixels();
  for ( int x = 0; x < pixelWidth;x++) {
    for ( int y = 0; y < pixelHeight;y++) {
      color c = pixels[x*y]; // read all
      if ( mouseX == x && mouseY == y ) onepix = c;
    }
  }
  println("x: ", mouseX," y: ", mouseY," brightness: ", brightness(onepix) );
}

thank you very much !
that’s a bit what I’m looking for, I just have to plot these values ​​in a curve

I think that I must neglect the coordinates according to y and trace the brightness according to coordinate x

But i don’t know how :man_shrugging:t2:

Thx again :pray:t3: