title: Add blur/gradient to image outside of mask in python
body: <p>I have a bounding box whose coordinates are given by (x, y, w, h) where x and y are top-left coordinates of the box. I'd like to apply a blur or gradient outside the box. How would I create a mask using the coordinates above and apply this effect outside the mask with either PIL or cv2 similar to the image below?</p>
  
  <p><a href="https://i.stack.imgur.com/7Ojlv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Ojlv.jpg" alt="img"></a></p>