Applying ROI in depth image RRS feed

  • Question

  • Hi,

    I am using Kinect v2 for taking ColorFrame and DepthFrame. I am doing image processing in the ColorFrame using EmguCV and finding the region of interest AKA ROI in this frame. How to apply this ROI in DepthFrame?

    Below is my code snippet-

    private void Reader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e)
        var reference = e.FrameReference.AcquireFrame();
        ColorFrame colorFrame = reference.ColorFrameReference.AcquireFrame();
        DepthFrame depthFrame = reference.DepthFrameReference.AcquireFrame();
        if(colorFrame == null || depthFrame == null) return;
        Image<Bgr,byte> colorImage = GetImageFromColorFrame(colorFrame);
        Rectange ROI = FindROIFromColorImage(colorImage);
        Image<Gray,byte> depthImage = GetImageFromDepthFrame(depthFrame);
        depthImage.ROI = ROI; //This is not correct.
        if(colorFrame != null) colorFrame.Dispose();
        if(depthFrame != null) depthFrame.Dispose();
    Can coordinate mapper can help me in this context?




    Thursday, January 15, 2015 6:15 PM