Image processing using NumPy, PIL and matplotlib by Nishant Kalanta


With the help of NumPy, we can perform many functions on images like enlarging image, using different shades like red, green, blue or black and white

In the first step, we are going to NumPy for converting image pixels not matrix form, python image library used to add support for opening, manipulating and saving many different image file formats and matplotlib is used for visualization for 2D plots of the array.

Here in the code below, we have used Image. open function to open the file that is already uploaded to our Jupyter Notebook and plt.imshow function is used to show the image that is already uploaded in the image (reference variable).

Image.shape is used to know the dimension of the image i.e. 512 rows, 512 columns and 3 pixels i.e. red, blue and green image [0,0] is used for knowing the first value of the array that is stored in form of a list.

To represent the different shades of images by copying the image so that it will not affect the real image.

Contacting all image’s in one row so that we make the difference between images.


Gray_color function is used to converting the pixels color from dark color to black and light ones to white according to the intensity of the pixels.

The following plti function is used for the enlargement of the function. The pixel per inches increases for that particular area where we need to enlarge the image. OUTPUT

Here, we transform a color image to a grayscale image by taking the mean of the RBG values, weighted by the matrix weights.

OUTPUT


Contact Us:

A-116, The Corenthum A-65,

Sector 62

Noida 201301

UP, India

Phone: +91 8882050481

Email: info@theikigailab.com

© 2020 TheIkigaiLab  Terms of Use Privacy and Security Statement