I am trying to read a png
image in python. The imread
function in scipy
is being deprecated and they recommend using imageio
For the better answer, you can use these lines of code. Here is the example maybe help you :
image = cv2.imread('/home/pictures/1.jpg')
plt.imshow(image)
plt.show()
In imread()
you can pass the directory .so you can also use str()
and +
to combine dynamic directories and fixed directory like this:
path = '/home/pictures/'
for i in range(2) :
image = cv2.imread(str(path)+'1.jpg')
plt.imshow(image)
plt.show()
Both are the same.