added blue and red calculator
This commit is contained in:
parent
c035ec05da
commit
b62b4b921c
1 changed files with 13 additions and 4 deletions
17
app.py
17
app.py
|
@ -247,11 +247,20 @@ class renderedImageZoom:
|
|||
def get_image_average(self,color,low, high):
|
||||
if color == "blue":
|
||||
slice = self.image[:][low:high]
|
||||
print(slice.size)
|
||||
print(slice)
|
||||
return "{} + {}".format(low,high)
|
||||
blue = 0
|
||||
for line in slice:
|
||||
blue += sum([p[2]/(p[0]+p[1]+p[2]) for p in line])
|
||||
|
||||
blue = blue / (100*(high-low))
|
||||
return "{} is the pixel average".format(blue)
|
||||
else:
|
||||
return "red".format(low,high)
|
||||
slice = self.image[:][low:high]
|
||||
red = 0
|
||||
for line in slice:
|
||||
red += sum([p[0]/(p[0]+p[1]+p[2]) for p in line])
|
||||
|
||||
red = red / (100*(high-low))
|
||||
return "{} is the pixel average".format(red)
|
||||
|
||||
|
||||
def env_setter(self,environment_constant,g):
|
||||
|
|
Loading…
Reference in a new issue