Lets say you have a 3D image (numpy array) such as:
arr = np.random.random((4,4,3))
Also, you have a 2D mask with shape (4,4) such as:
mask = np.array([[0,1,1,0],[0,1,1,0],[0,1,1,0],[0,1,1,0]])
How do you apply the 2D mask with shape (4,4) to the 3D array with shape (4,4,3) and crops out the image where it is not zero, using numpy and/or opencv?