# Feedback examples

**URL:** <https://discourse.processing.org/t/feedback-examples/32843>\
**Category:** Project Guidance\
**Created:** [October 15, 2021, 5:07am UTC](https://discourse.processing.org/t/feedback-examples/32843 "2021-10-15T05:07:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcabc](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bcabc](https://discourse.processing.org/u/bcabc)\
**Post date:** [October 15, 2021, 5:07am UTC](https://discourse.processing.org/t/feedback-examples/32843/1 "2021-10-15T05:07:04Z")

</div>

Hi there -

I’m interested in experimenting a bit with feedback in Processing. Is Processing good for video feedback?  
I haven’t seen any examples and it’s been tough to figure out how to approach it. I’m curious if I’m missing a resource that people here might know about.

Thanks!

---

<div class="post-metadata">

**Author:** ![philipplehmann](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/philipplehmann/32/4111_2.png) [@philipplehmann](https://discourse.processing.org/u/philipplehmann)\
**Post date:** [October 15, 2021, 9:08am UTC](https://discourse.processing.org/t/feedback-examples/32843/2 "2021-10-15T09:08:21Z")

</div>

Can you explain a little bit more, what you are trying to achieve?

There is a Video Library, and you can of course try pointing the recording camera at your screen to generate feedback.

> **[Video / Libraries](https://processing.org/reference/libraries/video/index.html)**
>
> Read images from a camera, play movie files, and create movies.

If you like to record your own sketch and generate feedback from that, you could get the pixels and place them as new image on top. Experiment with the scaling, position and BlendMode to create more interesting effect. Here is an example for this:

```auto
// From https://processing.org/reference/libraries/video/Capture.html
import processing.video.*;

Capture cam;

void setup() {
  size(480, 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]);
    }
    
    // The camera can be initialized directly using an 
    // element from the array returned by list():
    cam = new Capture(this, cameras[0]);
    cam.start();     
  }   
}

void draw() {

  // Get the current display of the sketch
  PImage c = get();

  // Capture camera frame
  if (cam.available() == true) {
    cam.read();
  }

  // Display the camera frame
  image(cam, 0, 0);

  // Display a smaller previous frame
  image(c, 20, 20, width - 40, height - 40);
}

```

![2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/421ed2c207a45ef5f4483faeec73a66756a62ceb.gif)

---

<div class="post-metadata">

**Author:** ![bcabc](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bcabc](https://discourse.processing.org/u/bcabc)\
**Post date:** [October 16, 2021, 6:55am UTC](https://discourse.processing.org/t/feedback-examples/32843/3 "2021-10-16T06:55:00Z")

</div>

Hi Phillip-

Thank you for the example…I think I’m looking for a similar effect, except without having to use an external camera. Is there a way to do that?

---

<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:** [October 17, 2021, 3:24pm UTC](https://discourse.processing.org/t/feedback-examples/32843/4 "2021-10-17T15:24:49Z")

</div>

Hello,

[https://en.wikipedia.org/wiki/Feedback](https://en.wikipedia.org/wiki/Feedback)

> **Feedback** occurs when outputs of a system are routed back as inputs as part of a [chain](https://en.wikipedia.org/wiki/Signal_chain_(signal_processing_chain)) of [cause-and-effect](https://en.wikipedia.org/wiki/Causality) that forms a circuit or loop.

This is a p5.js example:

> [@Alternative to get() for faster performance?](https://discourse.processing.org/t/alternative-to-get-for-faster-performance/30228/8):
>
> Hello, This topic inspired me! Something I worked on: 
> 
> > **Example of random tiling \< Click here to see code!**
> >
> > // Pixel Manipulation // v1.0.0 // GLV 2021-05-30 let img; let cap; function setup() { createCanvas(640, 480); // Set to video size img = createGraphics(width, height); pixelDensity(1); img.pixelDensity(1); cap = createCapture(VIDEO); cap.hide(); //d = pixelDensity(); // Future! See references. } function draw() { cap.loadPixels(); img.loadPi…

You can use it with the p5.js editor:  
[https://editor.p5js.org/](https://editor.p5js.org/)

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a392c81619141f73f9afbc8c6948ac91498f1bb0.jpeg)

This can be done in Processing as well.

`:)`

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [October 17, 2021, 5:12pm UTC](https://discourse.processing.org/t/feedback-examples/32843/5 "2021-10-17T17:12:56Z")

</div>

As others already mentioned, `get` would be the easiest way both in Processing and in p5.js.

If you want to dig deeper, shader _ping-pong_ is the way to go - Raph made some nice examples in the past (not sure if it’s P4 compatible)

> **[Processing-Experiments/2013/Shaders/PingPongFBO at master ·...](https://github.com/SableRaf/Processing-Experiments/tree/master/2013/Shaders/PingPongFBO)**
>
> master/2013/Shaders/PingPongFBO
