如何在Android中使用camera2 判斷相機(jī)是否可用?針對這個(gè)問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡單易行的方法。
十余年的敦煌網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都營銷網(wǎng)站建設(shè)的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整敦煌建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)建站從事“敦煌網(wǎng)站設(shè)計(jì)”,“敦煌網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
首先獲取到設(shè)備等級(jí):
Float hardwareLevel = mCameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
LEGACY < LIMITED < FULL < LEVEL_3. 越靠右邊權(quán)限越大
?INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2
?INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0
?INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1
?INFO_SUPPORTED_HARDWARE_LEVEL_3 = 3
在相應(yīng)的等級(jí)下面會(huì)有各自支持的功能,LEGACY為最低權(quán)限
在LIMITED中
Additional capabilities may optionally be supported by a LIMITED-level device, and can be checked for in *android.request.availableCapabilities*.
android.request.availableCapabilities
介紹:List of capabilities that this camera device advertises as fully supporting.
int[] ints = mCameraCharacteristics.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
Possible values:
?BACKWARD_COMPATIBLE
?MANUAL_SENSOR
?MANUAL_POST_PROCESSING
?RAW
?PRIVATE_REPROCESSING
?READ_SENSOR_SETTINGS
?BURST_CAPTURE
?YUV_REPROCESSING
?DEPTH_OUTPUT
?CONSTRAINED_HIGH_SPEED_VIDEO
For example manual_semsor:REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR The camera device can be manually controlled (3A algorithms such as auto-exposure, and auto-focus can be bypassed). The camera device supports basic manual control of the sensor image acquisition related stages. This means the following controls are guaranteed to be supported: Manual frame duration control - android.sensor.frameDuration - android.sensor.info.maxFrameDuration Manual exposure control - android.sensor.exposureTime - android.sensor.info.exposureTimeRange Manual sensitivity control - android.sensor.sensitivity - android.sensor.info.sensitivityRange Manual lens control (if the lens is adjustable) - android.lens.* Manual flash control (if a flash unit is present) - android.flash.* Manual black level locking - android.blackLevel.lock Auto exposure lock - android.control.aeLock
這些值對應(yīng)的特征值舉例:
final String name3 = CaptureRequest.SENSOR_FRAME_DURATION.getName();
name3 -》android.sensor.frameDuration
列出這個(gè)的意思是,如果想知道該設(shè)備是否支持此功能,可以通過getName()獲取其包名,然后在
mCameraCharacteristics.getAvailableCaptureRequestKeys();生成的隊(duì)列中尋找。
如果有匹配則是可控;
CaptureRequest.LENS_FOCUS_DISTANCE;調(diào)節(jié)焦距
CaptureRequest.CONTROL_AF_MODE;自動(dòng)對焦模式
CaptureRequest.SENSOR_SENSITIVITY 調(diào)節(jié)iso
CaptureRequest.CONTROL_AE_MODE 自動(dòng)曝光模式
關(guān)于如何在Android中使用camera2 判斷相機(jī)是否可用問題的解答就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。
網(wǎng)站欄目:如何在Android中使用camera2判斷相機(jī)是否可用
網(wǎng)頁URL:http://aaarwkj.com/article42/gppchc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供域名注冊、靜態(tài)網(wǎng)站、網(wǎng)站建設(shè)、服務(wù)器托管、商城網(wǎng)站、微信公眾號(hào)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)