Codenameone捕获照片倒置 [英] Codenameone Capture Photo Upside down

查看:65
本文介绍了Codenameone捕获照片倒置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android上使用Capture类使用前置摄像头(Selfie Camera)拍照时,照片会上下颠倒。有什么方法可以检测到使用了前置摄像头,以便在需要时旋转图像?

using the Capture class to take photos using the front facing camera (Selfie Camera) on android, the photo comes out upside down. Is there any way we can detect that the front facing camera was used so we can rotate the image if needed?

推荐答案

某些摄像头沿相机传感器的方向捕获图像,然后在EXIF中用特殊的旋转标记对其进行标记,以指示应以不同的方向查看图像。这在后置摄像头中很常见,它总是在风景中捕获并将肖像图像标记为旋转。

Some cameras capture the image in the orientation of the camera sensor then mark it with a special rotation flag in EXIF to indicate that the image should be viewed in a different orientation. This is common in the back camera that always captures in landscape and marks portrait images as rotated.

使用 Image.createImage( filePathToImage)我们隐式检测EXIF数据并调整图像,以便可以正确查看它。其他图像加载方法的工作方式不同。这在很大程度上取决于您使用的 Image API和您进行的 Capture 调用,因为两者的差异很小。

When you open an image using Image.createImage(filePathToImage) we implicitly detect EXIF data and adjust the image so it will be viewed correctly. Other image loading methods don't work the same way. This highly depends on the Image API you used and the Capture call you made as there are few variations of both.

这篇关于Codenameone捕获照片倒置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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