Tag: android camera2

android textureview全屏预览,正确的宽高比

我一直在使用谷歌的camera2 api演示版 ,不幸的是,示例应用程序是为了在屏幕高度的大约70%处显示纹理视图预览而构建的,在环顾四周之后,我能够确定这是由AutoFitTextureView覆盖了onMeasure()方法如下图所示: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); if (0 == mRatioWidth || 0 == mRatioHeight) { setMeasuredDimension(width, height); } else { if (width < height * mRatioWidth / mRatioHeight) { setMeasuredDimension(width, width * mRatioHeight / mRatioWidth); } else { setMeasuredDimension(height * […]

Android camera2 api galaxy s7

我正在编写一个应用程序,用于记录手机中的video并将其上传到服务器。 适用于除Galaxy S7之外的任何设备。 在Galaxy S7上,录制的video文件只包含音频,没有video或一个video帧。 这在手机上创建的临时文件中是正确的,而不仅仅是上传到服务器的临时文件。 我正在使用Camera2 API,我尝试使用前后摄像头。 我尝试过我的代码和这两个示例应用程序: https : //developer.android.com/samples/Camera2Video/project.html https://github.com/googlesamples/android-Camera2Video/blob/master/Application/的src /主/ JAVA / COM /示例/机器人/ camera2video / Camera2VideoFragment.java 生成的video文件似乎没问题,这里是编解码器信息:Stream 0类型:video编解码器:H264 – MPEG-4 AVC(第10部分)(avc1)语言:英语分辨率:960×720显示分辨率:960×720帧率:29.055091 流1类型:音频编解码器:MPEG AAC音频(mp4a)语言:英语频道:立体声采样率:16000 Hz

Android camera2镜头内在校准

我下载了一个Android camera2 演示 ,它运行良好。 现在我想通过查询CameraCharacteristics来获得相机的内在矩阵。 我的代码是 private void setUpCameraOutputs(int width, int height) { Activity activity = getActivity(); CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE); try { for (String cameraId : manager.getCameraIdList()) { CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId); float[] intrinsic = new float[5]; intrinsic = characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION); //…… leave out the following part } } 内在函数应该是一个5元素数组,但intrinsic = characteristics.get(CameraCharacteristics.LENS_INTRINSIC_CALIBRATION)返回null。