Python: Urllib2 and OpenCV
问题 I have a program that saves an image in a local directory and then reads the image from that directory. But I dont want to save the image. I want to read it directly from the url. Here's my code: import cv2.cv as cv import urllib2 url = "http://cache2.allpostersimages.com/p/LRG/18/1847/M5G8D00Z/posters/curious-cat.jpg" filename = "my_test_image" + url[-4:] print filename opener = urllib2.build_opener() page = opener.open(url) img= page.read() abc = open(filename, "wb") abc.write(img) abc