Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import processing.video.*;
  2.  
  3. int videoScale = 10;
  4. int cols , rows;
  5. Capture video;
  6.  
  7. void setup(){
  8. size(640,480);
  9. cols = width / videoScale;
  10. rows = height / videoScale;
  11. video = new Capture ( this , cols ,rows);
  12. video.start();
  13. }
  14.  
  15. void captureEvent(Capture video) {
  16. video.read();
  17. }
  18.  
  19. void draw(){
  20. background(0);
  21. video.loadPixels();
  22. for (int i = 0; i < cols ; i++){
  23. for (int j = 0 ; j < rows; j++) {
  24. int x = i*videoScale;
  25. int y = j*videoScale;
  26. color c = video.pixels[i + j*video.width];
  27. fill(c);
  28. stroke(0);
  29. rect(x , y,videoScale , videoScale);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement