camera2

Camera2 get continuous access to camera preview images

偶尔善良 提交于 2019-11-29 07:47:58
I want to extend an app from Camera1 to Camera2 depending on the API. One core mechanism of the app consists in taking preview pictures at a rate of about 20 pics per second. With Camera1 I realized that by creating a SurfaceView, adding a Callback on its holder and after creation of the surface accessing the preview pics via periodic setOneShotPreviewCallbacks. That was pretty easy and reliable. Now, when studying Camera2, I came "from the end" and managed to convert YUV420_888 to Bitmap (see YUV420_888 to Bitmap Conversion ). However I am struggling now with the "capture technique". From the

Android Camera2 API YUV_420_888 to JPEG

淺唱寂寞╮ 提交于 2019-11-27 15:37:10
I'm getting preview frames using OnImageAvailableListener : @Override public void onImageAvailable(ImageReader reader) { Image image = null; try { image = reader.acquireLatestImage(); Image.Plane[] planes = image.getPlanes(); ByteBuffer buffer = planes[0].getBuffer(); byte[] data = new byte[buffer.capacity()]; buffer.get(data); //data.length=332803; width=3264; height=2448 Log.e(TAG, "data.length=" + data.length + "; width=" + image.getWidth() + "; height=" + image.getHeight()); //TODO data processing } catch (Exception e) { e.printStackTrace(); } if (image != null) { image.close(); } } Each

Use of camera2 versus deprecated Camera - what is best practice?

拈花ヽ惹草 提交于 2019-11-27 12:52:35
问题 I'm writing an app for which the camera is an essential feature. In this regard I want to be 100% certain about the following aspects: If I use the deprecated camera: will the app still run on all APIs now? If 1) is yes: At what point in time this app will not run anymore on all APIs (my app shall cover minimum API 17) ? Where can I find updated official information about 2), i.e. what is planned and by when? Say, I would use the new camera2 already now, my understanding is that the app would

Manual focus in camera2, android

℡╲_俬逩灬. 提交于 2019-11-27 05:59:17
问题 i am looking for an example of manual focus in camera2 in android. I tried to get minimum focus distance and available focal lengths shown below, but it didn't help. How to control the focus distance ? float minimumLens = characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE); float[] lensDistances = characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS);  I need to control it with seekbar. Thanks in advance. 回答1: switch (seekBar.getId()) { case R.id

Android Camera2 API YUV_420_888 to JPEG

社会主义新天地 提交于 2019-11-26 17:14:41
问题 I'm getting preview frames using OnImageAvailableListener: @Override public void onImageAvailable(ImageReader reader) { Image image = null; try { image = reader.acquireLatestImage(); Image.Plane[] planes = image.getPlanes(); ByteBuffer buffer = planes[0].getBuffer(); byte[] data = new byte[buffer.capacity()]; buffer.get(data); //data.length=332803; width=3264; height=2448 Log.e(TAG, "data.length=" + data.length + "; width=" + image.getWidth() + "; height=" + image.getHeight()); //TODO data