Created
June 9, 2019 12:23
-
-
Save frogermcs/bde663003e9498cbcc4461edab458224 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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