https://github.com/asynctaskcoffee/backgroundremove-hms-core
BackgroundErase with image-segmentation model HMS Core
https://github.com/asynctaskcoffee/backgroundremove-hms-core
cloud hms hmscore huawei-mobile-services imagesegmentation machine-learning
Last synced: 6 months ago
JSON representation
BackgroundErase with image-segmentation model HMS Core
- Host: GitHub
- URL: https://github.com/asynctaskcoffee/backgroundremove-hms-core
- Owner: AsynctaskCoffee
- Created: 2021-03-02T10:33:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-23T15:56:07.000Z (over 4 years ago)
- Last Synced: 2025-02-10T06:12:38.682Z (8 months ago)
- Topics: cloud, hms, hmscore, huawei-mobile-services, imagesegmentation, machine-learning
- Language: Kotlin
- Homepage:
- Size: 526 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BackgroundRemove-HMS-Core
BackgroundErase with image-segmentation model HMS Core
![]()
### Methods
```kotlin
fun onStartProcess()
fun onEndProcess()
fun onResultReady(bitmap: Bitmap?)
fun onError(exception: Exception?)
```### Lib usage
```kotlin
companion object {
private var mAnalyzer: MLImageSegmentationAnalyzerinit {
val analyzerSetting = MLImageSegmentationSetting.Factory()
.setExact(true)
.setAnalyzerType(MLImageSegmentationSetting.BODY_SEG)
.setScene(MLImageSegmentationScene.FOREGROUND_ONLY)
.create()MLAnalyzerFactory.getInstance().getImageSegmentationAnalyzer(analyzerSetting).also {
mAnalyzer = it
}
}@JvmStatic
fun eraseAndReturnResult(bitmap: Bitmap, eraserListener: EraserListener?) {
val mlFrame = MLFrame.fromBitmap(bitmap)
mAnalyzer.asyncAnalyseFrame(mlFrame)
.addOnSuccessListener { returnImageSegmentation ->
eraserListener?.onResultReady(returnImageSegmentation.foreground)
}
.addOnFailureListener { exception ->
eraserListener?.onError(exception)
}
}
}
```## Reference [HMS-Core Image Segmentation](https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/image-segmentation-0000001050040109)