# Need Help to develop this code

**URL:** <https://discourse.processing.org/t/need-help-to-develop-this-code/14154>\
**Category:** Libraries\
**Created:** [September 23, 2019, 11:07pm UTC](https://discourse.processing.org/t/need-help-to-develop-this-code/14154 "2019-09-23T23:07:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![royal96](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@royal96](https://discourse.processing.org/u/royal96)\
**Post date:** [September 23, 2019, 11:07pm UTC](https://discourse.processing.org/t/need-help-to-develop-this-code/14154/1 "2019-09-23T23:07:56Z")

</div>

Hi Everyone  
i need a help in this code

```auto
import processing.video.*;

Capture video;
int videoCount;
int currentAngle;
int pixelCount;
int angleCount = 200; // how many divisions

int radii[];
int angles[];
int movementSum = 0;

void setup() {
  // size must be set to video.width*video.height*2 in both directions
  size(600, 600); 

  // This the default video input, see the GettingStartedCapture 
  // example if it creates an error
  video = new Capture(this, 160, 120);
  
  // Start capturing the images from the camera
  video.start();  
  
  videoCount = video.width * video.height;

  pixelCount = width*height;
  int centerX = width / 2;
  int centerY = height / 2;
  radii = new int[pixelCount];
  angles = new int[pixelCount];

  int offset = 0;
  for (int y = 0; y < height; y++) {
    for (int x = 0; x < width; x++) {
      int dx = centerX - x;
      int dy = centerY - y;

      float angle = atan2(dy, dx);
      if (angle < 0) angle += TWO_PI;
      angles[offset] = (int) (angleCount * (angle / TWO_PI));

      int radius = (int) mag(dx, dy);
      if (radius >= videoCount) {
        radius = -1;
        angles[offset] = -1;
      }
      radii[offset] = radius;
      
      offset++;
    }
  }
  background(0);
}

void draw() {
  if (video.available()) {
    video.read();
    video.loadPixels();
  
    loadPixels();
    for (int i = 0; i < pixelCount; i++) {
      if (angles[i] == currentAngle) {
        pixels[i] = video.pixels[radii[i]];
      }
    }
     
    updatePixels();
    
    currentAngle++;
    if (currentAngle == angleCount) {
      currentAngle = 0;
      //saveFrame("royal-######.tif");
    }
  }
}

```

, that opens the camera and  
the code capture faces or anything in front of the camera and dont put it in single line of pixels along a circle, i need littel bit the face appear and radial continue,

if possible also i want function to save the video .

Thank you for everyone who try to help me ☹

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [September 26, 2019, 2:43am UTC](https://discourse.processing.org/t/need-help-to-develop-this-code/14154/2 "2019-09-26T02:43:34Z")

</div>

> [@royal96](#):
>
> if possible also i want function to save the video

Here is a Coding Train tutorial on saving video of a Processing sketch – one approach is by saving a frames, then making a video out of them.

[![](https://img.youtube.com/vi/G2hI9XL6oyk/maxresdefault.jpg "Tutorial: How to render Processing sketch as a movie") ](https://www.youtube.com/watch?v=G2hI9XL6oyk)

---

<div class="post-metadata">

**Author:** ![royal96](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@royal96](https://discourse.processing.org/u/royal96)\
**Post date:** [September 26, 2019, 2:20pm UTC](https://discourse.processing.org/t/need-help-to-develop-this-code/14154/3 "2019-09-26T14:20:33Z")

</div>

Thanks a lot , for heiping me (flower)
