android-camera

How to use Android MediaCodec encode Camera data(YUV420sp)

偶尔善良 提交于 2019-12-18 12:19:35
问题 Thank you for your focus! I want to use Android MediaCodec APIs to encode the video frame which aquired from Camera, unfortunately, I have not success to do that! I still not familiar with the MediaCodec API。 The follow is my codes,I need your help to figure out what I should do. 1、The Camera setting: Parameters parameters = mCamera.getParameters(); parameters.setPreviewFormat(ImageFormat.NV21); parameters.setPreviewSize(320, 240); mCamera.setParameters(parameters); 2、Set the encoder: private

Android Intent for Capturing both Images and Videos?

爷,独闯天下 提交于 2019-12-18 12:08:51
问题 Is there an Intent for starting a camera with options to capture both Pictures and Videos on Android? I've used both MediaStore.ACTION_VIDEO_CAPTURE and MediaStore.ACTION_IMAGE_CAPTURE to capture either audio or video, but I can't find an Intent that will get the option for switching between both of them, as in this example app: Thanks! 回答1: It is not possible to capture both image and video using the same intent, Your options are 1) Create your own camera this repo can be a good start But it

Upload camera photo and filechooser from webview INPUT field

十年热恋 提交于 2019-12-18 11:43:04
问题 My app is webbased and I need to upload pictures from an INPUT field camp. I've two situations and as i don't know another way to do it depending the page I'm choosing one or another with "boolean boolFileChoser" depending its URL petition: a. file picker b. camera photo shoot. I've dealt with file picker and it upload the file perfectly, the problem is with the camera. Once i try to upload the Camera Pic, it crashes. As far as i know its because the URI. a) File picker: content://media

Convert Android camera2 api YUV_420_888 to RGB

拜拜、爱过 提交于 2019-12-18 11:25:42
问题 I am writing an app that takes the camera feed, converts it to rgb, in order to do some processing. It works fine on the old camera implementation which uses NV21 Yuv format. The issue I am having is with the new Yuv format, YUV_420_888. The image is no longer converted correctly to RGB in the new Camera2 Api which sends YUV_420_888 yuv format instead of NV21 (YUV_420_SP) format. Can someone please tell me how should I convert YUV_420_888 to RGB? Thanks 回答1: In my approach I use OpenCV Mat

Camera on Android Example

蹲街弑〆低调 提交于 2019-12-18 10:16:37
问题 I want to write an activity that: Shows the camera preview (viewfinder), and has a "capture" button. When the "capture" button is pressed, takes a picture and returns it to the calling activity (setResult() & finish()). Are there any complete examples out there that works on every device ? A link to a simple open source application that takes pictures would be the ideal answer. My research so far: This is a common scenario, and there are many questions and tutorials on this. There are two

Android 5.0 Wrong crop regions on preview surface and captured still image

霸气de小男生 提交于 2019-12-18 08:33:34
问题 I'm trying to get digital zoomed frame on Android 5.0 with camera2 interface. Appropriate doc for that functionality is developer.android.com/camera2/captureRequest Surface used in my application: SurafaceView (1920x1080, 16:9 aspect ratio) ImageReader (3264x2448, 4:3 aspect ratio) Camera's sensor size is 3280x2464 (4:3 aspect ratio) Crop region which I want to get from sensor is: Rect zoomCropPreview = new Rect(1094, 822, 2186, 1642); //(1092x820, 4:3 aspect ratio) I set this Rect as

saving pictures taken by camera in android app

元气小坏坏 提交于 2019-12-18 07:24:15
问题 I have been stuck on this for a while now and have looked at various tutorials for help but have not yet succeeded. I have essentially utilised the camera function in my app to take pictures and display a preview of it BUT it can't save taken picture. Here is the java code containing my attempt to get it functioning according to tutorials: public class Activity_Camera extends Activity implements View.OnClickListener { ImageButton ib; ImageView iv; Intent i; public static final int cameraData

Why does a blurry image appear in a simple android camera app?

半腔热情 提交于 2019-12-18 07:14:35
问题 I tried to make a simple camera app that captures an image and views the image in an imageview: I tried this code in MainActivity: ImageView myImageView; public void myButtonCamera (View view){ Intent cameraIntent = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, 10); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data){ super.onActivityResult(requestCode,resultCode,data); if (resultCode == RESULT_OK){ if

android pass media data to another activity [duplicate]

99封情书 提交于 2019-12-18 07:14:10
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Passing image from one activity another activity my app uses following logic: a button click in Activity A starts the phone camera, after a picture/video is taken (the user pressed "save" in the camera window) Activity B starts. That Activity B contains a preview of taken picture/video and the possibility to upload the media data via a http request. I'm not sure how to pass the taken Image/Video to Activity B..

Updating gallery after taking pictures Gallery not showing all the pictures Android Camera

家住魔仙堡 提交于 2019-12-18 07:07:15
问题 I am using a onClick over a button to capture an image. PictureCallback myPictureCallback_JPG = new PictureCallback() { @Override public void onPictureTaken(byte[] arg0, Camera arg1) { FileOutputStream outStream = null; try { // Write to SD Card outStream = new FileOutputStream(String.format("/sdcard/%d.jpg", System.currentTimeMillis())); outStream.write(arg0); outStream.close(); Toast.makeText(Photo.this, "Image Saved to SD Card", Toast.LENGTH_SHORT).show(); System.out.println(); } catch