GithubHelp home page GithubHelp logo

Face recognition confidence about jsfeat HOT 4 CLOSED

inspirit avatar inspirit commented on May 20, 2024
Face recognition confidence

from jsfeat.

Comments (4)

inspirit avatar inspirit commented on May 20, 2024

you are getting an array of rectangles with some properties that allow you to decide if face is good enough to further processing.
you can also look at the demo here:
https://github.com/inspirit/jsfeat/blob/gh-pages/sample_haar_face.html

from jsfeat.

45kb avatar 45kb commented on May 20, 2024

@inspirit Hi, thank you for the support, i am actually in trouble cause the code seems ok but rects.length is always 0 i debugged but it seems i am missing something, any clue please?

  var canvas = $window.document.getElementById('canvas')
  , canvasWidth = canvas.width
  , canvasHeight = canvas.height
  , ctx = canvas.getContext('2d')
  , work_canvas = $window.document.createElement('canvas')
  , work_ctx = work_canvas.getContext('2d')
  , ii_sum = new Int32Array((canvasWidth+1)*(canvasHeight+1))
  , ii_sqsum = new Int32Array((canvasWidth+1)*(canvasHeight+1))
  , ii_tilted = new Int32Array((canvasWidth+1)*(canvasHeight+1))
  , img_u8 = new jsfeat.matrix_t(canvasWidth, canvasHeight, jsfeat.U8_t | jsfeat.C1_t)
  , classifier = jsfeat.haar.frontalface
  , imageData
  , rects;

  work_canvas.width = canvasWidth;
  work_canvas.height = canvasHeight;
  jsfeat.haar.edges_density = 0.13;

  work_ctx.drawImage(canvas, 0, 0);
  imageData = work_ctx.getImageData(0, 0, work_canvas.width, work_canvas.height);


  var anim = function () {

    jsfeat.imgproc.grayscale(imageData.data, work_canvas.width, work_canvas.height, img_u8);
    jsfeat.imgproc.equalize_histogram(img_u8, img_u8);
    jsfeat.imgproc.compute_integral_image(img_u8, ii_sum, ii_sqsum, classifier.tilted ? ii_tilted : null);

    rects = jsfeat.haar.detect_multi_scale(ii_sum,
     ii_sqsum,
     ii_tilted,
     null,
     img_u8.cols,
     img_u8.rows,
     classifier,
     1.15,
     2);

    rects = jsfeat.haar.group_rectangles(rects, 1);

    if (rects && rects.length === 0) {

      $window.requestAnimationFrame(anim);
    } else {

      console.log(rects);
    }
  }

  anim();

from jsfeat.

45kb avatar 45kb commented on May 20, 2024

Sorry, it's my mistake, it works, i was using a wrong version of jsfeat i guess, sorry again :)

from jsfeat.

inspirit avatar inspirit commented on May 20, 2024

Congratulations! 👍

from jsfeat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.