Coder Social home page Coder Social logo

eye detection example about js-objectdetect HOT 9 CLOSED

mtschirs avatar mtschirs commented on August 16, 2024
eye detection example

from js-objectdetect.

Comments (9)

mtschirs avatar mtschirs commented on August 16, 2024

It can be done, but not yet with the jQuery plugin. I think that adding an option called "selection" that allows to restrict the search window might be the answer to your question - what do you think?

from js-objectdetect.

marcomoscardini avatar marcomoscardini commented on August 16, 2024

absolutely, I have tried to run it on a standalone image, but it can not working on multiple faces with in the same source image. I just nested the detection of the face, and run a eye detect on the whole image/video and I get wrong data when connected to a video... but I will try again today ( it works with static images).
as I said: performance on the second stage object detection has to work on a ROI and not on the whole image... that way performance is improved and I can detect eyes within a face and not only with in whole image.
I was thinking to copy the face in a canvas and make the eye-detector work on the copied portion of the image... but I am too novice to do it... I need to research it further. I am not too sure performance wise it would be good, but functionally, I would get what I need, just as you proposed a selection to work with.

thisis what I managed to get working so far, but as I said it works only on whole images

<title>Image Example</title>
<script src="js/objectdetect.js"></script>
<script src="js/objectdetect.frontalface.js"></script>
<script src="js/objectdetect.eye.js"></script>  

<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script src="js/jquery.objectdetect.js"></script>

<script>
$(window).load(function() {
    $("#face").objectdetect("all", { classifier: objectdetect.frontalface }, function(face) {
        $("<div />", {
            "css": {
                "border":   "2px solid #00FF00",
                "position": "absolute",
                "left":     ($("#face").offset().left + face[0][0]) + "px",
                "top":      ($("#face").offset().top  + face[0][1]) + "px",
                "width":    face[0][2] + "px",
                "height":   face[0][3] + "px"
            }
        }).appendTo("body");

        //detect_eyes
        $("#face").objectdetect("all", {classifier: objectdetect.eye}, function(eyes) {
            $("<div />", {
                "css": {
                    "border":   "2px solid #F00",
                    "position": "absolute",
                    "left":     ($("#face").offset().left + eyes[0][0]) + "px",
                    "top":      ($("#face").offset().top  + eyes[0][1]) + "px",
                    "width":    eyes[0][2] + "px",
                    "height":   eyes[0][3] + "px"
                }
            }).appendTo("body");
            $("<div />", {
                "css": {
                    "border":   "2px solid #F00",
                    "position": "absolute",
                    "left":     ($("#face").offset().left + eyes[1][0]) + "px",
                    "top":      ($("#face").offset().top  + eyes[1][1]) + "px",
                    "width":    eyes[1][2] + "px",
                    "height":   eyes[1][3] + "px"
                }
            }).appendTo("body");            
        });

    });
});

</script>

Image

from js-objectdetect.

mtschirs avatar mtschirs commented on August 16, 2024

This weekend I added the possibility to specify a ROI / selection using the jQuery plugin:

$("#face").objectdetect("all", {classifier: objectdetect.frontalface}, function(faces) {
  for (var i = 0; i < faces.length; ++i) {
    $(this).highlight(faces[i], "red");

    $(this).objectdetect("all", {classifier: objectdetect.eye, selection: faces[i]}, function(eyes) {
      for (var j = 0; j < eyes.length; ++j) {
        $(this).highlight(eyes[j], "blue");
      }
    });
  }
});

For a complete example, have a look at https://github.com/mtschirs/js-objectdetect/blob/master/examples/example_image.htm

from js-objectdetect.

marcomoscardini avatar marcomoscardini commented on August 16, 2024

impressive, but fails on chrome and firefox, tested on opera works well

from js-objectdetect.

marcomoscardini avatar marcomoscardini commented on August 16, 2024

sorry, fails only on chrome due to a dom security issue
tested on fx and opera 12 works

from js-objectdetect.

mtschirs avatar mtschirs commented on August 16, 2024

When running the examples from your local system and not via webserver, Chrome needs to be started with the --allow-file-access-from-files flag. Or try http://mtschirs.github.com/js-objectdetect/examples/example_image.htm instead.

from js-objectdetect.

samjones avatar samjones commented on August 16, 2024

Does this code for ROI/selection by mtschris works on video?

from js-objectdetect.

marcomoscardini avatar marcomoscardini commented on August 16, 2024

I dont see why not, it works on a canvas after all

On Sat, 2013-03-23 at 02:22 -0700, samjones wrote:

Does this code for ROI/selection by mtschris works on video?


Reply to this email directly or view it on GitHub.

from js-objectdetect.

krsoninikhil avatar krsoninikhil commented on August 16, 2024

It can be done, but not yet with the jQuery plugin. I think that adding an option called "selection" that allows to restrict the search window might be the answer to your question.

Is there any such option of providing 'selection' in js (without jquery)?
Also I can't find any reference to the functions used in example, any links on that will be very helpful.

from js-objectdetect.

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.