android-camera2

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

Nexus 5x reverse landscape sensor fix in a android camera preview app

橙三吉。 提交于 2019-11-27 13:19:13
I am kind of newbie in Android development, so my apologies in advance if my question is trivial. In one part of my app I need a live preview of my rear camera, so I created a custom class which extends SurfaceView and implement SurfaceHolder.Callback (I followed basically the instructions in the android documentation). Unfortunately, I am testing my app in a Nexus 5x, which I've just realized that it has installed the camera sensor in a reverse way. For that reason, the camera preview of my app when running on my Nexus 5x appears upside down, which is something I dont want. It seems that the

Zoom Camera2 Preview using TextureView

人走茶凉 提交于 2019-11-27 08:29:27
i have a Problem with my Preview Zoom for the Camera2 API. I am using a TextureView. I want to zoom only the preview Stream that was showed in the TextureView. I want to zoom the Area where i use the Zoom Gesture. I use the SimpleOnScaleGestureListener! I added following Code. The zoomingFactor and the x and y Position are right. private void updateTextureViewSize(float xPosi,float yPosi, float scale){ float scaleX = 1.0f; float scaleY = 1.0f; float mVideoWidth = mCamcontrol.getmPreviewSize().getWidth(); float mVideoHeight = mCamcontrol.getmPreviewSize().getHeight(); int rotation =

Incorrect image converting YUV_420_888 into Bitmaps under Android camera2

丶灬走出姿态 提交于 2019-11-27 08:20:23
问题 I’m trying to convert YUV_420_888 images into bitmaps, coming from the camera2 preview. But the output image has incorrect colors. Next is the test code I’m running to generate the bitmap. Is test code only, so please don’t do any code review about not relevant factors such as the bitmap is being recycled, or the RenderScript is continuously been created. This code is just to test the conversion from YUV to RGB and nothing more. Other factors, the code is meant to run from API 22 and above,

Android Camera2 capture image skewed

不问归期 提交于 2019-11-27 07:07:36
问题 Update : This looks like it's related to this: Image data from Android camera2 API flipped & squished on Galaxy S5 - I consider this as a bug since Nexus 5/6 works correctly and it makes no sense to need to obtain full sensor size and then cropping manually to reach the desired aspect ratio, might as well not using "supported" output sizes as well! Problem: Get characteristics of a camera using Camera2 API, and extract output sizes suitable for a MediaCodec.class Create a MediaCodec input

How to correctly use ImageReader with YUV_420_888 and MediaCodec to encode video to h264 format?

寵の児 提交于 2019-11-27 02:56:37
问题 I'm implementing a camera application on Android devices. Currently, I use Camera2 API and ImageReader to get image data in YUV_420_888 format, but I don't know how to exactly write these data to MediaCodec. Here are my questions: What is YUV_420_888 ? The format YUV_420_888 is ambiguous because it can be any format which belongs to the YUV420 family, such as YUV420P , YUV420PP , YUV420SP and YUV420PSP , right? By accessing the image's three planes(#0, #1, #2), I can get the Y(#0), U(#1), V(

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

Nexus 5x reverse landscape sensor fix in a android camera preview app

橙三吉。 提交于 2019-11-26 16:17:52
问题 I am kind of newbie in Android development, so my apologies in advance if my question is trivial. In one part of my app I need a live preview of my rear camera, so I created a custom class which extends SurfaceView and implement SurfaceHolder.Callback (I followed basically the instructions in the android documentation). Unfortunately, I am testing my app in a Nexus 5x, which I've just realized that it has installed the camera sensor in a reverse way. For that reason, the camera preview of my

Zoom Camera2 Preview using TextureView

谁都会走 提交于 2019-11-26 11:16:28
问题 i have a Problem with my Preview Zoom for the Camera2 API. I am using a TextureView. I want to zoom only the preview Stream that was showed in the TextureView. I want to zoom the Area where i use the Zoom Gesture. I use the SimpleOnScaleGestureListener! I added following Code. The zoomingFactor and the x and y Position are right. private void updateTextureViewSize(float xPosi,float yPosi, float scale){ float scaleX = 1.0f; float scaleY = 1.0f; float mVideoWidth = mCamcontrol.getmPreviewSize()

YUV_420_888 interpretation on Samsung Galaxy S7 (Camera2)

点点圈 提交于 2019-11-26 08:03:29
问题 I wrote a conversion from YUV_420_888 to Bitmap, considering the following logic (as I understand it): To summarize the approach: the kernel’s coordinates x and y are congruent both with the x and y of the non-padded part of the Y-Plane (2d-allocation) and the x and y of the output-Bitmap. The U- and V-Planes, however, have a different structure than the Y-Plane, because they use 1 byte for coverage of 4 pixels, and, in addition, may have a PixelStride that is more than one, in addition they