simon-heinen / droidar

DroidAR Mobile Locationbased Augmented Reality Framework for Android
GNU General Public License v3.0
225 stars 275 forks source link

Camera is flipped 90 degrees #5

Open diegurrio opened 11 years ago

diegurrio commented 11 years ago

Hi I'm trying the demo in a tablet device. When the activity starts the camera is flipped 90 degrees. The layout seems fine.

simon-heinen commented 11 years ago

tablets have the axis switched, I think you can modify the camera preview to work also on tablets. see also http://stackoverflow.com/questions/3852154/android-camera-unexplainable-rotation-on-capture-for-some-devices-not-in-exif

rvieras commented 10 years ago

I am having this same issue. I have adjusted the preview to rotate 90 degrees however when running demos the augmented object do not currently appear. For example when looking at he "Placing objects Demo 2" the augmented object does not appear to move. The way i changed to 90 degrees preview was I added a check in "setPreviewAccordingToScreenOrientation" to check if the device is a tablet.
if(!EventManager.isTabletDevice){ if (rotation == Surface.ROTATION_0) { parameters.setPreviewSize(height, width); setDisplayOrientation(90); } else if (rotation == Surface.ROTATION_90) { parameters.setPreviewSize(width, height); setDisplayOrientation(0); } else if (rotation == Surface.ROTATION_180) { parameters.setPreviewSize(height, width); setDisplayOrientation(0); } else if (rotation == Surface.ROTATION_270) { parameters.setPreviewSize(width, height); setDisplayOrientation(180); } }else{ //TODO: if(rotation == Surface.ROTATION_0){ Log.e("ROTATION", "ITS A TABLET SETING ROTATION from " + rotation + " to something"); parameters.setPreviewSize(height, width); setDisplayOrientation(-90); } }