Wrapper around the android Camera class that simplifies its usage

Related tags

EasyCamera
Overview

EasyCamera

Wrapper around the android Camera class that simplifies its usage (read more about the process)

Usage:

// the surface where the preview will be displayed
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
EasyCamera camera = DefaultEasyCamera.open();
CameraActions actions = camera.startPreview(surfaceView.getHolder());
PictureCallback callback = new PictureCallback() {
    public void onPictureTaken(byte[] data, CameraActions actions) {
        // store picture
    }
};
actions.takePicture(Callbacks.create().withJpegCallback(callback));

By default, preview stops when a picture is taken. If you want to restart preview, specify .withRestartPreviewAfterCallbacks(true) on the Callbacks object

If you need the android.hardware.Camera object, get it via camera.getRawCamera()

How to import in maven:

    <dependency>
        <groupId>net.bozho.easycamera</groupId>
        <artifactId>easycamera</artifactId>
        <version>0.0.1</version>
        <type>aar</type>
    </dependency>

How to import in gradle:

    compile 'net.bozho.easycamera:easycamera:0.0.1:[email protected]'
Issues
  • Gradle

    Gradle

    Everything is in the title building this lib as a Gradle dependency could be a great fit to help everybody with android camera nightmare :+1:

    opened by theGlenn 6
  • Camera is Freezing

    Camera is Freezing

    After i open easycamera class, i get preview of the camera but camera is freezing.

    public class MakePhotoActivity extends Activity {

    SurfaceHolder previewHolder;
    SurfaceView mSurfaceView;
    private boolean previewIsRunning;
    private EasyCamera camera;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        mSurfaceView = (SurfaceView) findViewById(R.id.surface);
        previewHolder = mSurfaceView.getHolder();
        previewHolder.addCallback(new SurfaceHolder.Callback() {
    
            public void surfaceChanged(SurfaceHolder holder, int format,
                    int width, int height) {
                 if (!previewIsRunning && (camera != null)) {
                     try {
                        camera.startPreview(holder);
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                     previewIsRunning = true;
                 }
            }
    
            public void surfaceCreated(SurfaceHolder holder) {
    
                camera = DefaultEasyCamera.open(CameraInfo.CAMERA_FACING_FRONT);
    
            }
    
            public void surfaceDestroyed(SurfaceHolder holder) { 
                camera.close();
                camera = null;
    
            }
    
        });
    }
    

    }

    opened by enversalih 3
  • Black Screen

    Black Screen

    Hello! when I call startPreview on the onCreate method of an activity or a fragment, the surface becomes black (but my webcam turns on the led indicating it's on) it only works when i call startPreview on a click of a button or something that will happen on a later time.. How can I fix that?

    opened by rafaelcorreiapoli 3
  • Camera Example

    Camera Example

    hi there, can you please make an example for your looks like awesome api please.

    sincerely, A guy that can't get it to work.

    opened by uxmanz 3
  • Release to maven central

    Release to maven central

    A release of version 0.0.1 is to be made to Maven Central. Steps:

    • register the project at Sonatype
    • sign artifacts and stage release
    • promote release
    opened by Glamdring 1
  • please,add this to the jcenter

    please,add this to the jcenter

    Thanks you

    opened by ihrthk 1
Owner
Bozhidar Bozhanov
Bozhidar Bozhanov
Quick photo and video camera with a flash, customizable resolution and no ads.

Simple Camera A camera with flash, zoom and no ads. The camera is usable for both photo taking and video recording. You can switch between front and r

Simple Mobile Tools 552 Sep 18, 2021
A library to take picture easy, transform your data in different format and save photos in your device

A Magic library to take photos and select pictures in Android. In a simple way and if you need it also save the pictures in device, and facial recogni

Fabian Rosales (Frosquivel Developer) 329 Sep 5, 2021
Wrapper around the android Camera class that simplifies its usage

EasyCamera Wrapper around the android Camera class that simplifies its usage (read more about the process) Usage: // the surface where the preview wil

Bozhidar Bozhanov 646 Aug 3, 2021
📸 A library that allows you to capture images secretly, in background without alerting users.

HiddenCamera A library that allows you to capture images secretly, in background without alerting users. Gradle Dependency Add the dependency to your

Cotta & Cush Limited 105 Sep 18, 2021
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.

LandscapeVideoCamera Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to

Jeroen Mols 1.2k Sep 12, 2021
Measures human heart rate using camera and flash light.

Heart-Rate-Ometer Introduction Measures human heart rate using camera and flash light. How-it-works https://github.com/phishman3579/android-heart-rate

Jan Rabe 78 Jul 29, 2021
Image Picker library for Android

Ronnie-Image-Picker Asks for Camera and storage permission and return uri of the images taken or picked from the gallery. Min Api Level: 16 Build Syst

Ronnie Otieno 16 Sep 9, 2021
Pix is a Whatsapp image picker replica. with this, you can integrate an image picker just like WhatsApp.

Pix (WhatsApp Style Image and Video Picker) Pix is a WhatsApp image picker replica. with this you can integrate a image picker just like WhatsApp. Upc

Akshay sharma 618 Sep 11, 2021
Android library to choose image from gallery or camera with option to compress result image

ImagePicker Android library to choose image from gallery or camera with option to compress result image. Download Add this to your project's build.gra

Mayank Nagwanshi 63 Sep 6, 2021
Instagram like Image Picker for Android

ImagePicker A simple Instagram like library to select images from the gallery and camera. Screenshot Usage For full example, please refer to the sampl

Akvelon 16 Aug 20, 2021