Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This program loads an image, displays it, and then creates, displays
- #and saves a new image that has only the green channel displayed.
- #Import the packages for images and arrays:
- import matplotlib.pyplot as plt
- inputFile = input("Enter name of the input file: ")
- outputFile = input("Enter name of the output file: ")
- img = plt.imread(inputFile)
- #Read in image from csBridge.png
- img2 = img.copy()
- #make a copy of our image
- img2[:,:,0] = 0
- #Set the green channel to 0
- img2[:,:,2] = 0
- #Set the blue channel to 0
- plt.imsave(outputFile, img2)
- #Save the image we created to the file: reds.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement