草庐IT

image_representation

全部标签

python - 了解 tf.extract_image_patches 以从图像中提取补丁

我找到了以下方法tf.extract_image_patches在tensorflowAPI中,但我不清楚它的功能。假设batch_size=1,图像大小为225x225x3,我们要提取大小为32x32的block。这个函数的具体表现如何?具体来说,文档提到输出张量的维度是[batch,out_rows,out_cols,ksize_rows*ksize_cols*depth],但是out_rows和out_cols没有提到。理想情况下,给定大小为1x225x225x3的输入图像张量(其中1是批量大小),我希望能够获得Kx32x32x3作为输出,其中K是补丁的总数,32x32x3是每个

python - PIL : ImportError: The _imaging extension was built for another version of pillow or PIL

我得到错误:---------------------------------------------------------------------------ImportErrorTraceback(mostrecentcalllast)in()---->1fromPILimportImageC:\Anaconda\lib\site-packages\PIL\Image.pyin()61fromPILimport_imagingascore62ifPILLOW_VERSION!=getattr(core,'PILLOW_VERSION',None):--->63raiseImpor

python - 没有名为 Image 的模块

对不起我的语法,我不会说英语。设置文件浏览器、tinymce和grappelli后,出现此错误:NomodulenamedImagetry:fromPILimportImageexceptImportError:importImage我将它设置为PIL但它没有解决问题。我的平台窗口如果我想:pipinstallPIL`c:\Users\Kim\BitNamiDjangoStackprojects\homex8>pipinstallPILDownloading/unpackingPILRunningsetup.pyegg_infoforpackagePILWARNING:''notava

python - Pillow Image 对象和 numpy 数组之间的转换改变了维度

我正在使用Pillow和numpy,但是PillowImage对象和numpy数组之间的转换出现问题。当我执行以下代码时,结果很奇怪。im=Image.open(os.path.join(self.img_path,ifname))printim.sizein_data=np.asarray(im,dtype=np.uint8)printin_data.shape结果是(1024,768)(768,1024)为什么尺寸会改变? 最佳答案 我可能是列优先的,而numpy中的数组是行优先的做in_data=in_data.T转置pyth

python - 类型错误 : Invalid dimensions for image data when plotting array with imshow()

如下代码#NumericaloperationSN_map_final=(new_SN_map-mean_SN)/sigma_SN#Plotfigurefig12=plt.figure(12)fig_SN_final=plt.imshow(SN_map_final,interpolation='nearest')plt.colorbar()fig12=plt.savefig(outname12)new_SN_map是一维数组,mean_SN和sigma_SN是常量,我收到以下错误。Traceback(mostrecentcalllast):File"c:\Users\Valentin\

python - 使用更新的 Python 2.6.2 在 Snow Leopard 上安装 Python Imaging Library (PIL)

我全新安装(从删除的驱动器开始)SnowLeopard,并在安装SnowLeopard期间安装了开发人员工具。然后我安装了Python2.6.2,替换了SnowLeopard默认的Python2.6.1。我尝试通过以下方式安装PIL:easy_install点子下载源代码并手动运行pythonsetup.pybuild。所有都产生相同的错误(链接到pip日志:http://drop.io/gi2bgw6)。我已经看到其他人使用SnowLeopard默认python2.6.1成功安装了PIL,所以我不确定为什么我在使用2.6.2时遇到这么多麻烦。 最佳答案

Python 图像库 : How to combine 4 images into a 2 x 2 grid?

我有4个目录,其中包含用于动画的图像。我想获取一组图像并生成一个图像,其中4个图像排列成一个2x2网格,用于动画的每一帧。到目前为止我的代码是:importImagefluid64="Fluid64_half_size/00"fluid128="Fluid128_half_size/00"fluid512="Fluid512_half_size/00"fluid1024="Fluid1024_half_size/00"out_image="Fluid_all/00"forpicinrange(1,26):blank_image=Image.open("blank.jpg")ifpic不

python - PIL Image.resize() 不调整图片大小

我有一些奇怪的问题,PIL没有调整图像大小。fromPILimportImageimg=Image.open('foo.jpg')width,height=img.sizeratio=floor(height/width)newheight=ratio*150img.resize((150,newheight),Image.ANTIALIAS)img.save('mugshotv2.jpg',format='JPEG')此代码运行没有任何错误,并在正确的文件夹中生成名为mugshotv2.jpg的图像,但它不会调整它的大小。它对它有所帮助,因为图片的大小从120kb下降到20kb,但尺

python - PIL : Thumbnail and end up with a square image

打电话image=Image.open(data)image.thumbnail((36,36),Image.NEAREST)将保持纵横比。但我最终需要像这样显示图像:我可以在图像周围设置透明或白色的信箱样式吗? 最佳答案 PIL已经有一个功能可以做到这一点:fromPILimportImage,ImageOpsthumb=ImageOps.fit(image,size,Image.ANTIALIAS) 关于python-PIL:Thumbnailandendupwithasquarei

python - 导入错误 : No module named Image

这个问题在这里已经有了答案:TheproblemwithinstallingPILusingvirtualenvorbuildout(4个回答)关闭6年前。我也试过了fromPILimportImage但它给了我ImportError:NomodulenamedPIL.我已经使用成功安装了PILpipinstallpil我还安装了xcode命令行工具。似乎没有任何效果。详情:MacOSX10.9Python2.7.6python是/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonpython是/usr/bin/pyt