Skip to main content
 首页 » 编程设计

python之SimpleCV Jpeg Streamer 仅适用于本地主机

2025年05月04日998°冷暖

当我运行以下 python 代码并连接到 chrome localhost:8080 时,我可以看到我的相机,但是如果我尝试连接到同一网络上另一台设备上 chrome 上的 TheComputersIP:8080,我将无法连接,只会出现错误连接被拒绝。我不确定如何修复它,我们将不胜感激(该脚本正在使用 PyCharm 在 Windows 上运行)。

from SimpleCV import * 
 
w=640/2 
h=480/2 
 
cam = Camera(0,{"width":w,"height":h}) 
 
disp =Display() 
 
js = JpegStreamer(8080,0.01) 
print(js.url()) 
print(js.streamUrl()) 
 
while disp.isNotDone(): 
    img = cam.getImage() 
    img.show() 
    img.save(js) 

请您参考如下方法:

现在解决了只是改变了:

js = JpegStreamer(8080,0.01) 

到:

js = JpegStreamer("0.0.0.0:8080",0.01)