what-the-bank/sources/com/google/android/gms/vision/face/LargestFaceFocusingProcesso...

51 lines
1.7 KiB
Java

package com.google.android.gms.vision.face;
import android.util.SparseArray;
import com.google.android.gms.vision.Detector;
import com.google.android.gms.vision.FocusingProcessor;
import com.google.android.gms.vision.Tracker;
/* loaded from: classes2.dex */
public class LargestFaceFocusingProcessor extends FocusingProcessor<Face> {
public LargestFaceFocusingProcessor(Detector<Face> detector, Tracker<Face> tracker) {
super(detector, tracker);
}
/* loaded from: classes2.dex */
public static class Builder {
private LargestFaceFocusingProcessor zzcp;
public Builder(Detector<Face> detector, Tracker<Face> tracker) {
this.zzcp = new LargestFaceFocusingProcessor(detector, tracker);
}
public Builder setMaxGapFrames(int i) {
this.zzcp.zza(i);
return this;
}
public LargestFaceFocusingProcessor build() {
return this.zzcp;
}
}
@Override // com.google.android.gms.vision.FocusingProcessor
public int selectFocus(Detector.Detections<Face> detections) {
SparseArray<Face> detectedItems = detections.getDetectedItems();
if (detectedItems.size() == 0) {
throw new IllegalArgumentException("No faces for selectFocus.");
}
int keyAt = detectedItems.keyAt(0);
float width = detectedItems.valueAt(0).getWidth();
for (int i = 1; i < detectedItems.size(); i++) {
int keyAt2 = detectedItems.keyAt(i);
float width2 = detectedItems.valueAt(i).getWidth();
if (width2 > width) {
keyAt = keyAt2;
width = width2;
}
}
return keyAt;
}
}