【发布时间】:2014-05-30 00:29:31
【问题描述】:
当我在 processing.js 中从网络摄像头生成图像后尝试在舞台/画布上进行旋转时,我得到一个“未捕获的类型错误:未定义不是函数”。 没有旋转代码可以正常工作。并在“正常”处理中正常工作。 有任何想法吗?我不是在转换网络摄像头图像,而是它的副本。但似乎它失败了,并且只有在它之后添加旋转之后 - 在网络摄像头图像的副本上。有任何想法吗?几个星期以来我一直在反对这个......
void setup() {
size(800, 600,P3D);
ctx = externals.context;
}
void draw() {
pushMatrix();
ctx.drawImage(video, 0, 0, width, height); // <--fails here.
img=get();
pushMatrix();
translate(width/2, height/2);
rotateX(radians(20));
// do something
}
// video is defined outside processing code in js:
function successCallback(stream) {
// Set the source of the video element with the stream from the camera
if (video.mozCaptureStream) {
video.mozSrcObject = stream;
} else {
video.src = (window.URL && window.URL.createObjectURL(stream)) || stream;
}
video.play();
}
【问题讨论】:
-
你能发布一个最小的工作示例来复制这个问题吗?
标签: javascript canvas webcam processing.js