当设备处于横向时,拍摄人像照片时出现问题? [英] Any problems taking a portrait photo when device is in landscape?

查看:162
本文介绍了当设备处于横向时,拍摄人像照片时出现问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一个设备制作一个相当专业的相机应用程序,它实际上总是以横向方向来举行。

I am making a rather specialist camera app for a device which is physically always going to be held in a landscape orientation. Part of the spec is that it must be able to preview and take photos in a portrait orientation - see image below.

我对运行时异常有些麻烦setParameters失败(响应对 camera.setParameters()的调用),我只是想在这里检查是否有一些基本问题,你认为我可能会反对。例如,也许照相机背面上的光传感器布置成矩形,并且物理上这不能实现 - 或者可能是一些其他不可避免的问题。 (顺便说一下,我被告知,光传感器应该排列在一个正方形,所以这个问题不会发生 - 但我的来源可能会错误)。

I am having some trouble with a runtime exception "setParameters failed" (in response to a call to camera.setParameters()) and I just wanted to check here whether there was some fundamental problem that you think I might be up against. For example perhaps the light sensors on the back of the camera are a arranged in a rectangle and physically this can not be achieved - or perhaps some other unavoidable issue. (By the way I have been informed that the light sensors should be arranged in a square, so this problem will not occur - but my sources may be mistaken). Maybe this is hardware dependant?

编辑:FYI我的崩溃日志如下:

FYI my crash log is below:

D/AndroidRuntime(7210): Shutting down VM
W/dalvikvm(7210): threadid=1: thread exiting with uncaught exception (group=0x415c2d88)
E/AndroidRuntime(7210): FATAL EXCEPTION: main
E/AndroidRuntime(7210): Process: com.rai.motion, PID: 7210
E/AndroidRuntime(7210): java.lang.RuntimeException: Unable to resume activity {com.rai.motion/com.rai.motion.MotionMain}: java.lang.RuntimeException: setParameters failed
E/AndroidRuntime(7210):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2850)
E/AndroidRuntime(7210):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2879)
E/AndroidRuntime(7210):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2303)
E/AndroidRuntime(7210):     at android.app.ActivityThread.access$800(ActivityThread.java:144)
E/AndroidRuntime(7210):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
E/AndroidRuntime(7210):     at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(7210):     at android.os.Looper.loop(Looper.java:212)
E/AndroidRuntime(7210):     at android.app.ActivityThread.main(ActivityThread.java:5151)
E/AndroidRuntime(7210):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(7210):     at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(7210):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
E/AndroidRuntime(7210):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime(7210):     at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(7210): Caused by: java.lang.RuntimeException: setParameters failed
E/AndroidRuntime(7210):     at android.hardware.Camera.native_setParameters(Native Method)
E/AndroidRuntime(7210):     at android.hardware.Camera.setParameters(Camera.java:1689)
E/AndroidRuntime(7210):     at com.rai.motion.MotionMain.change_java_recording_camera_settings(MotionMain.java:2105)
E/AndroidRuntime(7210):     at com.rai.motion.MotionMain.start_recording_camera(MotionMain.java:2154)
E/AndroidRuntime(7210):     at com.rai.motion.MotionMain.onResume(MotionMain.java:6013)
E/AndroidRuntime(7210):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1192)
E/AndroidRuntime(7210):     at android.app.Activity.performResume(Activity.java:5310)
E/AndroidRuntime(7210):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2840)
E/AndroidRuntime(7210):     ... 12 more
I/Process(7210): Sending signal. PID: 7210 SIG: 9


推荐答案

测试应用程序。这是没有问题,显示相机预览在纵向模式,而设备是横向。用直角旋转摄像机图像是棘手的(因为这个旋转角度取决于设备/摄像机)。然而一个问题是,透视不匹配:对象似乎更胖或有条纹。但是要知道重新计算算法在Stackoverflow上应该不会花费太多时间。

I made a small camera test app a while ago. It was no problem, to show the camera preview in portrait mode, whilst the device was in landscape orientation. It was tricky to rotate the camera image by the right angle (because this rotation angle is device/camera dependant). A problem however was, that the perspective didn't match then: object seemed to be fatter or streched. But to find out the recalculating algorithm shouldn't take to much time on Stackoverflow.

因此关于


我只想在这里查看是否有一些根本性的问题
,你认为我可能会反对。

I just wanted to check here whether there was some fundamental problem that you think I might be up against.

[... ]这在实际上是无法实现的 - 或者是其他一些不可避免的问题。

[...]and physically this can not be achieved - or perhaps some other unavoidable issue.

答案是:这是一个可以完成的任务。您的例外可能有完全不同的原因。

the answer is: it's a doable task. Your exception probably has a totally different reason.

这篇关于当设备处于横向时,拍摄人像照片时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆