简体   繁体   English

在触摸相机屏幕时像默认相机一样调整android相机api中的亮度

[英]Adjusting brightness in android camera api like default camera on touching the camera screen

I am preparing a custom android camera app and wish to adjust the exposure/brightness of the camera on touch event.我正在准备一个自定义的 android 相机应用程序,并希望在触摸事件时调整相机的曝光/亮度。 The default values look a bit darker than the default camera .默认值看起来比默认相机暗一些。 I tried using whiteBalance(auto) function but it wont help.我尝试使用 whiteBalance(auto) 功能,但它无济于事。 Was trying it using exposure like正在尝试使用像这样的曝光

params.setExposureCompensation(params.getExposureCompensation()); params.setExposureCompensation(params.getExposureCompensation());

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                if(params.isAutoExposureLockSupported()) {
                    params.setAutoExposureLock(false);
                }
            }

but i am not understanding the difference between the exposure function's like ,但我不明白曝光功能之间的区别,

getExposureCompensation(), getMaxExposureCompensation(),getExposureCompensationStep() getExposureCompensation(), getMaxExposureCompensation(),getExposureCompensationStep()

Firstly, you are not actually setting the exposure.首先,您实际上并没有设置曝光。

params.setExposureCompensation(params.getExposureCompensation());

sets the exposure to the previous value ie it is never changed.将曝光设置为以前的值,即它永远不会改变。 What you need to do is set a value between params.getMinExposureCompensation() and params. getMaxExposureCompensation()您需要做的是在params.getMinExposureCompensation()params. getMaxExposureCompensation()之间设置一个值params. getMaxExposureCompensation() params. getMaxExposureCompensation()

Secondly the difference between the exposure functions is clearly explained in the docs其次, 文档中清楚地解释了曝光功能之间的区别

getExposureCompensation

Gets the current exposure compensation index.获取当前曝光补偿指数。 current exposure compensation index.当前曝光补偿指数。 The range is getMinExposureCompensation() to getMaxExposureCompensation().范围是 getMinExposureCompensation() 到 getMaxExposureCompensation()。 0 means exposure is not adjusted. 0 表示不调整曝光。

getMaxExposureCompensation

Gets the maximum exposure compensation index.(>=0)获取最大曝光补偿指数。(>=0)

getExposureCompensationStep

exposure compensation step.曝光补偿步骤。 Applications can get EV by multiplying the exposure compensation index and step.应用程序可以通过将曝光补偿指数和步长相乘来获得 EV。 Ex: if exposure compensation index is -6 and step is 0.333333333, EV is -2.例如:如果曝光补偿指数为-6,步长为0.333333333,则EV为-2。

Here EV stands for exposure value这里EV代表曝光值

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

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