Created
October 26, 2021 14:32
-
-
Save Yuktha-Majella/2ba76d0d8550b51ab1014fad427e026f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Accessing BGR value of pixel in coordinates 100,100 | |
pixel = img[100,100] | |
print("Pixel value in (100,100) coordinate: ", pixel) | |
#Accessing blue, Red, Green pixel individually | |
blue = img[100,100,0] | |
green = img[100,100,1] | |
red = img[100,100,2] | |
print("Pixel value of Blue in (100,100) coordinate: ", blue) | |
print("Pixel value of Green in (100,100) coordinate: ", green) | |
print("Pixel value of Red in (100,100) coordinate: ", red) | |
#Accessing a group of pixels: first 2 rows and first 2 columns | |
pixel = img[:2, :2] | |
print("Pixel value in (100,100) coordinate: \n", pixel) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment