I'm studying the Python Numpai tutorial (https://cs231n.github.io/python-numpy-tutorial/) and I'm asking because I got an error.
<Before correction>
from scipy.miscimportimread,imsave,imresize
img = imread('cat.jpg')
print(img.dtype, img.shape)
img_tinted = img * [1, 0.95, 0.9]
img_tinted = imresize(img_tinted, (300, 300))
imsave('cat_tinted.jpg', img_tinted)
The original code is the same as above, but I modified the code as below because I heard that the spike module cannot be used. The picture has been saved, but the following statement appears. How do I solve this problem?
<After modifying>
from imageio import read, write
from skimage.transform import resize
img = imread ('cat.jpg') #Reads the image in an array
print (img.dtype, img.shape) #data type, size output
img_tinted = img * [1,0.95, 0.9] #ColorChannel is multiplied by a constant value to change color (RGB)
image_tinted = resize(img_tinted, (300, 300)) #colorchangeimage pixel size change
imwrite('cat_tinted.jpg',img_tinted) #Write to complete
Unlike the error, warning is not stopped because of a problem, but just think of it as "There are some problems, so know it."
The warning you showed is what happens when you try to image the float type value, and it tells you that some information is lost because the values below the decimal point are lost.
In other words, you don't have to worry about it, and if you really want to erase that warning, change the values of img_tinted to int and then write it.
549 PHP ssh2_scp_send fails to send files as intended
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
710 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.