android-camera2

Camera 2 CameraCharacteristics seem to show incorrect data

早过忘川 提交于 2019-12-08 00:51:38
问题 I have downloaded and changed Google's Camera 2 Basic example. My changes add iterating through camera devices and showing some of their characteristics. I created this function: private void printCameraCharacteristics() { Log.d(TAG, "printCameraCharacteristics"); Activity activity = getActivity(); CameraManager manager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE); try { for (String cameraId : manager.getCameraIdList()) { Log.d(TAG, "------------------------------ "+

Adding ARToolkit Marker tracking into Tango

核能气质少年 提交于 2019-12-07 08:20:31
I have been trying to integrate ARToolkit Marker Object tracking into a Tango Application . So far I have created a build so that a tango app can access and use the ARToolkit Native Library or the ARToolkit Unity wrappers. However, they both seem to require exclusive access to the camera in their default configurations. How could you feed the same Android video feed to both libraries? Could you create a dummy camera device which doubles out the feed? Could you take the tango feed as normal, and then resend it into ARToolkit with a special VideoConf [edit] ARToolkit uses the older Camera1 API,

Is it possible to use Camera2 with Google Vision API

杀马特。学长 韩版系。学妹 提交于 2019-12-07 00:28:18
问题 Is it possible to detect faces using Camera2 with Google Vision API only ? I could not find a way to integrate it. 回答1: Yes, It is possible to use Camera2 API with Google Vision API. To start with, the Google Vision API Face Detector receives a Frame object that uses to analyze (detect faces and its landmarks). The Camera1 API provides the preview frames in NV21 image format, which is ideal for us. The Google Vision Frame.Builder supports both setImageData (ByteBuffer in NV16, NV21 or YV12

Recording video using MediaCodec with Camera2 API

醉酒当歌 提交于 2019-12-06 22:11:40
问题 I am trying to use MediaCodec to record raw frames from ImageReader in onImageAvailable callback but unable to write a working code. Most of the examples are using Camera 1 API or MediaRecorder. My aim is to capture individual frames process it and create an mp4 out of it Raw YUV frames @Override public void onImageAvailable(ImageReader reader) { Image i = reader.acquireLatestImage(); processImage(i); i.close(); Log.d("hehe", "onImageAvailable"); } }; MediaCodec MediaCodec codec = MediaCodec

Camera2 aspect ratio on Samsung

こ雲淡風輕ζ 提交于 2019-12-06 08:23:47
I'm using the Camera2 API on an S5, showing a TextureView-based preview at 720x480. With Camera1, the preview looks fine, but with Camera2 its distorted: I'm calling SurfaceTexture.setDefaultBufferSize properly, etc. This seems to work fine on non-Samsung phones. Curiously, if I modify Camera2Basic to use the front-facing camera and 720x480 it has the same distortion: Any idea what may be behind this problem? It seems reminiscent of another Samsung aspect ratio problem I've seen but I'm not sure how to translate that work-around over to Camera2. 来源: https://stackoverflow.com/questions/35709754

Android Camera2 Video Playback Video and Audio Out of Sync

喜夏-厌秋 提交于 2019-12-06 07:41:00
问题 I've been having an issue using the camera 2 api for android. I'm able to record videos, but during playback, only the audio plays. After the video is done playing, the time jumps ahead anywhere from 10 minutes to 2 hours and then plays the video back. I've never heard of an issue like this. I pretty much followed this. Here is the code for setting my media recorder: mMediaRecorder = new MediaRecorder(); // Step 2: Set sources mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER)

Manual Focus using android camera2 API

情到浓时终转凉″ 提交于 2019-12-06 04:24:18
问题 I want to develop an Android Camera App for myself (can share it if there are interested people) that has a manual focus while video recording. I've added a SeekBar to the google sample Camera2 app but I can't find the way to implement the manual focus. I found Manual focus in camera2, android but it doesn't work on my LG G4. The stock camera app is almost perfect since it doesn't allow the manual focus in video mode. Does anyone of you have an idea ? EDIT: here's the code of the SeekBar

Incorrect transformation of frames from YUV_420_888 format to NV21 within an image reader

為{幸葍}努か 提交于 2019-12-05 21:51:26
I configured my code in order to get a stream of YUV_420_888 frames from my device's camera using an imageReader object and the rest of the well known camera2 API. Now I need to transform these frames to NV21 pixel format and call a native function which expect a frame in this format to perform certain computations. This is the code I am using inside the imagereader callback to rearrange the bytes of the frame: ImageReader.OnImageAvailableListener readerListener = new ImageReader.OnImageAvailableListener() { @Override public void onImageAvailable(ImageReader mReader) { Image image = null;

Android Camera2 Preview is rotated 90deg while in Landscape

纵饮孤独 提交于 2019-12-05 19:45:19
I was following a youtube tutorial , trying to learn Camera2 API. Of course, I was learning this at the same time that I was developing my own app. One inconsistency between the tutorial and my app is that the tutorial made the camera in portrait mode only while my app must be in landscape. I'm currently able to view the preview of the camera, though while my app is in landscape or horizontal, the camera preview looks rotated 90 degrees. It almost feels like I can rotate the TextureView, but that just seems incorrect, like when I take a picture, it will be rotated incorrectly. Below is the

How to change aspect ratio of camera2 preview?

…衆ロ難τιáo~ 提交于 2019-12-05 14:04:37
I try to change the aspect ratio of the Camera2 preview but I fail :-( For cropping I have to use the SCALER_CROP_REGION but I don't get it working. I used the android-Camera2Video example from Google for my tests. In the openCamera method I added the following line: mSensorSize = characteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE); And in startPreview I added this: final int centerX = mSensorSize.width() / 2; final int centerY = mSensorSize.height() / 2; final int cropSize = Math.min(mSensorSize.width(), mSensorSize.height()); final Rect crop = new Rect(centerY - cropSize