Skip to content

Hair Segmentation Not working #81

Description

@abi98213

Hey team,
I am trying to run hair segmentation but it is not working and is returning null image as output.

private void createImageTransactor(Bitmap bitmap) {

        MLImageSegmentationSetting setting = new MLImageSegmentationSetting
                .Factory()
                // Set the segmentation mode to hair segmentation.
                .setAnalyzerType(MLImageSegmentationSetting.HAIR_SEG)
                .create();

        MLImageSegmentationAnalyzer analyzer = MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(setting);

        MLFrame frame = MLFrame.fromBitmap(bitmap);
        Task<MLImageSegmentation> task = analyzer.asyncAnalyseFrame(frame);

        task.addOnSuccessListener(segmentation -> {
            // Detection success.
            foregroundBitmap = segmentation.foreground;
            imageView.setImageBitmap(foregroundBitmap);
        })
                .addOnFailureListener(new OnFailureListener() {
                    @Override
                    public void onFailure(Exception e) {
                        // Detection failure.
                    }
                });
}

Here is the dependencies graph.

// Import the base SDK. implementation 'com.huawei.hms:ml-computer-vision-segmentation:2.2.0.300' // Import the multiclass segmentation model package. implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-multiclass-model:2.2.0.300' // Import the human body segmentation model package. implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-body-model:2.2.0.300' // Import the hair segmentation model package. implementation 'com.huawei.hms:ml-computer-vision-image-segmentation-hair-model:2.2.0.300'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions