SegmentationConfiguration sc = new SegmentationConfiguration();
sc.setSegmentationType
(SegmentationConfiguration.TYPE_PORTRAIT);
ImageSegmentation ssEngine = new ImageSegmentation(mContext);
ssEngine.setSegmentationConfiguration(sc);
Frame frame = new Frame();
frame.setBitmap(mBitmap);
ImageResult srt = ssEngine.doSegmentation(frame, null);
Bitmap newbmp = srt.getBitmap();
{
"resultCode":0
}
可以的,在faceCompare()方法中会默认启动引擎,如果引擎已经启动则不会再次启动,开发者可以放心使用。
release()方法会卸载在NPU芯片中已经加载的模型,请在应用不再使用人像分割时及时卸载模型,释放资源。