31 lines
1.2 KiB
Java
31 lines
1.2 KiB
Java
|
package com.kofax.mobile.sdk.extract.id;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import com.kofax.kmc.ken.engines.data.Image;
|
||
|
import com.kofax.mobile.sdk.capture.model.Field;
|
||
|
import com.kofax.mobile.sdk.capture.model.FieldLocation;
|
||
|
import java.io.Serializable;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class ImageField extends Field<Image> implements Serializable {
|
||
|
public ImageField(String str, Image image, double d, FieldLocation fieldLocation) {
|
||
|
super(str, image, d, fieldLocation);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk.capture.model.Field
|
||
|
public double getConfidence() {
|
||
|
return super.getConfidence();
|
||
|
}
|
||
|
|
||
|
public static ImageField fromDataField(DataField dataField, Bitmap bitmap) {
|
||
|
if (bitmap == null || dataField.getLocation().isUndefined()) {
|
||
|
return null;
|
||
|
}
|
||
|
return new ImageField(dataField.getName(), a(dataField.getLocation(), bitmap), dataField.getConfidence(), dataField.getLocation());
|
||
|
}
|
||
|
|
||
|
private static Image a(FieldLocation fieldLocation, Bitmap bitmap) {
|
||
|
return new Image(Bitmap.createBitmap(bitmap, (int) fieldLocation.origin.x, (int) fieldLocation.origin.y, (int) fieldLocation.size.width, (int) fieldLocation.size.height));
|
||
|
}
|
||
|
}
|