Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class ClassificationFrameProcessor implements FrameProcessor {
private final ModelClassificator modelClassificator;
private final ClassificationListener classificationListener;
public ClassificationFrameProcessor(ModelClassificator modelClassificator,
ClassificationListener classificationListener) {
this.modelClassificator = modelClassificator;
this.classificationListener = classificationListener;
}
@Override
public void process(@NonNull Frame frame) {
Bitmap bitmap = frameToBitmap(frame);
List<ClassificationResult> results = modelClassificator.process(bitmap);
classificationListener.onClassifiedFrame(results);
}
private Bitmap frameToBitmap(Frame frame) {
/* Conversion code specific for data from CameraView library. */
}
public interface ClassificationListener {
void onClassifiedFrame(List<ClassificationResult> classificationResults);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.