# How to delete wavy effect on this code

**URL:** <https://discourse.processing.org/t/how-to-delete-wavy-effect-on-this-code/39292>\
**Category:** Libraries\
**Created:** [October 16, 2022, 9:25am UTC](https://discourse.processing.org/t/how-to-delete-wavy-effect-on-this-code/39292 "2022-10-16T09:25:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pushhand](https://avatars.discourse-cdn.com/v4/letter/p/4da419/32.png) [@pushhand](https://discourse.processing.org/u/pushhand)\
**Post date:** [October 16, 2022, 9:25am UTC](https://discourse.processing.org/t/how-to-delete-wavy-effect-on-this-code/39292/1 "2022-10-16T09:25:02Z")

</div>

/\*\*

- Time Displacement
- by David Muth
- 
- Keeps a buffer of video frames in memory and displays pixel rows
- taken from consecutive frames distributed over the y-axis  
\*/

import processing.video.\*;

Capture video;  
int signal = 0;

//the buffer for storing video frames  
ArrayList frames = new ArrayList();

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

// This the default video input, see the GettingStartedCapture  
// example if it creates an error  
video = new Capture(this, width, height);

// Start capturing the images from the camera  
video.start();  
}

void captureEvent(Capture camera) {  
camera.read();

// Copy the current video frame into an image, so it can be stored in the buffer  
PImage img = createImage(width, height, RGB);  
video.loadPixels();  
arrayCopy(video.pixels, img.pixels);

frames.add(img);

// Once there are enough frames, remove the oldest one when adding a new one  
if (frames.size() \> height/4) {  
frames.remove(0);  
}  
}

void draw() {  
// Set the image counter to 0  
int currentImage = 0;

loadPixels();

// Begin a loop for displaying pixel rows of 4 pixels height  
for (int y = 0; y \< video.height; y+=4) {  
// Go through the frame buffer and pick an image, starting with the oldest one  
if (currentImage \< frames.size()) {  
PImage img = (PImage)frames.get(currentImage);

```
  if (img != null) {
    img.loadPixels();
    
    // Put 4 rows of pixels on the screen
    for (int x = 0; x < video.width; x++) {
      pixels[x + y * width] = img.pixels[x + y * video.width];
      pixels[x + (y + 1) * width] = img.pixels[x + (y + 1) * video.width];
      pixels[x + (y + 2) * width] = img.pixels[x + (y + 2) * video.width];
      pixels[x + (y + 3) * width] = img.pixels[x + (y + 3) * video.width];
    }  
  }
  
  // Increase the image counter
  currentImage++;
   
} else {
  break;
}

```

}

updatePixels();

// For recording an image sequence  
//saveFrame(“frame-####.jpg”);  
}

This code is example from processing, and I want to delete wave effect. However, to show a few seconds before scene, does this effect is necessary?

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [October 16, 2022, 11:05am UTC](https://discourse.processing.org/t/how-to-delete-wavy-effect-on-this-code/39292/2 "2022-10-16T11:05:41Z")

</div>

Hi @pushhand,

Can you please format your code by using the `</>` button when editing your message or surround your code with backticks like so ``` code ``` → `code`?

> [@pushhand](#):
>
> I want to delete wave effect

Try to understand how the code works. If you are not familiar with pixel processing and images/video, follow the tutorials on the Processing website:

> **[Images and Pixels](https://processing.org/tutorials/pixels/)**
>
> How to load and display images as well as access their pixels.

Once you understand how it works, you will be able to see where the wave effect occurs and adapt it to your needs but it’s not as simple as “remove X from this code” 😉
