I am using numpy and cv2 to find the average color of an image, and am able to successfully get a result with the code. How can I set a threshold for this result to execute some code if the average color is a certain result?
Source Code:
import cv2
import numpy
myimg = cv2.imread('image.jpg')
avg_color_per_row = numpy.average(myimg, axis=0)
avg_color = numpy.average(avg_color_per_row, axis=0)
print(avg_color)
Result:
[ 197.53434769 217.88439451 209.63799938]
I would like to end up with something like this:
if B > number and G > number and R > number:
doSomething()
I referenced this question to get the above code: How to find the average colour of an image in Python with OpenCV?