Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

front camera take very dark capture in android

I am taking photo capture using front camera using my custom camera app not using system camera app.But the captured photo is very dark so can see photo properly.

my code

mCamera = Camera.open(1);
Camera.Parameters params =mCamera.getParameters();
params.setSceneMode(Camera.Parameters.SCENE_MODE_NIGHT);
mCamera.setParameters(params);

And to take picture

if (mCamera != null) {
try {
 mCamera.setPreviewDisplay(mSurfaceHolder);
 mCamera.startPreview();
 mCamera.takePicture(null, mPictureCallback,
 mPictureCallback);
} catch (IOException e) {
 e.printStackTrace();
    }
}

Thanks in advance. Please give me suggestions. any help will be appreciated.

like image 891
kiran boghra Avatar asked Dec 16 '13 10:12

kiran boghra


People also ask

How to take a picture in Android app?

Take photos 1 Request the camera feature. If an essential function of your application is taking pictures, then restrict its visibility on Google Play to devices that have a camera. 2 Take a photo with a camera app. ... 3 Get the thumbnail. ... 4 Save the full-size photo. ... 5 Add the photo to a gallery. ... 6 Decode a scaled image. ...

When does the camera in an Android phone do autofocus activity?

The camera in an android phone does the autofocus activity after the start of the preview and before capturing the picture. The code snippet in the question mentions call to mCamera.takePicture (null, mPictureCallback,mPictureCallback); right after mCamera.startPreview ();.

How to save full size photos on Android phone camera?

The Android Camera application saves a full-size photo if you give it a file to save into. You must provide a fully qualified file name where the camera app should save the photo. Generally, any photos that the user captures with the device camera should be saved on the device in the public external storage so they are accessible by all apps.

How to get the image from the intent in Android camera?

The Android Camera application encodes the photo in the return Intent delivered to onActivityResult() as a small Bitmap in the extras, under the key "data". The following code retrieves this image and displays it in an ImageView.


Video Answer


2 Answers

To solve this problem you could take the picture after some time. Try this:

new Handler().postDelayed(new Runnable() {
  @Override
  public void run() {
      camera.takePicture(null, null, cameraCallback);
  }
}, 1000);
like image 181
Alessandro Roaro Avatar answered Sep 21 '22 18:09

Alessandro Roaro


I have found following solution for this, And that worked for me

Wait for some time i.e. 500 ms before capture image using

mCamera.takePicture(null, mPictureCallback,mPictureCallback);
like image 38
kiran boghra Avatar answered Sep 18 '22 18:09

kiran boghra