Git Product home page Git Product logo

idcardcamera's Introduction

身份证拍照Lib使用文档

必须

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'com.github.zqf-dev:IDCardCamera:1.0.1'
 }

使用

1、正反面拍照or[相册选择]

*注 【原有的单独拍照Type、调用方式不变】
TYPE_IDCARD_FRONT:正
TYPE_IDCARD_BACK:反

新增的Type[传入此类型即可]
TYPE_IDCARD_All:正反面

IDCardCameraSelect.create(this).openCamera(IDCardCameraSelect.TYPE_IDCARD_All);

*注
	由于【相册选择】图片时可能存在不规则的图片以及不知道身份证的具体位置,故此默认做了裁剪、移动、放大、缩小功能,此目的主要为了减少噪声干扰,提高识别正确率避免用户二次选择操作。

2、返回的结果

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == IDCardCameraSelect.RESULT_CODE) {
            List<String> path = IDCardCameraSelect.getImagePath(data);
            if (path != null && path.size() > 0) {
            	//解析path返回bitmap,则可回调到UI层显示Bitmap
                Bitmap bitmap = BitmapFactory.decodeFile(path.get(0 / 1));
    	}
	}
}

3、清除缓存

* 建议在页面销毁时处理
FileUtils.clearCache(getApplicationContext());

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.