简体   繁体   English

android.hardware.camera预览:如何手动设置曝光时间,快门速度,光圈和ISO

[英]android.hardware.camera preview : How to manually set exposure time, shutter speed, aperture, and iso

I am working on an app where I have a camera preview and I take pictures in dark settings. 我正在使用一个具有摄像头预览功能的应用程序,并且在黑暗的环境中拍照。 Therefore, I need a way to manually control the exposure time of the camera and the settings of shutter speed, aperture, and iso. 因此,我需要一种方法来手动控制相机的曝光时间以及快门速度,光圈和iso的设置。

I know it must be possible because the application Long Exposure Camera 2 (by AAASDream) has a way to manually change the exposure time and it works perfectly. 我知道这是有可能的,因为应用程序Long Exposure Camera 2(由AAASDream开发)具有一种手动更改曝光时间的方法,并且可以完美运行。 I am not referring to the exposurecompensation which I already tried but was not sufficient enough. 我并不是指已经尝试过但还不够的曝光补偿。

Based off of this post , I tried setting 基于这篇文章 ,我尝试设置

Camera.Parameters params = camera1.getParameters();
params.set("mode", "m");
params.set("aperture", 80);
params.set("shutter-speed", 9);
params.set("iso", 1600);

But this did not work at all. 但这根本没有用。

Is there any hidden API or setting that I can use or any third party library I can use to accomplish this. 是否可以使用任何隐藏的API或设置,或者可以使用任何第三方库来完成此任务。

All help is appreciated, thanks. 感谢所有帮助,谢谢。

I think there is no way to manually set the above mentioned values in android.hardware.camera. 我认为没有办法在android.hardware.camera中手动设置上述值。 But it looks like the new version android.hardware.camera2 supports those functionalities. 但看起来新版本android.hardware.camera2支持这些功能。

Yes, it isn't possible to manually set one of the two mentioned parameters directly via the Camera 1 API. 是的,无法直接通过Camera 1 API手动设置上述两个参数之一。 Neither the characteristics can be queried via a standardized method, because it isn't supported. 由于不支持,无法通过标准化方法查询这两个特征。

Of course there is a way around, to query or to set such properties via special methods, as relime9 currently mentioned: 当然,有一种方法可以通过特殊方法来查询或设置此类属性,如relime9当前所提到的:

// query all the settings you camera support (API 1)
mCamera.getParameters().flatten();
// set parameters - e.g. aperture
mCamera.getParameters().set("aperture", "80");

Additionally the specific device must support such a setting, which vary from device to device. 此外,特定设备必须支持此类设置,具体取决于设备。 On some devices there can be set certain values and with other you can't and can only use the ''auto'' mode. 在某些设备上可以设置某些值,而在其他设备上则不能设置,只能使用“自动”模式。

For this reason they developed the Camera 2 API, which is more standardized and supports such functionalities. 因此,他们开发了Camera 2 API,该API更加标准化并支持此类功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM