In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the python scipy.misc.imsave () function how to use the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will have a harvest after reading this python scipy.misc.imsave () function, let's take a look at it.
This function is used to store pictures and save arrays as images.
This feature is only available when Python Imaging Library (PIL) is installed. The version is also older, and the new replacement is imageio.imwrite ().
Usage: imsave (* args, * * kwds) parameters:
Name: file name or file name plus directory
The three formats of arr:np-array matrix and MxN or MxNx3 or MxNx4 correspond to grayscale image, RGB image and RGB+alpha image respectively.
Format: strtype, the type of image output, if omitted, the picture directly outputs the extension of the picture.
Usage: # Grayscale image from scipy.misc import imsavex = np.zeros ((255,255)) x = np.zeros ((255,255), dtype=np.uint8) x [:] = np.arange (255,255) imsave ('gradient.png', x) # RGB image rgb = np.zeros ((255,255,3), dtype=np.uint8) rgb [., 0] = np.arange (255,255) rgb [., 1] = 55rgb [. 2] = 1-np.arange (255) imsave ('rgb_gradient.png', rgb)
It is worth noting that by default, this function detects the range of RGB values you enter, and automatically expands the range to 0 to 255 if they are all between 0 and 1.
In other words, at this time, whether you multiply by 255 or not, the effect of the output picture is the same.
Add: imsave in scipy.misc has been disabled
Import scipy.miscdir (scipy.misc) # you can see that modules such as imsave can no longer be found in scipy1.3.1
Imageio package can be used instead
This is the end of imageio.imwrite 's article on "how to use python's scipy.misc.imsave () function". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how to use the scipy.misc.imsave () function of python". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.