android-camera

Convert android.media.Image (YUV_420_888) to Bitmap

依然范特西╮ 提交于 2020-01-09 10:06:39
问题 I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. I successfully receive callbacks using onImageAvailableListener, but for future processing I need to obtain bitmap from YUV_420_888 android.media.Image. I searched for similar questions, but none of them helped. Could you please suggest me how to convert android.media.Image (YUV_420_888) to Bitmap or maybe there's a better way of

Convert android.media.Image (YUV_420_888) to Bitmap

蹲街弑〆低调 提交于 2020-01-09 10:05:15
问题 I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. I successfully receive callbacks using onImageAvailableListener, but for future processing I need to obtain bitmap from YUV_420_888 android.media.Image. I searched for similar questions, but none of them helped. Could you please suggest me how to convert android.media.Image (YUV_420_888) to Bitmap or maybe there's a better way of

How can I open front camera using Intent in android?

北城以北 提交于 2020-01-09 03:51:06
问题 I want to make a app in which I have to open only front camera, How can i do it using intent ? private void captureImage() { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); intent.putExtra("android.intent.extras.CAMERA_FACING", 1); // start the image capture Intent startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE); } 回答1: java Intent intent = new Intent(MediaStore

Android M Camera Intent + permission bug?

此生再无相见时 提交于 2020-01-08 13:56:13
问题 I'm trying to get my app ready for the new Android M permissions changes and found some weird behaviour. My app uses the Camera intent mechanism to allow the user to get a picture form the camera. But in another activity needs to make use of the camera itself with Camera permission (because of a library dependency card.io that requires this). However with M in the activity that only needs a camera intent when I try to launch the Camera intent I see the following crash (this does not happen if

Android M Camera Intent + permission bug?

我怕爱的太早我们不能终老 提交于 2020-01-08 13:56:03
问题 I'm trying to get my app ready for the new Android M permissions changes and found some weird behaviour. My app uses the Camera intent mechanism to allow the user to get a picture form the camera. But in another activity needs to make use of the camera itself with Camera permission (because of a library dependency card.io that requires this). However with M in the activity that only needs a camera intent when I try to launch the Camera intent I see the following crash (this does not happen if

Why does flash drives app in stack? CONTROL_AE_MODE_ON_ALWAYS_FLASH Camera2API

人盡茶涼 提交于 2020-01-07 09:23:35
问题 There is weird situation. I took standard google sample camera2API. I need that flash is worked permanently, regardless of outside light. In order to accomplish it i have changed one line of code: private void setAutoFlash(CaptureRequest.Builder requestBuilder) { if (mFlashSupported) { // requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH); requestBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH); } } It

Android camera photo take FileNotFoundException

半世苍凉 提交于 2020-01-07 04:51:07
问题 ORIGINAL :In my application i am calling native camera from code, my intent to take a picture from camera and get its file path also show it in the image view. code below is calling from AlertDialog.Builder //run camera builder.setNegativeButton("Resim Cek", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //native camera // here,counter will be incremented each time,and the picture taken by camera will be stored as 1.jpg,2.jpg and

Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { }} to activity

爷,独闯天下 提交于 2020-01-07 03:11:15
问题 I have a method that gives users the option to use the camera intent to capture a photo to then upload to the application: public void UploadImageToFeed() { CharSequence colors[] = new CharSequence[] {"Gallery", "Take a Picture"}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Upload an Image"); builder.setIcon(R.drawable.ic_upload_image); builder.setItems(colors, (dialog, which) -> { if (which == 0) { Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);

Uri returned in camera intent is null [duplicate]

情到浓时终转凉″ 提交于 2020-01-07 03:05:39
问题 This question already has answers here : Android camera photo comes back null (2 answers) Closed 4 years ago . I am trying to create and Android application that takes a photo or uploads a photo to the server. My main objective is to get the URI of the photo which is returned in the intent. I have followed the steps from [1]. The problem is that on a phone with Lollipop, version 5.1.1 it works fine and the intent returns the URI of the photo, but on a phone which has Jelly Bean, version 4.2.1

Asus Nexus 7 2013 camera.open Fail to connect to camera service

久未见 提交于 2020-01-06 20:12:39
问题 I have an issue only on Asus Nexus 7 2013 . All other devices, including Asus Nexus 7 2012 works fine. This device has 2 camera IDs: 0, 1. But I can't open camera, using both of them. //... try { //cameraID: 0 or 1 camera = Camera.open(cameraID); //... } catch (Exception e) { e.printStackTrace(); } So I getting: java.lang.RuntimeException: Fail to connect to camera service android.hardware.Camera.<init>(Camera.java:495) android.hardware.Camera.open(Camera.java:341) 回答1: Problem was in new