Motion Detection using camera...

Quickly share your Android Code Snippets here...

Motion Detection using camera...

Postby strider2023 » Tue Mar 02, 2010 6:47 am

Hello World,

Well i am trying to develop a prototype using android phone to detect small movement and its direction like a mouse...the problem is that accelerometer aint reliable in slow steady motion (conduction tests on iPhone) i intend to use either the inbuilt magnetic compass or i am not sure abt the magnetic compass since i haven't received my phone yet(i am waiting) have started looking into some movement detection code using camera.

The problem is i am new to android it will be very helpful if i get help on how to use the phone camera(phone will arrive by this weekend) and incorporate it with my motion detection algorithm!!!

Thanks in advance!!!
Senior Developer
Senior Developer
Posts: 126
Joined: Tue Mar 02, 2010 6:34 am
Location: Chennai, India


Postby DMacATTACK » Wed Mar 17, 2010 11:10 pm

I have no direct answer for you, but from what I understand, what you want is quite complicated. Motion detection using a camera compares one image to the next. This requires real time image processing. I'm not sure how that would be done in java, or if at all. I do know it is possible in lower level languages such as C (Which is faster than java). If you wish to look into this I recommend looking into OpenCV.

Best of Luck
User avatar
Experienced Developer
Experienced Developer
Posts: 58
Joined: Thu Dec 31, 2009 6:31 pm
Location: Canada

Re: Motion Detection using camera...

Postby Trip » Sat May 22, 2010 4:09 am

there are a few c++ and functions you can dl ... i know this isnt helpful but ... i also heard a rumor u can run c++ code in droid using JNI ? ... worth checking out might make life easier

and search for dorgem (open source motion capture & streaming util) (has motion detection forum)

and the way to visualise what you need to code

2 images to compare
16/32/64 sample pixels to check colour against picture being compared
and a tolerance value
compare each rgb value
see if it is in range with tolerance
if not the image has changed
Junior Developer
Junior Developer
Posts: 19
Joined: Sat May 22, 2010 2:58 am

Re: Motion Detection using camera...

Postby droider » Fri Jul 23, 2010 2:56 am

Yes, you can write native C++ applications and invoke them from java.

You require NDK about a Google Certified Android Developer certification?!
Posts: 25
Joined: Sun Mar 21, 2010 6:17 am
Location: New York

Re: Motion Detection using camera...

Postby phishman3579 » Sun Aug 28, 2011 4:51 pm

You can try

I wrote it and It's open source.
Posts: 9
Joined: Sun Aug 28, 2011 4:49 pm


Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 6 guests