相机方向和预览大小
Camera orientation and preview size
我只是需要一些关于相机预览的说明
在 Android 开发者文档中,他们在 setPreviewSize()
的描述下有这个:
suppose the camera supports both 480x320 and 320x480 preview sizes. The application wants a 3:2 preview ratio. If the display orientation is set to 0 or 180, preview size should be set to 480x320. If the display orientation is set to 90 or 270, preview size should be set to 320x480. The display orientation should also be considered while setting picture size and thumbnail size.
所以在我的代码中我可以将相机方向旋转成直线,这很好用。所以将我的方向改变 90 度会使我的相机变直。
现在我想要一张 4:3 图片,我支持的预览尺寸之一是 1440x1080
,根据上面的块引用,这意味着我需要将我的预览尺寸更改为:
p.setPreviewSize(1080,1440);
但显然这不是我的设备支持的分辨率,所以应用程序会崩溃。
这是我支持的预览尺寸,如果我没有支持的预览但没有上述情况(块引用文本),我该怎么办
iterator D/CAMERA: width: 1920 height 1080 -----
iterator D/CAMERA: width: 1440 height 1080 -----
iterator D/CAMERA: width: 1088 height 1088 -----
iterator D/CAMERA: width: 1280 height 720 -----
iterator D/CAMERA: width: 1056 height 704 -----
iterator D/CAMERA: width: 1024 height 768 -----
iterator D/CAMERA: width: 960 height 720 -----
iterator D/CAMERA: width: 800 height 450 -----
iterator D/CAMERA: width: 720 height 720 -----
iterator D/CAMERA: width: 720 height 480 -----
iterator D/CAMERA: width: 640 height 480 -----
iterator D/CAMERA: width: 352 height 288 -----
iterator D/CAMERA: width: 320 height 240 -----
iterator D/CAMERA: width: 256 height 144 -----
iterator D/CAMERA: width: 176 height 144 -----
我需要我的图像 4:3
根据我的研究,您只能使用支持的预览尺寸:whosebug.com/a/8051114/6286328 and whosebug.com/a/6952604/6286328。也许你最好的办法是获得类似的支持预览尺寸(根据你所需的比例)并测试它是如何获得的。
我只是需要一些关于相机预览的说明
在 Android 开发者文档中,他们在 setPreviewSize()
的描述下有这个:
suppose the camera supports both 480x320 and 320x480 preview sizes. The application wants a 3:2 preview ratio. If the display orientation is set to 0 or 180, preview size should be set to 480x320. If the display orientation is set to 90 or 270, preview size should be set to 320x480. The display orientation should also be considered while setting picture size and thumbnail size.
所以在我的代码中我可以将相机方向旋转成直线,这很好用。所以将我的方向改变 90 度会使我的相机变直。
现在我想要一张 4:3 图片,我支持的预览尺寸之一是 1440x1080
,根据上面的块引用,这意味着我需要将我的预览尺寸更改为:
p.setPreviewSize(1080,1440);
但显然这不是我的设备支持的分辨率,所以应用程序会崩溃。
这是我支持的预览尺寸,如果我没有支持的预览但没有上述情况(块引用文本),我该怎么办
iterator D/CAMERA: width: 1920 height 1080 -----
iterator D/CAMERA: width: 1440 height 1080 -----
iterator D/CAMERA: width: 1088 height 1088 -----
iterator D/CAMERA: width: 1280 height 720 -----
iterator D/CAMERA: width: 1056 height 704 -----
iterator D/CAMERA: width: 1024 height 768 -----
iterator D/CAMERA: width: 960 height 720 -----
iterator D/CAMERA: width: 800 height 450 -----
iterator D/CAMERA: width: 720 height 720 -----
iterator D/CAMERA: width: 720 height 480 -----
iterator D/CAMERA: width: 640 height 480 -----
iterator D/CAMERA: width: 352 height 288 -----
iterator D/CAMERA: width: 320 height 240 -----
iterator D/CAMERA: width: 256 height 144 -----
iterator D/CAMERA: width: 176 height 144 -----
我需要我的图像 4:3
根据我的研究,您只能使用支持的预览尺寸:whosebug.com/a/8051114/6286328 and whosebug.com/a/6952604/6286328。也许你最好的办法是获得类似的支持预览尺寸(根据你所需的比例)并测试它是如何获得的。