android-camera

Android using front facing camera to take a picture

佐手、 提交于 2019-12-31 10:35:31
问题 This is my first time using a camera. I've read a lot of examples and also the documentation, so I tried to make my own class to take pictures with the front facing camera. This is what I came up with: public class CameraController { private Context context; private boolean hasCamera; private Camera camera; private int cameraId; public CameraController(Context c){ context = c.getApplicationContext(); if(context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){ cameraId =

Save frame from TangoService_connectOnFrameAvailable

大憨熊 提交于 2019-12-31 05:52:30
问题 How can I save a frame via TangoService_connectOnFrameAvailable() and display it correctly on my computer? As this reference page mentions, the pixels are stored in the HAL_PIXEL_FORMAT_YV12 format. In my callback function for TangoService_connectOnFrameAvailable, I save the frame like this: static void onColorFrameAvailable(void* context, TangoCameraId id, const TangoImageBuffer* buffer) { ... std::ofstream fp; fp.open(imagefile, std::ios::out | std::ios::binary ); int offset = 0; for(int i

Image selected not displaying in mainActivity

非 Y 不嫁゛ 提交于 2019-12-31 05:45:07
问题 Why the image selected did not display in Claims.java ? Have I missed anything ? mainfest.xml <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" /> camera_main.xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns

Set android camera to send gray scale images

冷暖自知 提交于 2019-12-31 05:14:47
问题 Can the android camera be programmatically set to send gray scale images. I'm not asking about conversion after the images have been received, I'm asking for a way to programmatically set it like we do with fps, resolution etc. 回答1: Are you talking about the built in camera app (via an intent) or inside your app? If it's the built in camera app, i don't think it's possible, and even if it was , you can't assume it will work the same on all devices, since many of them have customized camera

Camera “Bitmap imageBitmap = (Bitmap) extras.get(”data“);” gives Nullpointer error

醉酒当歌 提交于 2019-12-31 04:56:05
问题 I am following the Android developer tutorials on camera here: https://developer.android.com/training/camera/photobasics#java I however get an error in the method onActivityResult:,java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.os.Bundle.get(java.lang.String)' on a null object reference This line is giving the error: Bitmap imageBitmap = (Bitmap) extras.get("data"); Somehow when I comment out this line then the app works: takePictureIntent.putExtra

capture photo from both front and back camera simultaneously

巧了我就是萌 提交于 2019-12-31 04:50:07
问题 I would like to develop an Android application which has the technique of capturing a photo from camera(both front and back) at simultaneously.I searched over internet but unfortunately I couldn't find any better solution. note for example if I capture the photo from back camera,once it captured from back means then it has to start front camera automatically for capture a photo. 回答1: You need to approach this problem step by step. First build functionality to take picture by back camera. Once

Get the bytes[] from a TotalCaptureResult

笑着哭i 提交于 2019-12-31 04:45:07
问题 I am getting the TotalCaptureResults object from the camera, using the Camera2 API in Android. I am using a preview, not a single image. Is there a way to get bytes[] from TotalCaptureResults? Thank you. 回答1: Short answer: no. All CaptureResults objects contain only metadata about a frame capture, no actual pixel information. The associated pixel data are sent to wherever you designated as the target Surface in your CaptureRequest.Builder . So you need to check with whatever Surface you set

Fliping the Front Camera to Back Camera in Button Click using android

独自空忆成欢 提交于 2019-12-31 04:28:47
问题 I am facing a problem with flipping the from front to back in android with in the button onClickListener. Here is my code. MainActivity.java package com.example.camerademo; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.hardware.Camera; import android.hardware.Camera.PictureCallback; import android.net.Uri; import

TextureView with camera preview

家住魔仙堡 提交于 2019-12-31 01:34:06
问题 I would like to use TextureView to show camera preview in it. Finally i want to set opacity for camera preview, using TextureView. But i have problem: 10-22 12:21:14.773: W/TextureView(5126): A TextureView or a subclass can only be used with hardware acceleration enabled. Here is my class code: public class CameraService extends Service implements android.view.TextureView.SurfaceTextureListener { private LayoutInflater layoutInflater; private Camera mCamera; private View mCameraView; private

How can I make my view pager more smooth?

纵饮孤独 提交于 2019-12-30 09:29:49
问题 I am using a view pager to show two fragments. One fragment contains a camera preview and the other one just a simple list view. The problem is, that the whole swipe experience is not as smooth as it should be. And I guess the reason for that is because the UI Thread has to handle the view pager, the camera and the list view all at once. Now, what can I do about that? What can I run in a background thread? Can I run the view pager in the background? 来源: https://stackoverflow.com/questions