hms-ml-demo icon indicating copy to clipboard operation
hms-ml-demo copied to clipboard

Black Image When setExact is FALSE

Open Mouadabdelghafouraitali opened this issue 3 years ago • 0 comments

I'm using the following code to get the foreground only from a given bitmap :

    private MLImageSegmentationAnalyzer analyzer;

    public void analyzer(Bitmap src, MLCallBack mlCallBack) {
        MLImageSegmentationSetting setting = new MLImageSegmentationSetting.Factory()
                .setExact(false)
                .setAnalyzerType(MLImageSegmentationSetting.BODY_SEG)
                .setScene(MLImageSegmentationScene.FOREGROUND_ONLY)
                .create();
        
        this.analyzer = MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(setting);
        MLFrame mlFrame = new MLFrame.Creator().setBitmap(src).create();
        Task<MLImageSegmentation> task = this.analyzer.asyncAnalyseFrame(mlFrame);
        task.addOnSuccessListener(mlImageSegmentationResults ->
                mlCallBack.onMLCompleted(mlImageSegmentationResults.getForeground()))
                .addOnFailureListener(e ->
                        mlCallBack.onMLFailed());
    }

But the output is always BLACK, when I set .setExact(true), everything works fine, I would like to speed up to background remover process that's why I set False to setExact()

Mouadabdelghafouraitali avatar Jun 16 '21 23:06 Mouadabdelghafouraitali