Android 系統(tǒng)自帶相機理解-Setting設(shè)置如何觸發(fā)-1?
一、JAVA知識點:
1.什么是ConcurrentHashMap?
ConcurrentHashMap 的優(yōu)勢在于兼顧性能和線程安全,
一個線程進行寫操作時,它會鎖住一小部分,
其他部分的讀寫不受影響,其他線程訪問沒上鎖的地方不會被阻塞
https://blog.csdn.net/qq_29051413/article/details/107869427
2.接口、抽象類概念理解:
一個類實現(xiàn)這個接口必須實現(xiàn)這個接口中定義的所有的抽象方法。
一個接口只有方法的特征 沒有方法的實現(xiàn)。
接口是一系列方法的聲明,是一些方法特征的集合,一個接口沒有方法的實現(xiàn),
因此這寫方法可以再不同的類實現(xiàn),而這寫實現(xiàn)可以具有不同的行為
接口理解為100%的抽象類。
抽象方法只能存在抽象類或接口中,但抽象類中卻能存在非抽象方法即有方法體的方法。
抽象類是實現(xiàn)接口的,并且還可以定義自己的抽象方法給別人去實現(xiàn)。
3.java中 實現(xiàn)接口中的某一個接口
實例 public class EISCaptureRequestConfig implements ICameraSetting.ICaptureRequestConfigure
二、物理知識:
1.什么是sensor?有什么用處?
感光元件。
相機圖像數(shù)據(jù)都是來自于相機硬件的圖像傳感器(Image Sensor)
Image sensor(圖像傳感器)是一種半導體芯片,
其表面有幾十萬到幾百萬個光電二極管,光電二極管受到光照就會產(chǎn)生電荷,
將光線轉(zhuǎn)換成電信號。其功能類似于人的眼睛,
因此sensor性能的好壞將直接影響到camera的性能.
https://www.jianshu.com/p/f8d0d1467584
https://zhuanlan.zhihu.com/p/37301343
三、Android相機邏輯代碼知識:
1.configEisSessionRequestParameter 設(shè)置
? captureBuilder.set(mKeyEisSessionParameter, CAM_EIS_SESSION_PARAMETER_ON);
? 是什么意思?
? Session Parameter
? 本質(zhì)是什么?
? Session Parameter本質(zhì)上是一個不帶Surface的CaptureRequest
? Session的創(chuàng)建是干嘛?
? 配置好的一次會話,用于從Camera獲取圖像,或者reprocess圖像。
? 可能需要幾百毫秒才能完成Session的創(chuàng)建,
? HAL通常在這個階段完成如下事情
? 創(chuàng)建Pipeline
? 申請Buffer
? 也就是Session在預(yù)覽之前發(fā)生。
? https://blog.csdn.net/qq_42194101/article/details/120171032
? https://blog.csdn.net/qq_42194101/article/details/120171006
2.什么是SurfaceView,Surface、SurfaceHolder
* Handle onto a raw buffer that is being managed by the screen compositor.
?*
?* <p>A Surface is generally created by or from a consumer of image buffers (such as a
?* {@link android.graphics.SurfaceTexture}, {@link android.media.MediaRecorder}, or
?* {@link android.renderscript.Allocation}), and is handed to some kind of producer (such as
?* {@link android.opengl.EGL14#eglCreateWindowSurface(android.opengl.EGLDisplay,android.opengl.EGLConfig,java.lang.Object,int[],int) OpenGL},
?* {@link android.media.MediaPlayer#setSurface MediaPlayer}, or
?* {@link android.hardware.camera2.CameraDevice#createCaptureSession CameraDevice}) to draw
?* into.</p>
Surfaces是用來處理屏幕顯示內(nèi)容合成器所管理的原始緩存區(qū)的工具。
它通常由圖像緩沖區(qū)的消費者來創(chuàng)建(如:SurfaceTexture,MediaRecorder),
然后被移交給生產(chǎn)者(如:MediaPlayer)或者是顯示到其上(如:CameraDevice)
SurfaceHolder
* Abstract interface to someone holding a display surface.? Allows you to
* control the surface size and format, edit the pixels in the surface, and
* monitor changes to the surface.? This interface is typically available
* through the {@link SurfaceView} class.
一個抽象接口,給持有surface的對象使用。它可以控制surface的大小和格式,
編輯surface中的像素,以及監(jiān)聽surface的變化。這個接口通常通過SurfaceView類獲得
SurfaceView
* Provides a dedicated drawing surface embedded inside of a view hierarchy.
?* You can control the format of this surface and, if you like, its size; the
?* SurfaceView takes care of placing the surface at the correct location on the
?* screen
?SurfaceView提供了嵌入視圖層級中的專用surface。你可以控制surface的格式或大小。
?SurfaceView負責把surface顯示在屏幕的正確位置
SurfaceView是一個view對象,用于在屏幕上顯示相機的預(yù)覽畫面
SurfaceView中有兩個對象,Surface和SuraceHolder。
我們通過SuraceHolder中的回調(diào)可以知道Surface的狀態(tài)(創(chuàng)建、變化、銷毀)
通過getHolder()方法獲得當前SurfaceView的SuraceHolder對象
3.EIS設(shè)置、關(guān)閉代碼:
EIS 為什么設(shè)置兩次?
session一次
預(yù)覽一次
文件 EISCaptureRequestConfig.java
?
方法1 configCaptureRequest:表示一個捕捉請求,
我們可以為不同的場景(預(yù)覽、拍照)創(chuàng)建不同的捕捉請求,
并可以配置不同的捕捉屬性,如:預(yù)覽分辨率,預(yù)覽目標,對焦模式、曝光模式等等。
1次: public void configCaptureRequest(CaptureRequest.Builder captureBuilder){
captureBuilder.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE,
? ? ? ? ? ? ? ? ? ? CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE_ON);
? captureBuilder.set(CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE,
? ? ? ? ? ? ? ? ? ? CaptureRequest.CONTROL_VIDEO_STABILIZATION_MODE_OFF);
? }
方法2 第二次
2次:??
configEisSessionRequestParameter
captureBuilder.set(mKeyEisSessionParameter, CAM_EIS_SESSION_PARAMETER_ON);
captureBuilder.set(mKeyEisSessionParameter, CAM_EIS_SESSION_PARAMETER_OFF);
https://blog.csdn.net/wjky2014/article/details/120984783
