Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. FaceDetector faceDetector = new
  2. FaceDetector.Builder(getApplicationContext()).setTrackingEnabled(true)
  3. .build();
  4. if(!faceDetector.isOperational()){
  5. new AlertDialog.Builder(getApplicationContext()).setMessage("Could not set up the face detector!").show();
  6. return;
  7. }
  8.  
  9. Frame frame = new Frame.Builder().setBitmap(photo).build();
  10. faces = faceDetector.detect(frame);
  11. System.out.println("iiii"+faces.get(1));
  12.  
  13.  
  14.  
  15. for(int i=0; i<faces.size(); i++) {
  16. Face thisFace = faces.valueAt(i);
  17. Float x1=new Float(0);
  18. x1 = thisFace.getPosition().x;
  19. float y1 = thisFace.getPosition().y;
  20. float x2 = x1 + thisFace.getWidth();
  21. float y2 = y1 + thisFace.getHeight();
  22.  
  23. //tempCanvas.drawCircle(x1,y1,1,myRectPaint);
  24.  
  25. tempCanvas.drawRoundRect(new RectF(x1, y1, x2, y2), 1, 1, myRectPaint);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement