android-camera

1.6 to 2.1 CameraInfo alternative?

耗尽温柔 提交于 2019-12-25 02:22:27
问题 android.Camera.Preferences.setRotation documentation public void onOrientationChanged(int orientation) { if (orientation == ORIENTATION_UNKNOWN) return; android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.getCameraInfo(cameraId, info); orientation = (orientation + 45) / 90 * 90; int rotation = 0; if (info.facing == CameraInfo.CAMERA_FACING_FRONT) { rotation = (info.orientation - orientation + 360) % 360; } else { // back-facing camera

will onActivityResult() restart my activity?

痴心易碎 提交于 2019-12-24 18:17:48
问题 In my activity I am setting all the Views like ImageView, TextViews with theirs respective data using AsyncTask. after asyncTask.Execute(); I have a textView.onCLickListener which calls Camera and after the picture is taken, the ImageView in the activity is set to this pic. But the problem is my asyncTask is called again after the onActivityResult(); Here is my complete Activity code: public class UserProfileActivity extends Activity { //many instance fiels here @Override protected void

How to make threads work in Series

不问归期 提交于 2019-12-24 17:27:28
问题 I have created a CameraApp . And getting byte[] cameraPreviewCallback in onPreviewFrame(byte byteArray[] , Camera camera) I am converting these byteArray to rgb and doing a lot of stuff too. So It is working slowly. So I think I should get benefit from java.util.concurrent package. But didn't find an easy way to handle what I want. I want multiple threads to do my job serially but each time one can set bitmap to surfaceView . And also have to check that: No Old byte of Array shouldn't be draw

Can I take a picture using the front camera on Samsung Galaxy Tab (Android 2.2) ?

回眸只為那壹抹淺笑 提交于 2019-12-24 16:03:27
问题 Can I take a picture from the front camera? My application has an input form for inventory. If an user sends a data, the user's face pic is also sent to the server for authorization / validation. I will put the app on Samsung Galaxy Tab (Android 2.2). Is there any way to take a picture from the front camera? 回答1: For 2.2 Camera cam = Camera.open(); cam.setDisplayOrientation(90); cam.setPreviewDisplay(holder); Camera.Parameters para = cam.getParameters(); para.set("camera-id", 2); cam

data byte array size different for onPictureTaken and onPreviewFrame

限于喜欢 提交于 2019-12-24 15:03:31
问题 Why is the data byte array size different for onPictureTaken(byte[] data, Camera camera) and onPreviewFrame(byte[] data, Camera camera). The former has the original image and hence gives me a clean image and the latter gives me a pixelated image. I am not using onPictureTaken because it does not get triggered sometimes. If my picture size is 1600 x 1400 and screen size is 800 x 480 onPictureTaken gives me 1600 x 1400 and onPreviewFrame gives me 800 x 480 This is my code: mCamera

Camera Using custom Camera Preview Renderer is not clear

别来无恙 提交于 2019-12-24 11:56:09
问题 I am using the following link to display the camera preview using Custom renderers https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/view/ I was able to bring up the camera preview. But the preview is not at all clear. There is no Auto focus as well. Screenshot for reference How can I make the camera preview clearer, because I wish to use the same later on for OCR. Thanks, 回答1: I think you already figured this out but I'm going to post the solution

Android. Couldn't load gpuimage-library

ぐ巨炮叔叔 提交于 2019-12-24 10:48:49
问题 I just downloaded GPUImageLibrary 1.2.3 snapshot and import the library and the sample project. In the sample app, when i pick image from gallery, everything works fine. But everytime i try to pick image from camera, the app crashes. package jp.co.cyberagent.android.gpuimage; public class GPUImageNativeLibrary { static { //there is the crash happened System.loadLibrary("gpuimage-library"); } public static native void YUVtoRBGA(byte[] yuv, int width, int height, int[] out); public static

Picture saving in emulator but not on device

喜欢而已 提交于 2019-12-24 10:39:15
问题 I am using the following code to save/ load my picture OnCreate(){ super.onCreate(); setContentView(...) .... setImage(); } protected void onResume(){ super.onResume(); setImage(); } protected void onRestoreInstanceState(Bundle savedInstanceState){ super.onRestoreInstanceState(savedInstanceState); setImage(); } protected void onPostResume(){ super.onPostResume(); setImage(); } private void setImage(){ if(loadPicture(getIntent().getStringExtra("position"),bitmap ) != null){ Toast.makeText(this

Android L - Take flash image with autofocus using Camera2 api

微笑、不失礼 提交于 2019-12-24 10:35:29
问题 Following camera2basic guide on Android L preview page, I am able to capture normal images, i.e. without flash or using auto-focus mechanism (I rely on passive focus) However, I would like to take a flash image. The documentation states before taking flash image, I should call android.control.aePrecaptureTrigger to determine correct exposure. My question: How can I call AE Precapture trigger, wait for it to complete and then take the image using capture(CaptureRequest, CameraCaptureSession