OpenCv使用IP摄像头照片(OpenCv using an IP camera photo)

编程入门 行业动态 更新时间:2024-10-26 08:31:00
OpenCv使用IP摄像头照片(OpenCv using an IP camera photo)

我正在尝试使用Android IP摄像头拍摄的照片在opencv中工作(http://192.168.0.10:8080/shot.jpg),但它不起作用,我得到一个空白的窗口。 我尝试了另一张图片(http://images2.wikia.nocookie.net/_ cb20110420175105 / agallas / es / images / thumb / 1/11 / Agallas-el-perro-cobarde-125 (1).jpg / 640px- Agallas-el-perro-cobarde-125_(1).jpg),它完美无缺。 为什么它不适用于使用ip camera拍摄的照片?

import sys, cv import numpy as np #photo = "http://images2.wikia.nocookie.net/__cb20110420175105/agallas/es/images/thumb/1/11/Agallas-el-perro-cobarde-125_(1).jpg/640px-Agallas-el-perro-cobarde-125_(1).jpg" photo = "http://192.168.0.10:8080/shot.jpg" img=cv.CaptureFromFile( photo ) while True: frame = cv.QueryFrame(img) cv.ShowImage('Foto',frame) if cv.WaitKey(30)==27: break

两张图片都有相同的尺寸

I am trying to work in opencv with a photo that I took with the Android IP camera (http://192.168.0.10:8080/shot.jpg), but it doesnt work, I get a blank window. I tried with another image (http://images2.wikia.nocookie.net/_cb20110420175105/agallas/es/images/thumb/1/11/Agallas-el-perro-cobarde-125(1).jpg/640px-Agallas-el-perro-cobarde-125_(1).jpg) and It works perfectly. Why doesn't it work with the photo taken with the ip camera?

import sys, cv import numpy as np #photo = "http://images2.wikia.nocookie.net/__cb20110420175105/agallas/es/images/thumb/1/11/Agallas-el-perro-cobarde-125_(1).jpg/640px-Agallas-el-perro-cobarde-125_(1).jpg" photo = "http://192.168.0.10:8080/shot.jpg" img=cv.CaptureFromFile( photo ) while True: frame = cv.QueryFrame(img) cv.ShowImage('Foto',frame) if cv.WaitKey(30)==27: break

Both pictures have the same dimensions

最满意答案

这可能不是一个非常有效的方法来解决我的问题,但它的工作原理。

import urllib import cv urllib.urlretrieve("http://192.168.0.10:8080/shot.jpg", "foto.jpg") imagen=cv.LoadImage('foto.jpg') cv.ShowImage('Image',imagen)

This could be not a very efficient way to solve my problem, but it works.

import urllib import cv urllib.urlretrieve("http://192.168.0.10:8080/shot.jpg", "foto.jpg") imagen=cv.LoadImage('foto.jpg') cv.ShowImage('Image',imagen)

更多推荐

本文发布于:2023-08-03 17:00:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1393527.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:摄像头   照片   IP   OpenCv   camera

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!