Numpy Array To Jpg

Scikit-image: image processing¶ Author: Emmanuelle Gouillart. size[0], pic. Arrays are similar to lists in Python, except that every element of an array must be of the same type, typically a numeric type like float or int. Let m = length(u) and n = length(v). Description¶. Convert input to a contiguous array. The following are code examples for showing how to use numpy. I'm using the evaluation version of LabVIEW 2009 and have little to no experience in image processing, so forgive me if my vocab sounds like I'm a little (or a lot) lost. Fourier Transform in Numpy¶ First we will see how to find Fourier Transform using Numpy. We find the value with that key from labels and we get our class label. load はファイルにndarrayを出力したり、ファイルから入力したりできる。. Image data augmentation is a technique that can be used to artificially expand the size of a training dataset by creating modified versions of images in the dataset. jpg image that I would like to convert to Python array, because I implemented treatment routines handling plain Python arrays. numpy array not a list How do I append to a numpy array in Python? JPG or JPEG. At the end of the run, the array of extracted and resized faces is saved as a compressed NumPy array with the filename ‘img_align_celeba_128. In this post, we’ll be doing a deep dive on the techniques that I’ve learned for a very simple lane detection algorithm. Python doesn’t show this and displays n-d array data in different order than R (making matters somewhat confusing for R users). Thanks for this! I hit a problem where I needed to encode the image before sending and decode it again. Then you can convert the returned array to real bytes either with the tobytes() method or io. Here is example TestImg to which we write numpy array (in this example it is all zeros). FFTW ), and in any case using the transform isn't as efficient as applying the filter naively for small filter sizes. tostring() And you can load a byte string using:. """ size = surface. To confirm that the file was saved correctly, it is loaded again as a PIL image and details of the image are reported. This package provides tools to analyze cell velocity from time series of wound healing experiments. They are extracted from open source Python projects. note: this is a slicing trick, and modifying the output array will also change the OpenCV image data. jpg') a = numpy. imshow and then call the matplotlib. And since numpy is pretty much the only way we have to create an array for the array instance, and it's the way that most people who use that interface are accessing Pillow, it's better in test_numpy. def opencv_image_as_array(im): """Interface image from OpenCV's native format to a numpy array. 5倍ヒダ両開き 【幅525~610×高さ221~240cm】FELTA. Using Python, GDAL and NumPy for spatial analysis and modeling Overview of GDAL and NumPy Where to use these instead of ArcGIS, Imagine, etc. Its first argument is the input image, which is grayscale. ) XlsxWriter. preprocessing. One important constraint is that PIL is not present. 3,但是一直报错cannot uninstall 'numpy'. I then display the dimensions of the array which are 1000 rows by 1000 columns, together making up 1,000,000 pixels locations in the spatial domain. rot90() NumPyで画像を上下左右に反転: np. Read the elements of a using this index order, and place the elements into the reshaped array using this index. Arrays are similar to lists in Python, except that every element of an array must be of the same type, typically a numeric type like float or int. This object gives you an easy way to manipulate the plot from the prompt. You can vote up the examples you like or vote down the ones you don't like. In the above code we define a numpy array with random numbers, create a DataFrame and convert it to html. And that's all you need to know to convert from PIL to mp4 (or at least a movie, you need a certain codec for conversion to mp4). e -1 will be converted to 255, -2 to 254 and 256 to 0 and 257 to 1 etc. Converting MNIST dataset for Handwritten digit recognition in IDX Format to Python Numpy Array. pip install numpy The code. PIL image转换成array. For image processing or image classification the most. ニードルベアリング 【nutr210x】(駆動機器・ベアリング・ベアリング) ニードルベアリング f f ntn ntn f dpn-39936y ニードルベアリング 【マラソンでポイント最大43倍】(まとめ) 【nutr210x】(駆動機器・ベアリング・ベアリング). Output - sigmoid of the number or the numpy array. In this sense, numpy arrays are different from Python lists that allow arbitrary data types. When the image file is read with the OpenCV function imread(), the order of colors is BGR (blue, green, red). You are passing a numpy array generated by OpenCv, when it is expecting a filename, StringIO instance or file object. 91 A2 111 E8]【Herman Miller ハーマンミラー 正規品】,OSG オーエスジー 超硬フラットドリル ADF-2D【7872780】ADF2D10. According to the number of images in the 4 classes (1,962) and the feature vector length extracted from each image (360), a NumPy array of zeros is created and saved in the dataset_features variable. array(img) # Convert array to Image img = PIL. In this particular example, I will stack several images of M13 taken with a ~10'' telescope. 求问如何解决一开始的问题,降低版本的思路是对的吗?. The following are code examples for showing how to use keras. We will be using the below functions to create and train our logistic regression neural network model. You can index it like a numpy array. To confirm that the file was saved correctly, it is loaded again as a PIL image and details of the image are reported. astype — NumPy v1. Here, the following contents will be described. For individual pixel access, Numpy array methods, array. However, if I take that image. complicated array slicing) not supported yet!. To adapt it to use eccentricity as your "third dimension") keeping the marker area constant: from pylab import figure, show, rand from matplotlib. open call with Image. When using the NumPy library, Python image processing programs are approximately the same speed as Matlab, C, or Fortran programs. empty(size, numpy. from_java() to convert the ImagePlus object to a 64bit float Python image array, which you can then do whatever you want with numpy functions Example - below the code to let you open an image in ImageJ and convert it for use with all your Python functions that require arrays in float dtype:. And since numpy is pretty much the only way we have to create an array for the array instance, and it's the way that most people who use that interface are accessing Pillow, it's better in test_numpy. Generating interesting arrays can be difficult, but images provide a great option. The view allows access and modification of the data without the need to duplicate its memory. It contains an array saved in the NumPy (NPY) file format. preprocessing. fft2() provides us the frequency transform which will be a complex array. The image has a height of 1385 pixels, a width of 1810 pixels, and three channels (representing red, green, and blue). png: Example of default output. Unfortunately in my case, the CPU-only…. ndarray format, however the data type for the items inside this array is numpy. an array of numpy. These libraries seamlessly interface with our enterprise-ready Deployment servers for easy collaboration, code-free editing, and deploying of production-ready dashboards and apps. If tuple, the first element should contain the images and the second element another numpy array or a list of numpy arrays that gets passed to the output without any modifications. Load DICOM data into a NumPy array with PyDICOM #python #dicom #medical #imagedata #pydicom #fileIO - python_dicom_load_pydicom. In particular, the submodule scipy. To provide you with the necessary knowledge this chapter of our Python tutorial deals with basic image processing and manipulation. Home » Blogs » Mindey's blog. In order to store the class label for each image, another NumPy array named outputs is created. Each of these sets contain two arrays—a Numpy ndarray of ndarrays containing image data (each image data array having the shape (300,300,3), with there being X arrays of image data. The class label for apple. You can read more about it from Numpy docs on masked arrays. How to use pre-trained models like VGG, MobileNet, Inception for image classification using Keras. パーティション (病院 医院 診察室 待合室 診療所) クロスメディカルスクリーン 2連 高さ1290mm AS-46-2(二ッ折) 【キャスター脚・防炎加工】 日本製 スクリーン衝立 間仕切り,純国産 糸引織 い草上敷 『湯沢』 六一間8畳(約370×370cm)【送料無料】【代引き不可】,い草花ござカーペット ラグ 『DX. According to the number of images in the 4 classes (1,962) and the feature vector length extracted from each image (360), a NumPy array of zeros is created and saved in the dataset_features variable. By using NumPy, you can speed up your workflow, and interface with other packages in the Python ecosystem, like scikit-learn, that use NumPy under the hood. itemset() is considered to be better. View numpy_demo. The file is there, it is found, it is being sent. If file is a string or Path, a. This example changes the values of both the pixel [1, 4] and the sub-section [30:40, 10:20] to the new value of 999. For than the tensor object need to be converted to numpy array. So we know that matplotlib is awesome for generating graphs and figures. item() and array. You have any Image, and for that image to be useful you have to have it as an Array full of numbers. array_to_img(). I need to convert the 150x150x3 dimentional images to vectors to perform the PCA analysis. astype — NumPy v1. This tutorial is designed to introduce you to arrays in NumPy. asarray(i) # a is readonly i = Image. I want to know the easiest way to export rendered images from blender to be exported as numpy array. scikit-image is a Python package dedicated to image processing, and using natively NumPy arrays as image objects. array()にPIL. array is not writable. size[1], 3) But I can't seem to figure out how to load it back into the PIL object after I've done all my awesome transforms. When i'm saving the new numpy array as an image I get a 3 band image Stack Exchange Network Stack Exchange network consists of 175 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. This example uses pillow to read the image, matplotlib. Convert OpenEXR to JPEG with gamma encoding (2. Arrays are similar to lists in Python, except that every element of an array must be of the same type, typically a numeric type like float or int. Plotly's team maintains the fastest growing open-source visualization libraries for R, Python, and JavaScript. The questions are of 4 levels of difficulties with L1 being the easiest to L4 being the hardest. Convert numpy. Alpha blending with OpenCV: cv2. The prepared dataset can then be loaded any time, as follows. org Unless copy is False and the other conditions for returning the input array are satisfied (see description for copy input parameter), arr_t is a new array of the same shape as the input array, with dtype, order given by dtype, order. You have any Image, and for that image to be useful you have to have it as an Array full of numbers. tolist¶ method. It also contains a set of labels, with each label mapped to the data array, such that the number of image data arrays and the number of labels are the same. When the image file is read with the OpenCV function imread(), the order of colors is BGR (blue, green, red). We see that the PIL-to-NumPy array conversion took 0. All the time you are working with a NumPy array. 5 hours I calculated -_-). How to fully load a raster into a numpy array? Ask Question So, I succeeded loading small rasters into numpy array with a help of guys, but when having a bigger. The accompanying paper is found at PLOS. It allows for easy loading, manipulating, and saving of image files. What I want is to be able to read the image into MATLAB as a 2-d array of numbers, so instead of each pixel having 3 numbers to define it's colour (i. 川島織物セルコン カーテン FELTA フェルタ スタンダード縫製(下部3ッ巻仕様)1. 17 Manual - SciPy. Welcome to a tutorial series, covering OpenCV, which is an image and video processing library with bindings in C++, C, Python, and Java. zeros Return a new array setting values to zero. ndarray の属性 ndim と shape を操作する方法を紹介します. ndim は,配列の次元数を表す属性で,ベクトルでは 1 に,行列では 2 になります.. NumPy is just showing a few more digits. jpg”) # image is a PIL image array = numpy. rot90() NumPyで画像を上下左右に反転: np. You can access the raw data of FLOAT and UINT images as a 1D array. The application I'm writing currently reads data from a FITS file and should display it on a gtk window. imread() by passing the path to a file, such as a PNG or JPG file. The file is there, it is found, it is being sent. size[1], 3) But I can't seem to figure out how to load it back into the PIL object after I've done all my awesome transforms. Return an array of zeros with shape and type of input. imshow function, an image will be shown. You can build any of the packages from source, for instance if you want to get involved with development. # Launch the graph with tf. Using Python, GDAL and NumPy for spatial analysis and modeling Overview of GDAL and NumPy Where to use these instead of ArcGIS, Imagine, etc. 5 hours I calculated -_-). 15, 2013 in GHC 4307 for 15-112. Perhaps the simplest way is to construct a NumPy array and pass in the Image object. Note Above mentioned method is normally used for selecting a region of array, say first 5 rows and last 3 columns like that. There are lots of shining noise in these images. this looks like from the python libsvm wrapper?. 1 download. This is the predicted class. 16 Manual - SciPy. Convert a 3-color image (JPG) to separate FITS images¶ This example opens an RGB JPEG image and writes out each channel as a separate FITS (image) file. See the documentation for array() for details for its use. By storing the images read by Pillow(PIL) as a NumPy array ndarray, various image processing can be performed using NumPy functions. size[1], 3) But I can't seem to figure out how to load it back into the PIL object after I've done all my awesome transforms. It seems that PIL images support conversion to numpy array, and according to the documentation I have written this:. Here are the examples of the python api numpy. Arrays are similar to lists in Python, except that every element of an array must be of the same type, typically a numeric type like float or int. Hi guys, I am using python for a while now and I have a requirement of creating a numpy array of microscopic tiff images ( this data is 3d, meaning there are 100 z. If file is a string or Path, a. In this sense, numpy arrays are different from Python lists that allow arbitrary data types. tofile (fid, sep="", format="%s") ¶ Write array to a file as text or binary (default). Load DICOM data into a NumPy array with PyDICOM #python #dicom #medical #imagedata #pydicom #fileIO - python_dicom_load_pydicom. You can vote up the examples you like or vote down the ones you don't like. Then you can convert the returned array to real bytes either with the tobytes() method or io. It's a NumPy array!That why image processing using OpenCV is so easy. Note, URL strings are not compatible with Pillow. In Matplotlib, this is performed using the imshow() function. The format is [target1, target2, target3] The numpy array gets quite large, and considering that I'll be using a deep neural network, there will be many parameters that would need fitting into the memory as well. findContours() function, you can directly pass that contours to cv2. You can access the raw data of FLOAT and UINT images as a 1D array. Simply extract all 3 channels separately and put them in a new array which changes the shape very simply. But whenenver I do, I. The next code does this. In Numpy dimensions are called axes. array(PILImage) Suppose you have an image that has been manipulated with the Python Imaging Library, and you want to convert that image into a format that can be understood by the OpenCV Version 2 Library. Output - sigmoid of the number or the numpy array. img_to_array(). By voting up you can indicate which examples are most useful and appropriate. In order to store the class label for each image, another NumPy array named outputs is created. astype — NumPy v1. Q&A for Work. imread() andcv2. You can convert the numpy array to a byte string using: jpg_bytes = ds. Session() as sess: sess. In this post, we’ll be doing a deep dive on the techniques that I’ve learned for a very simple lane detection algorithm. Convert tensors to numpy array and print. >>> example for single band, from numpy 'C' array >>> # (the case which L values are represented by 8bit integers) >>> from __future__ import print_function. we will assume that the import numpy as np has been used. x: Input data. To get a numpy ndarray from simpleITK try the following: import SimpleITK as sitk import numpy as np sizeX, sizeY, sizeZ = 100,100,100 image = sitk. セーラー万年筆 万年筆 プロフェッショナルギア インペリアルブラック 細字 11-3028-220,ロブテックス エビ 超硬ホルソー (薄板用) HO65S ho-65s 【372-2015】,その他 (業務用60セット) アジア原紙 fax原稿用紙 gb4f-5hr 再生 方眼 100枚 ds-1734428. tolist¶ method. zeros Return a new array setting values to zero. 1 基本类型(array) array,也就是数组,是numpy中最基础的数据结构,最关键的属性是维度和元素类型,在numpy中,可以非常方便地创建各种不同类型的多维数组,并且执行一些基本基本操作,来看例子:. It seems that PIL images support conversion to numpy array, and according to the documentation I have written this:. Numpy is a optimized library for fast array calculations. By using NumPy, you can speed up your workflow, and interface with other packages in the Python ecosystem, like scikit-learn, that use NumPy under the hood. The glob module finds all the pathnames matching a specified pattern according to the rules used by the Unix shell, although results are returned in arbitrary order. astype — NumPy v1. In Python, data is almost universally represented as NumPy arrays. NumPy Array Object Exercises, Practice and Solution: Write a NumPy program to convert a numpy array of float values to a numpy array of integer values. Passing darknet a numpy array is now faster than passing it a filename. PCA and image compression with numpy In the previous post we have seen the princomp function. jpg‘ in the current working directory. OpenCV is used for all sorts of image and video analysis, like facial recognition and detection, license plate reading, photo editing, advanced robotic vision. reshape(pic. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. savetxtでcsv出力をする方法 | memotoxin という訳で、上のページに書いているのを参考にしてnp. uint8。当然这样做也相当于新建了图像哈。简单方便。. array())基础通常习惯于在使用numpy的时候起别名"np" : import numpy as np使用numpy的意义why not python's 'List'对元素类型不做限定,灵活效率很低why not python's 'array'限定元素类型,不灵活效率高缺点:仅仅将存入的数据当作一个. Related post: Image processing with Python, NumPy (read, process, save) The follo. TestCase class Simple tool - Google page ranking by keywords Google App Hello World Google App webapp2 and WSGI Uploading Google App. Consider the following example that creates and displays identical 4x3x2 arrays in R and Python:. Project Management Content Management System (CMS) Task Management Project Portfolio Management Time Tracking PDF. For example, the coordinates of a point in 3D space [1, 2, 1] is an array of rank 1,. Generating interesting arrays can be difficult, but images provide a great option. I'm using the evaluation version of LabVIEW 2009 and have little to no experience in image processing, so forgive me if my vocab sounds like I'm a little (or a lot) lost. Some of the operations covered by this tutorial may be useful for other kinds of multidimensional array processing than image processing. jpg‘ in the current working directory. Because Image. jpg, Male-00124. fromiter Create an array from an iterator. The former has more pinkish tint to it than the later. array(img) # Convert array to Image img = PIL. The following are code examples for showing how to use PIL. I open a series of FITS files and store the data in a list, which I've named image_concat. The Byte datatype is unsigned 8 bit integer. jpg image? I've tried the following and works with 3D array (v1) where resulting image close to the original numpy array produced image (original). jpg, Male-00124. 壁面収納 テレビ台 リビング 【 MG 】 TVボード (フラップ板扉) (テレビ壁掛け対応) 幅120cm 奥行2cm ウォールラック D2 120-FVTV MGver. The following are code examples for showing how to use cv2. fromarray(array) # image2 is a PIL image Convert between PIL image and PyOpenCV matrix image = Image. Can anyone help me with transformation from numpy array to image (at PIL library)? I want to change an array (at numpy) into an image (at Image) in order to rotate the. Note Above mentioned method is normally used for selecting a region of array, say first 5 rows and last 3 columns like that. Image plotting from 2D numpy Array. convolve and correlate in numpy 1. You can vote up the examples you like or vote down the ones you don't like. pdf), Text File (. array ([0, 2]) It should be straightforward to notice that this will not work since there are only three values in the array while the mask with four. png which has 64x64x3 pixels into an array which has the size 1x12288. I have an original bmp image, which works fine, but when I try to use the jpeg image, which I get with just convert image. Flexibile Image Transport System (FITS) files used for astronomy should be managed with astropy or pyfits. fromfunction Construct an array by executing a function on grid. The former has more pinkish tint to it than the later. Plotting numpy arrays as images¶ So, you have your data in a numpy array (either by importing it, or by generating it). PS: I don't want to save the images first in *. By voting up you can indicate which examples are most useful and appropriate. Q&A for Work. In particular, these are some of the core packages. But it always returns a scalar. Python doesn’t show this and displays n-d array data in different order than R (making matters somewhat confusing for R users). Then, to read an image, we simply call the imread function of the cv2 module. idx2numpy_array To convert idx formatted files to numpy array :: 1. Note, URL strings are not compatible with Pillow. Return both the audio array as well as the sample rate: In [3]: Audio can also accept a NumPy array. fromarray(arr) Tried with: Python 2. Using data from Ultrasound Nerve Segmentation. You can vote up the examples you like or vote down the ones you don't like. The annotations are stored in a numpy. The most obvious examples are lists and tuples. Setup a private space for you and your coworkers to ask questions and share information. Each of these sets contain two arrays—a Numpy ndarray of ndarrays containing image data (each image data array having the shape (300,300,3), with there being X arrays of image data. Here, the following contents will be described. PIL中的Image和numpy中的数组array相互转换. savetxtで配列を保存してみます。 impo… numpy配列をそのままファイルに保存できることに気付きました。. Scikit-image: image processing¶ Author: Emmanuelle Gouillart. The default output name ``array. Example of how to convert numpy compressed file to TFRecords - numpy_to_tfrecords_example. Explore Popular Topics Like Government, Sports, Medicine, Fintech, Food, More. astype — NumPy v1. JPEG (/ ˈ dʒ eɪ p ɛ ɡ / JAY-peg) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. Okay, so you want to input image data for a Convolutional Neural Network. R displays array data with unambiguously-labeled coordinate indices. If a is a numpy array and b is a boolean numpy array of the same shape, then a[b] selects the entries of a for which the corresponding entry of b is True: In [54]: c = a [ b ] print ( c ). Description¶. how did you train it ? i can only guess here, but probably you will have to make a list of pixels from the face image in the very same way it was done for training (you cannot use the image / numpy array directly). Because scikit-image represents images using NumPy arrays, the coordinate conventions must match. $ python -e ' import numpy; numpy. load 2015/06/10. load はファイルにndarrayを出力したり、ファイルから入力したりできる。. 5【超硬コーティングドリル】,サンメルヘン のれん 無地 紺 001-10 綿 麻 日本製 YHV0703. shape (40, 40) >>> data. Most import for us, Pillow has routines to read and write conventional image formats. You can only upload files of type 3GP, 3GPP, MP4, MOV, AVI, MPG, MPEG or RM. astype — NumPy v1. Benchmarks on a 4032 × 3024 image with yolov2-tiny on Macbook Pro CPU are below. # Launch the graph with tf. Plotly's team maintains the fastest growing open-source visualization libraries for R, Python, and JavaScript. Because scikit-image represents images using NumPy arrays, the coordinate conventions must match. We will use the Python Imaging library (PIL) to read and write data to standard file formats. Siladittya Manna. But my try to convert this back into PIL format is failing img = Image. So if you want to access all B,G,R values, you need to call array. fromfunction Construct an array by executing a function on grid. Convolutional Neural Networks allow us to extract a wide range of features from images. This MATLAB function reads data from an open binary file into column vector A and positions the file pointer at the end-of-file marker. Note Above mentioned method is normally used for selecting a region of array, say first 5 rows and last 3 columns like that. ANTIALIAS is best for downsampling, the other filters work better with upsampling (increasing the size). A list of submodules and functions is found on the API reference webpage. array(image) # array is a numpy array image2 = Image. Example of how to convert numpy compressed file to TFRecords - numpy_to_tfrecords_example. パーティション (病院 医院 診察室 待合室 診療所) クロスメディカルスクリーン 2連 高さ1290mm AS-46-2(二ッ折) 【キャスター脚・防炎加工】 日本製 スクリーン衝立 間仕切り,純国産 糸引織 い草上敷 『湯沢』 六一間8畳(約370×370cm)【送料無料】【代引き不可】,い草花ござカーペット ラグ 『DX. But it always returns a scalar. Instead the goal of this post is to try and understand the fundamentals of a few simple image processing techniques. Hi guys, I am using python for a while now and I have a requirement of creating a numpy array of microscopic tiff images ( this data is 3d, meaning there are 100 z. itemset() is considered to be better. There are functions for rotating or flipping images (= ndarray) in OpenCV and NumPy, either of which can be used. To confirm that the file was saved correctly, it is loaded again as a PIL image and details of the image are reported. Here we’ll grab the plot object. NumPy is just showing a few more digits. normal(size=(60, 60))) ' $ imshow array. array()にPIL. You have any Image, and for that image to be useful you have to have it as an Array full of numbers. 画像を1枚だけNumpy配列にする(3次元) (224,224,3)で入力 リサイズの時はtarget_size=(224,224)を変更 jpg,bmpは読込確認済み 裏でPILが動いているらしいのでおそらくpngも平気なはず ※2018. Perhaps the simplest way is to construct a NumPy array and pass in the Image object. The second is an array of the paths to the saved images of each object detected and extracted, and they are arranged in order at which the objects are in the first array. Let’s render it. Return the contents of bytearray as a char array after checking for a NULL pointer. At the end of the run, the array of extracted and resized faces is saved as a compressed NumPy array with the filename ‘img_align_celeba_128. This section addresses basic image manipulation and processing using the core scientific modules NumPy and SciPy. You can convert the numpy array to a byte string using: jpg_bytes = ds. GetArrayFromImage( image ) Then on the VTK side the. Examples are mostly coming from area of machine learning, but will be useful if you're doing number crunching in python. What I want is to be able to read the image into MATLAB as a 2-d array of numbers, so instead of each pixel having 3 numbers to define it's colour (i. For individual pixel access, Numpy array methods, array. pyplot as plt N =. To provide you with the necessary knowledge this chapter of our Python tutorial deals with basic image processing and manipulation. Python Numpy チュートリアル. Load DICOM data into a NumPy array with PyDICOM #python #dicom #medical #imagedata #pydicom #fileIO - python_dicom_load_pydicom. XlsxWriter is a Python module for creating Excel XLSX files. 3 and Ubuntu 12. Note The above method is normally used for selecting a region of an array, say the first 5 rows and last 3 columns. flat: 把阵列扁平化输出 linspace()和matlab的linspace很类似,用于创建指定数量等间隔的序列,实际生成一个等差数列。. astype('uint8').