如何使用枕头图像读取图像? [英] How do i read image using PILLOW image?

查看:121
本文介绍了如何使用枕头图像读取图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用PIL.Image.open()读取图像.但是图像位于不同的路径. 以下是我拥有python脚本的路径

I wanted read a image using PIL.Image.open().But I've image in different path. The following is the path I've the python script

"D:\YY_Aadhi\holy-edge-master\hed\test.py"

以下是我拥有图像文件的路径.

The following is the path I've the image file.

"D:\YY_Aadhi\HED-BSDS\test\2018.jpg"

from PIL import Image
'''some code here'''
image = Image.open(????)

如何填写问号以访问图像文件.

How should I fill the question mark to access the image file.

推荐答案

您可以轻松完成

from PIL import Image
image = Image.open("D:\\YY_Aadhi\\HED-BSDS\\test\\2018.jpg")

from PIL import Image
directory = "D:\\YY_Aadhi\\HED-BSDS\\test\\2018.jpg"
image = Image.open(directory)

像这样

要定义为目录时,必须在Windows中编写两次转义序列.如果您尝试一些愚蠢的代码,那就太好了.它对您有很大帮助.

you have to write escape sequence twice in windows, when you want to define as directory. and It will be great if you try some stupid code. It helps you a lot.

这篇关于如何使用枕头图像读取图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆