6

I am trying to see if it is possible to take picture on iOS when there is any movement in front of the camera. For example, Is it possible for an app to take picture when some body wave hand or just show his/her face in front of the camera or throw a ball in the air such that it crosses the camera line of sight.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ashutosh
  • 5,614
  • 13
  • 52
  • 84
  • 1
    You'd obviously have to have the camera running already, but it should just be as easy as detecting changing pixels in the images being shown. – NominSim Dec 18 '12 at 23:00
  • 1
    I am making an assumption here that the camera will be open already. Can you share some link or code to perform this. – Ashutosh Dec 18 '12 at 23:01
  • 2
    Try [this](http://stackoverflow.com/questions/3933716/how-can-you-track-motion-using-the-iphones-camera) question. Though the answer probably is overkill for what you need it will give you an idea of where to start. What I would suggest for something very simple would be to detect a percentage of pixels that change from one frame to the next, then if that exceeds a threshold you have motion. – NominSim Dec 18 '12 at 23:03
  • Yup. I think that should be a great point to start. But i need to figure out how to achieve even this simple thing as i have never worked with this before. Please share some code to start with if you can. Thanks, – Ashutosh Dec 18 '12 at 23:20
  • I am not an ios engineer but I suspect won't it go against sandboxing principle? – Anoop Vaidya Dec 20 '12 at 10:57

1 Answers1

1

Check out Lucas-Kanade (LK) Optical Flow for the iPhone It's an optical flow estimation algorithm (i.e. "the pattern of apparent motion of objects, surfaces and edges in a visual scene caused by the relative motion between an observer and the scene.")

It might help you out with the motion detection and then you would probably just have to respond to that event.

sunshineDev
  • 323
  • 3
  • 10