File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Mapping eye movements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Mapping eye movements" Watch "Mapping eye movements" New topic

Mapping eye movements

Nacho Hmar

Joined: Oct 01, 2007
Posts: 5
i've been working on a project, aiming to move the mouse cursor with the movement of the eye...capturing images via a web cam.
i've completed the face detection and the eye detection. Can you give me some idea of implementing the mapping of the eye movements onto the mouse cursor or maybe some references?? its done using java.


Knowledge belongs to the world!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

The Java class that can move the mouse pointer around is "java.awt.Robot".

[Jess in Action][AskingGoodQuestions]
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
[Nacho]: i've completed the face detection and the eye detection.

Well, can you find the location of pupils in an image? I would think that one of the most useful things to do would be to detect relative movements of the pupils from image to image. Figuring out the absolute position of everything using trigonometry would be hard (there are many unknowns), but if you can at least detect relative movements, then you can move the cursor up when the pupil moves up, left when the pupil moves left, etc. Then there's a question of how much to move the cursor in response to each movement, but with luck this can be handled with a simple multiplier that you determine through experimentation.

As I think about it though, tracking only relative movement may be limiting and confusing. Some of the time the user may be moving their eyes onto the cursor rather than trying to guide it, which requires a completely different response.

If you have a good enough image, you may benefit from analyzing the shape of the pupils, which should appear as ellipses, depending on where they're pointing. If you can identify the long axis and short axis of each ellipse, you can determine what angle the eye is looking at. Doing this with both eyes you may be able to triangulate and determine a position. My feeling is that most images will not have good enough resolution to do this very accurately, but it's something to try.

I expect it's probably worthwhile to spend some time studying literature on similar existing systems. I've never studied this myself; I'm just giving a few random thoughts as they come to me.

"I'm not back." - Bill Harding, Twister
kiran k verma

Joined: Jan 18, 2012
Posts: 2
can someone plzzzz upload the code of tracking face and eyes with webcame in java.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

kiran k verma wrote:can someone plzzzz upload the code of tracking face and eyes with webcame in java.

Two things:
  • CodeRanch is NotACodeMill (⇐ that's a link, click it).
  • Please use real words when posting to the forums. Abbreviations such as "plzzzzzz" in place of "please" only serve to make your posts more difficult to read and less likely to generate useful responses. Please click this link ⇒ UseRealWords for more information.

  • [Asking smart questions] [About Bear] [Books by Bear]
    I agree. Here's the link:
    subject: Mapping eye movements
    It's not a secret anymore!