Hi I make app in which I use camera and I need to detect in which side is phone moving (left,rigth,up or down) all sensor I have tried just return moving around axis.
So If I have camera and I will move phone to right/left/up/down how to detect it?
You can you the linear accelerometer to detect which direction the user is moving. This page has all the details you will need. There a few sample projects you can have a look at as well.
http://developer.android.com/guide/topics/sensors/sensors_motion.html#sensors-motion-accel
Related
Usually, there's a compass and an accelerometer on a typical smartphone these days. So, using information from these sensors can we recreate the whole orientation in which the photo was taken?
I mean like if you open the compass app on your phone, it firstly states the direction you are looking (link), how lifted or tilted is your phone in front direction ( I don't know how to state it in a better way) (link) and how much is it titled in sideways (link). Does it cover 3 degrees of freedom (i guess)?
Is it enough information to recreate that orientation of the phone?
Also if you think it's not the right place to ask such a question, can you comment where should I ask this question?
Recording sensor values, it would be possible to restore phone direction in which photo was taken. Some fundamental XR apps(e.g. Google Street View) are actually doing such.
Device rotation
There is a handy helper function, SensorManager.getRotationMatrix exactly for that purpose. Giving magnetic field and gravity sensor-values, you can obtain the device rotation matrix(=complete set of orthogonal 3d basis vectors) which is enough for you to reproduce phone direction afterwards.
Camera orientation
In some cases camera's up direction may be different from device's up direction due to screen orientation changes(portrait or landscape, locked or auto-rotate). So if you handle raw camera inputs, you may need to record screen orientation too. See Display.getRotation.
I am trying to detect if the user is moving the device in a diagonal motion (like a sword move). Even if it is vertical move then fine. I just need to know that he moved it from top to bottom. I am exploring sensors (mainly accelerator, gyroscope and linear accelerometer).
I can't seem to figure out how to do the detection. Any working example out there? or Pointer?
Thank you
I want to develop an android app that captures hand gestures without touching the screen. What kind of sensors will I have to use? I don't want camera detection, that's too battery consuming. Will proximity sensor be of any help? How can I even access these sensors? Please, need help here in respect of coding.
I am creating a project in Android.
This have pre-requirement is : Play video By moving Android device.
I have implemented Accelerometer Sensor, but if I move device on Plain surface and move device Up, Down, Left or Right, then No Event is called. It is only detects when device rotates in any direction.
Is it possible to detect moving device on plain surface??
Thanks in Advance.
Is it possible to measure the distance between your android phone screen and user face?
I want to change the zoom ratio zoom of your android app screen base on the distance between your face and your phone screen.
Please help me.
Thanks.
Yes it is possible, as long as you have a front facing camera in your device. This was more or less my bachelor thesis.
Here is the code
https://github.com/philiiiiiipp/Android-Screen-to-Face-Distance-Measurement
and a video of the result https://www.youtube.com/watch?v=-6_pGkPKAL4
and the paper A new context - Screen to Face distance 1 1.pdf
I described how to calculate screen to face distance in a post on my blog. The algorithm is based on the distance between eyes. The further the face, the less the distance between your eyes appears on the camera.
https://ivanludvig.github.io/blog/2019/07/20/calculating-screen-to-face-distance-android
I don't believe it's possible.
Not all Android devices are equipped with a proximity sensor
These sensors are just meant to detect wether or not you have your cheek next to the phone.
EDIT following OP comment :
Technically, you could indeed use some image recognition algorithm to compute the screen-face distance based on the input from front camera.
But:
Not all Android devices have a front facing camera.
Implementing this from scratch would be extremely complex if you have no background in image processing.