在 android 中使用 camera2 拍照
Take picture using camera2 in android
在"old"相机时代-API我用的是简单的代码:
Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
startActivityForResult(imageIntent, CAPTURE_IMAGE);
效果很好。
现在使用 camera2 示例代码约为 1035 行代码 - android-camera2Basic example.
有没有更简单的方法,只用新相机拍照2-API?
In the days of the "old" camera-API I used the simple code:
该代码与“'old' camera-API”(android.hardware.Camera
)无关。
Isn't there a simpler way of just taking a picture with the new camera2-API ?
您问题中的代码工作正常...在 the limits of the camera apps that you might be linking to.
内
实施 android.hardware.Camera
比 android.hardware.camera2.*
稍微容易一些,但也不是很多,而且 API 都非常复杂。
在"old"相机时代-API我用的是简单的代码:
Intent imageIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
imageIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
startActivityForResult(imageIntent, CAPTURE_IMAGE);
效果很好。
现在使用 camera2 示例代码约为 1035 行代码 - android-camera2Basic example.
有没有更简单的方法,只用新相机拍照2-API?
In the days of the "old" camera-API I used the simple code:
该代码与“'old' camera-API”(android.hardware.Camera
)无关。
Isn't there a simpler way of just taking a picture with the new camera2-API ?
您问题中的代码工作正常...在 the limits of the camera apps that you might be linking to.
内实施 android.hardware.Camera
比 android.hardware.camera2.*
稍微容易一些,但也不是很多,而且 API 都非常复杂。