I am trying to find the position in the Array called ImageArray
from PIL import Image, ImageFilter
import numpy as np
ImageLocation = Image.open("images/numbers/0.1.png")
#Creates an Array [3d] of the image for the colours
ImageArray = np.asarray(ImageLocation)
ArrayRGB = ImageArray[:,:,:3]
#Removes the Alpha Value from the output
print(ArrayRGB)
#RGB is output
print(round(np.mean(ArrayRGB),2))
ColourMean = np.mean(ArrayRGB)
#Outputs the mean of all the values for RGB in each pixel
This code searches each point individually in the Array and if it above the mean its supposed to become 255 if its less 0. How can I find the Position in the Array so I can edit its Value.
for Row in ArrayRGB:
for PixelRGB in Row:
#Looks at each pixel individually
print(PixelRGB)
if(PixelRGB > ColourMean):
PixelRGB[PositionPixel] = 255
elif(PixelRGB < ColourMean):
PixelRGB[PositionPixel] = 0
PixelRGB[PixelRGB > ColourMean] = 255?PixelRGB[PixelRGB < ColourMean] = 0PixelRGB = (PixelRGB > ColourMean) * 255