0

So am am trying to develop an app/website which accesses the phone's camera and detects motion. But I have simply no idea how I would do this efficient and accurate. The timing is important so can not have huge above (1-20ms). The info I get will be sent to a Node.js server and compared to another camera with motion tracking.

So in short. What would be an efficient way to detect motion from a mobile camera in javascript then trigger a function?

:) Sorry if it is kind of messy, no idea how to formulate the question. So just leave a comment and I will see if I can clear up :P

Asd20752
  • 323
  • 4
  • 12
  • JavaScript isn't able to do things like this. You need a smartphone app. – Blazemonger Apr 23 '15 at 20:14
  • I thought of using the getUserMedia command. Works with the chrome app – Asd20752 Apr 23 '15 at 20:58
  • What do you mean by `detect motion`? If the frame(t) != frame(t-1) then motion = true? – levi Apr 23 '15 at 20:58
  • Something like that, is it possible to compare two frames of a stream? The thing is that wouldn't that change with the lighting? – Asd20752 Apr 23 '15 at 21:00
  • Yes. You can add the video feed to a `video` element, draw the video element to a `canvas`, and read the canvas pixel data to compare frames. http://joshondesign.com/p/books/canvasdeepdive/chapter13.html – levi Apr 23 '15 at 21:08
  • As for lighting, and actually detecting motion vs noise, that's a separate question of computer vision, not specific to JS. – levi Apr 23 '15 at 21:10
  • this may help - http://www.adobe.com/devnet/archive/html5/articles/javascript-motion-detection.html – levi Apr 23 '15 at 21:16
  • Thanks @levi exactly what I was after. And so much good stuff to crunch on. Again thanks :D – Asd20752 Apr 23 '15 at 21:28

0 Answers0