Giter Site home page Giter Site logo

idcardcamera's Introduction

WildmaIDCardCamera

Android自定义相机实现身份证拍照,并加入自动对焦与图片不规则裁剪

效果图:

身份证来源网络虚拟构造

功能特点

  • 自定义相机界面
  • 支持开启闪光灯
  • 支持手动触摸屏幕对焦
  • 支持自动对焦
  • 支持图片自动裁剪
  • 支持图片手动不规则裁剪

2 使用

Step 1. 添加JitPack仓库

在项目的build.gradle添加JitPack仓库

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
Step 2. 添加依赖

在需要使用的module中添加依赖

dependencies {
	compile 'com.github.wildma:IDCardCamera:1.0.0'
}

或者引用本地lib

compile project(':idcardcamera')
Step 3. 调用CameraActivity类的toCameraActivity方法打开拍照界面
CameraActivity.toCameraActivity(this, CameraActivity.TYPE_IDCARD_FRONT);
Step 4. 在onActivityResult方法中获取裁剪后的图片
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == CameraActivity.REQUEST_CODE && resultCode == CameraActivity.RESULT_CODE) {
            //获取图片路径,显示图片
            final String path = CameraActivity.getImagePath(data);
            if (!TextUtils.isEmpty(path)) {
                imageView.setImageBitmap(BitmapFactory.decodeFile(path));
            }
        }
    }

详细介绍请看文章:Android自定义相机实现身份证拍照,并加入自动对焦与图片不规则裁剪

ps:如果对你有帮助,点下star就是对我最大的认可。

感谢

idcardcamera's People

Contributors

wildma avatar

Watchers

James Cloos avatar Yooye Lu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.