I'm in the process of learning how to use masking and the bitwise_and function. I have some tutorial code that works but mine is not and I can't see why. The source image I'm using is here
import numpy as n
import cv2
# Import the image
im = cv2.imread('orange.jpg')
hsv = cv2.cvtColor(im, cv2.COLOR_BGR2HSV)
upper = n.array([-20,100,100])
lower = n.array([25,100,255])
mask = cv2.inRange(hsv,lower,upper)
result = cv2.bitwise_and(im,im, mask= mask)
# Display the image, esc to kill the window
cv2.imshow('result',result)
cv2.imshow('mask',mask)
cv2.waitKey(0)
cv2.destroyAllWindows()