简体   繁体   English

Three.js:网络摄像机的纹理

[英]Three.js : Texture from an IP Camera


So I'm having some troubles to put the video of an Axis Camera into a Texture. 因此,在将Axis Camera的视频放入纹理时遇到了一些麻烦。 The Axis Camera is returning the wanted video into a picture. Axis Camera正在将所需的视频转换为图片。 The picture src is the camera IP address. 图片src是摄像机IP地址。

I wanted to put directly the picture into the texture, but I got an error from the Cross-origin resource sharing... I did some research on Internet and I found this link . 我想直接将图片放入纹理中,但是跨域资源共享却出错了……我在Internet上做了一些研究,发现了这个链接 Therefore, I wrote the exact same code and it worked well with the webcam, and the 71st version of Three Js ! 因此,我编写了完全相同的代码,并且与网络摄像头以及《三剑客》的第71版完全兼容! However, when I wanted to test it with my axis camera, it was sending me the same error : 但是,当我想用​​我的轴心相机进行测试时,它向我发送了相同的错误:

Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Tainted canvases may not be loaded.

Does someone have an idea about how to solve this problem ? 有人对如何解决这个问题有想法吗?

I finally get it ! 我终于明白了! So it's indeed a CROS problem. 因此,这确实是一个CROS问题。 Put just the crossOrigin image at "anonymous" wasn't the good solution, because the CROS was always a problem, since the picture I want to use is from another IP address... 仅将crossOrigin图像置于“ anonymous”不是一个好的解决方案,因为CROS始终是个问题,因为我要使用的图片来自另一个IP地址...

So what I needed to do is only to put some attributes to Chrome : 因此,我要做的只是将一些属性添加到Chrome:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir="D:\chrome"

And that's working ! 而且有效! ^u^ Warning though, you need to create another shortcut exclusively for your work and you mustn't use that to search on the internet ! ^ u ^警告,您需要专门为您的工作创建另一个快捷方式,并且不得使用该快捷方式在Internet上搜索!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM