我正在尝试使用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: breakBoth 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)更多推荐
发布评论