Hi, I have two image controls.
 
I want to use  Img1 as a OpacityMask of Img2. 
 

Img1 -  image to apply mask to
Img2 - image to apply mask from
 
The source of Img1 is being read from kinect depth image: (I'm using OpenCV)
 
var depthBmp = depthFrame.SliceDepthImage((int)sliderMin.Value, (int)sliderMax.Value);
Image openCVImg = new Image(depthBmp.ToBitmap());  outImg.Source = ImageHelpers.ToBitmapSource(openCVImg);
Img1.Source = ImageHelpers.ToBitmapSource(openCVImg);
-------------------------------------------------------------------------------------------
 
When I create ImageBrush, set its Imagesource to Img1.Source and apply OpacityMask from Brush, nothing happens, Img2 is shown without mask:
 
brush = new ImageBrush();
brush.ImageSource = Img1.Source;
Img2.OpacityMask = brush;
 
-----------------------------------------------------------------------------------------
For example, the mask is applied when I use BitmapImage as ImageSource of ImageBrush:
 
BitmapImage Img3 = new BitmapImage(new Uri(@"c:\temp\turtle.png", UriKind.Absolute));
brush = new ImageBrush();
brush.ImageSource = Img3.Source;
Img2.OpacityMask = brush;
--------------------------------------------------------------------------------------------
Tnx.
Zvonimir