title: Alpha masking a non square region python cv2
body: <p>I have a 2d numpy array that has 0's where there is <em>not</em> an object, and 1's where there <em>is</em> an object.</p>
  
  <p><code>matrix.shape = (500, 425)</code></p>
  
  <p>I want to create a numpy array mask of shape <code>(500, 425, 3)</code> such that:</p>
  
  <pre><code>mask = np.zeros((500, 425, 3))
  if matrix[x][y] == 0:
      mask[x][y] = np.array([0, 0, 0]) # Black pixel if no object
  else:
      mask[x][y] = np.array([0, 255, 0]) # Green pixel if object
  </code></pre>
  
  <p>So that I have green pixels where the object are, black pixels everywhere else. How do I create this mask? Will this work correctly, such that if I use <code>cv2.addWeighted</code> to the image and the mask, the object will have a transparent green mask over it?</p>