Checking The Colors Opencv Python
I have a code to detect two colors green and blue. I want to check if green color is detected to print a massage and if blue color is detected to print another message too Here is
Solution 1:
On comparing if mask==green_mask
returns an array of boolean value of their dimension which can not satisfy an if
condition which require a single boolean.
You need to use a function which will return true
if matrix mask
and green_mask
are all same and return false
otherwise. That function should be called under this if
condition.
Edit: Replace the code with
if np.array_equal(mask, green_mask):
It will fix your issue.
Post a Comment for "Checking The Colors Opencv Python"