我正在使用与 TensorFlow + bodypix 的反应来模糊实时视频的背景。对于视频流,我使用 Vonage (TokBox)。
我如何模糊背景
function segmentBodyInRealTime() {
async function bodySegmentationFrame() {
const multiPersonSegmentation = await estimateSegmentation(video);
drawBokehEffect(
canvas, video, multiPersonSegmentation, backgroundBlurAmount, edgeBlurAmount, props.flipHorizontal);
requestAnimationFrame(bodySegmentationFrame);
}
bodySegmentationFrame();
}
async function estimateSegmentation(image) {
let multiPersonSegmentation = null;
return await net.segmentPerson(image, {
internalResolution: props.internalResolution,
segmentationThreshold: props.segmentationThreshold,
maxDetections: props.maxDetections,
scoreThreshold: props.scoreThreshold,
nmsRadius: props.nmsRadius,
});
}
问题是,如何停止模糊?或者我怎样才能停止/销毁 BodyPix?