When creating virtual backgrounds on the web, we encountered the problem of unclear edges of portraits. What parameters can be optimized.
const optimizedVirtualBg = VirtualBackground(
'/path/to/background.jpg',
{
qualityLevel: 'accurate', // 最高精度
outputCategoryMask: true, // 启用分类蒙版
outputConfidenceMasks: false // 减少噪声
},
(stats) => {
// 实时监控处理质量
console.log(
处理时间: ${stats.processingTimeMs}ms
);
},
{
assetPaths: {
tasksVisionFileSet: '/mediapipe/wasm',
modelAssetPath: '/mediapipe/models/selfie_segmenter.tflite'
}
}
);