I am writing python code to take an image from the Internet and calculate the standard deviation, ... and do other image processing with it. I have the following code:
from scipy import ndimage from urllib2 import urlopen from urllib import urlretrieve import urllib2 import Image import ImageFilter def imagesd(imagelist): for imageurl in imagelist: opener1 = urllib2.build_opener() page1 = opener1.open(imageurl) im = page1.read() #localfile = urlretrieve( #img = Image.fromstring("RGBA", (1,1), page1.read()) #img = list(im.getdata()) # page1.read() print img #standard_deviation(p
Now I keep going back and forth because I'm not sure how to take the image directly from the Internet without saving it to disk and passing it to the standard reject function.
Any hints / help would be greatly appreciated.
Thank.
PIL ( Python Imaging Library) from fromstring frombuffer , . page1.read(), . PIL , "Image.open", , (,.jpg, gif, .png )
page1.read()
- :
from cStringIO import StringIO (...) data = StringIO(page1.read()) img = Image.open(data)
Source: https://habr.com/ru/post/1730181/More articles:how does the new keyword work in hql? - javaDecompile JavaEE - javaCount words like Microsoft Word - javascriptIs there even a quick embedding of a multi-line character string in unicode wstring? - cClassLoader in a virtual machine - javaXSL - passing through nodes in XML - htmlС# Конвертер из html в pdf, xls - htmlconst and pointers - c ++Как я могу убедиться, что объект boost:: optional инициализируется в release-сборке? - c++Noobie WPF namespace and converter problem - namespacesAll Articles