Guest User

Untitled

a guest
Feb 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import gab.opencv.*;
  2. import java.awt.Rectangle;
  3.  
  4. OpenCV opencv;
  5. Rectangle[] faces;
  6.  
  7. void setup() {
  8. opencv = new OpenCV(this, "test.jpg");
  9. size(1080, 720);
  10.  
  11. opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
  12. faces = opencv.detect();
  13. }
  14.  
  15. void draw() {
  16. image(opencv.getInput(), 0, 0);
  17.  
  18. noFill();
  19. stroke(0, 255, 0);
  20. strokeWeight(3);
  21. for (int i = 0; i < faces.length; i++) {
  22. rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
  23. }
  24. }
Add Comment
Please, Sign In to add comment