69 lines
2.4 KiB
Java
69 lines
2.4 KiB
Java
|
package com.kofax.kmc.ken.engines;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.Paint;
|
||
|
import android.graphics.Path;
|
||
|
import android.graphics.Rect;
|
||
|
import com.kofax.kmc.ken.engines.data.BoundingTetragon;
|
||
|
import com.kofax.kmc.ken.engines.data.DetectionResult;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class DetectorDebugUtils {
|
||
|
private static float P = 6.0f;
|
||
|
private static Paint Q;
|
||
|
|
||
|
public static Bitmap getBitmap(DetectionResult detectionResult) {
|
||
|
Paint paint = new Paint(1);
|
||
|
Q = paint;
|
||
|
paint.setStyle(Paint.Style.STROKE);
|
||
|
Canvas canvas = new Canvas(detectionResult.getOriginalImage());
|
||
|
Q.setStrokeWidth(P);
|
||
|
Path e = e(detectionResult.getBounds());
|
||
|
Q.setColor(-65536);
|
||
|
canvas.drawPath(e, Q);
|
||
|
Rect targetRect = detectionResult.getTargetRect();
|
||
|
Path e2 = e(new BoundingTetragon(targetRect.left, targetRect.top, targetRect.right, targetRect.top, targetRect.left, targetRect.bottom, targetRect.right, targetRect.bottom));
|
||
|
Q.setColor(-16711936);
|
||
|
canvas.drawPath(e2, Q);
|
||
|
return detectionResult.getOriginalImage();
|
||
|
}
|
||
|
|
||
|
private static Path e(BoundingTetragon boundingTetragon) {
|
||
|
Path path = new Path();
|
||
|
float f = boundingTetragon.getBottomLeft().x;
|
||
|
float f2 = boundingTetragon.getBottomLeft().y;
|
||
|
float f3 = boundingTetragon.getTopLeft().x;
|
||
|
float f4 = boundingTetragon.getTopLeft().y;
|
||
|
float f5 = boundingTetragon.getTopRight().x;
|
||
|
float f6 = boundingTetragon.getTopRight().y;
|
||
|
float f7 = boundingTetragon.getBottomRight().x;
|
||
|
float f8 = boundingTetragon.getBottomRight().y;
|
||
|
StringBuilder sb = new StringBuilder("BottomLeft:");
|
||
|
sb.append(f);
|
||
|
sb.append(",");
|
||
|
sb.append(f2);
|
||
|
sb.append(", getTopLeft: ");
|
||
|
sb.append(f3);
|
||
|
sb.append(",");
|
||
|
sb.append(f4);
|
||
|
sb.append("TopRight:");
|
||
|
sb.append(f5);
|
||
|
sb.append(",");
|
||
|
sb.append(f6);
|
||
|
sb.append(" , getBottomRight");
|
||
|
sb.append(f7);
|
||
|
sb.append(",");
|
||
|
sb.append(f8);
|
||
|
com.kofax.mobile.sdk._internal.k.c("CapturePageBoundaryView", sb.toString());
|
||
|
float f9 = (P / 2.0f) - 2.0f;
|
||
|
path.reset();
|
||
|
path.moveTo(f - f9, f2 + f9);
|
||
|
path.lineTo(f3 - f9, f4 - f9);
|
||
|
path.lineTo(f5 + f9, f6 - f9);
|
||
|
path.lineTo(f7 + f9, f8 + f9);
|
||
|
path.close();
|
||
|
return path;
|
||
|
}
|
||
|
}
|