angular - ml5 问题。不要以角度反映 ml5 uNet
问题描述
我尝试以角度应用uNet。我已经完成了打开我的摄像头。
但不要应用 uNet .. 只是凸轮视图
所以我猜这个问题。result.backgroundMask = 未定义
为什么 result.backgroundMask 未定义。我不知道...
请回答..
private createCanvas() {
this.p5 = new p5(this.sketch.bind(this));
}
private sketch(p: any) {
p.setup = () => {
p.createCanvas(600, 600).parent('bodyPix-canvas');
this.video = p.createCapture(p.VIDEO);
this.video = this.video.position(0, 0);
this.video.size(p.width, p.height);
this.video.hide();
this.segmentationImage = p.createImage(p.width, p.height);
this.video.elt.onloadeddata = () => {
this.uNet.segment(this.video, this.gotResult.bind(this));
};
};
}
gotResult(error, result) {
// if there's an error return it
if (error) {
console.error(error);
return;
}
// set the result to the global segmentation variable
this.segmentationImage = result.image ? result.image : this.video;
this.draw();
// Continue asking for a segmentation image
this.uNet.segment(this.video, this.gotResult.bind(this));
}
draw() {
this.p5.background(0);
this.p5.image(this.segmentationImage, 0, 0, this.p5.width, this.p5.height);
}
解决方案
推荐阅读
- javascript - 在调试模式下,图像和视频未使用 axios 上传到服务器
- python - 实现后缀树
- node.js - codewithmosh NodeJS 课程几次要求我更改我的 NODE_ENV - 在 Windows 上不起作用?
- reactjs - 使用 Moment React 格式化日期
- python - 如何根据前一行合并数据框中的行?
- python - 如何仅替换第二次出现的 re.search() 组
- c# - 如何调整 ListBoxItems 的大小以适合容器?
- java - Spring @Qualifer 不与实现多个接口的 Bean 一起使用
- git - Git - 从分支的历史记录中删除文件
- android - 致命异常 android.view.InflateException:布局/activity_main 中的二进制 XML 文件行 #291:二进制 XML 文件行