BlinkID / blinkid-android

Everything you need to add AI-driven ID scanning into your native Android app.
https://microblink.com/identity/identity-document-scanning/
438 stars 153 forks source link

How to differentiate scan document #240

Closed samirpramanik closed 1 year ago

samirpramanik commented 3 years ago

Description

We are using your sample - BlinkID-CustomCombinedSample and the recognizer - BlinkIdCombinedRecognizer. We understand that this is a common recognizer for all documents, but we wish to restrict the recognizer to scan a specific type of document. Can this be achieved using any filters? For example while scanning passport, it should not recognize id card mrz.

mparadina commented 3 years ago

Hi @samirpramanik

You can filter which document you want to scan with the classInfo feature with the BlinkID recognizer.

With this feature, you can get the document type, country, and region.

More information here: https://blinkid.github.io/blinkid-android/com/microblink/entities/recognizers/blinkid/generic/BlinkIdCombinedRecognizer.html#setClassFilter-com.microblink.entities.recognizers.blinkid.generic.ClassFilter-

For instance, if you want to limit the scanning to only be for the Belgium ID, the sample code would be:


      recognizer = new BlinkIdCombinedRecognizer();

        recognizer.setClassFilter(new ClassFilter() {
            @Override
            public boolean classFilter(@NonNull ClassInfo classInfo) {
                return classInfo.getCountry().equals(Country.BELGIUM) && classInfo.getType().equals(Type.ID);
            }
            @Override
            public int describeContents() {
                return 0;
            }
            @Override
            public void writeToParcel(Parcel dest, int flags) {
            }
        });

Let me know if you have any additional questions.

Regards, Milan

anjapenic commented 3 years ago

Hello @samirpramanik,

Just wanted to make a follow-up here, is there anything else we could assist with?

Best regards, Anja

mohamadbadr commented 2 years ago

I have tried using the class filter, but it still scans a document with class type NONE and country NONE.

however im looking for class type ID only and country egypt

private val classFilter = object : ClassFilter {
        override fun describeContents(): Int {
            return 0
        }

        override fun writeToParcel(dest: Parcel?, flags: Int) {
            // no-op
        }

        override fun classFilter(classInfo: ClassInfo): Boolean {
            return classInfo.country == Country.EGYPT && classInfo.type == Type.ID
        }
    }
anjapenic commented 2 years ago

Hi @mohamadbadr,

Could you please contact us at support@microblink.com so we could inspect your license key and see where's the issue here?

Best regards, Anja

krizaa commented 1 year ago

This issue was closed because it has been inactive for such a long time. If the issue persists, please open a new one.