# Problem with P2D

**URL:** https://discourse.processing.org/t/problem-with-p2d/41096
**Category:** Libraries
**Created:** [February 28, 2023, 7:27pm UTC](https://discourse.processing.org/t/problem-with-p2d/41096 "2023-02-28T19:27:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Omri](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Omri](https://discourse.processing.org/u/Omri)
#### Post date: [February 28, 2023, 7:27pm UTC](https://discourse.processing.org/t/problem-with-p2d/41096/1 "2023-02-28T19:27:58Z")

</div>

I’m doing Shiffman’s algorithm of motion detection, but I want to use P2D.  
I noticed that there are “noise” in my video only when I use P2D, with the normal renderer there isn’t any problem.  
even when I just read pixels from the video and write them again without touching anything there are color noises in the video sometimes.

here is the code for it:

```auto
import processing.video.*;

Capture video;
PImage prev;
void setup() {
  size (640, 480,P2D);
  video = new Capture (this, 640, 480);
  prev=createImage(640, 480, RGB);
  video.start();
}

void captureEvent (Capture video) {
  prev.copy(video, 0, 0, video.width, video.height, 0, 0, prev.width, prev.height);
  prev.updatePixels();
  video.read();
}

void draw() {
  loadPixels();
  prev.loadPixels();
  video.loadPixels();  

  for (int x = 0; x < prev.width; x++) {    
    for (int y = 0; y < prev.height; y++) {      
      int loc = x + y * prev.width;
      color current= video.pixels[loc];
       pixels[loc]=color(current);
    }
  }
  updatePixels();
}

```

what can be the problem?  
thanks 🙂
