I am working on Camera 2 API recently, and my device has a 16: 9 screen ratio, but my camera sensor is 4: 3. So the whole preview size I received is 4: 3. I wonder if there is Is there any way to get grain size and display only 16: 9 part? I tried a lot of time and did not find any help for camera 2.
My current camera code is similar to the base camera 2 sample .
So, how do I crop a preview and display only part 16: 9 on the texture?
Thanks!!
SurfaceTexture 4: 3 16: 9.
SurfaceTexture
ConstraintLayout 16: 9 ( ).
ConstraintLayout
, :
texture.setDefaultBufferSize(width, height)
, , .
,
setUpCameraOutputs(int width, int height) ,
setUpCameraOutputs(int width, int height)
// Danger, W.R.! Attempting to use too large a preview size could exceed the camera // bus' bandwidth limitation, resulting in gorgeous previews but the storage of // garbage capture data. mPreviewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth, maxPreviewHeight, largest);
, - .
Source: https://habr.com/ru/post/1617101/More articles:Interacting and disabling HTML5 scroll based animation - javascriptBuild failed, missing key attribute (Android SDK) - javaUnable to change fragment container ID SupportMapFragment - androidHow can I combine in-place transformation and copy transformation? - c ++Сериализация для Java-календаря - javaIs there a way to see what is in the MongoDB cache and what is not? - mongodbAttempting to get profile information using Sharepoint and Microsoft Graph api - sharepointiOS Как копировать вращение игрока в Youtube? - iosClass 'NumberFormatter' did not find an error in a simple PHP program - phpList processing in prolog and schema - listAll Articles