facedetection

edited April 30 in Kinect

Hello, would it be possible, to use openCV library to blur the faces or interact with the are of image where the face is in other ways? By default you using face detection i get rectangles around the faces, but could i acces only the pixels inside theese rectangles somehow?

Answers

  • i get rectangles around the faces

    how do you get rectangles? an x and y and a width and height?

    https://processing.org/reference/get_.html

  • edited April 29

    Yes,

      for (int i = 0; i < faces.length; i++) {
        noFill();
        strokeWeight(5);
        stroke(255,0,0);
        //rect(faces[i].x*scl,faces[i].y*scl,faces[i].width*scl,faces[i].height*scl);
        rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
      }
    
  • And did you check the link?

  • yes, but i want to distort the image of the area in different ways. not only fill it for example blur it i can't seem to be able to do that with this function

  • Please don't post duplicates (especially don't call them 'a problem'). Ask any follow up questions here.

  • As for the original problem, you've said you can get the position and size of any faces, so you can now manipulate the image any way you like using that information.

  • edited April 30

    i can't get it to work.

    The script starts, but as soon as it does the manipulation, face detection stops working.

    how can i fix this?

    import gab.opencv.*;
    import processing.video.*;
    import java.awt.*;
    
    Capture video;
    OpenCV opencv;
    
    PImage src;
    
    float roiWidth;
    float roiHeight;
    
    boolean useROI = true;
    
    void setup() {
      video = new Capture(this, 640/2, 480/2);
      src = video;
      opencv = new OpenCV(this, src);
      size(640, 480);
    
      opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  
    
      video.start();
    }
    
    void draw() {
      scale(2);
      opencv.loadImage(src);
    
      Rectangle[] faces = opencv.detect();
      println(faces.length);
    
      for (int i = 0; i < faces.length; i++) {
        opencv.setROI(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
      }
    
      opencv.findCannyEdges(20,75);
      image(opencv.getOutput(), 0, 0);
    }
    
    void captureEvent(Capture c) {
      c.read();
    }
    
  • Thank you, I finally figured out how to achieve what i wanted using the get() function, you stated at the begining

  • is it possible to use for only one of the images in sketch?

       loadPixels();  
     for (int a = 0; a < pixels.length; a++)
    
      }
      }
    
    
      updatePixels(); 
    }
    
Sign In or Register to comment.