Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:20:06+00:00 2026-06-04T11:20:06+00:00

I am writing an application that requires the background removal(where the player is), and

  • 0

I am writing an application that requires the background removal(where the player is), and masking the user body with some color or any character(like https://stackoverflow.com/questions/10599658/how-to-create-kinect-avatar).
Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:20:08+00:00Added an answer on June 4, 2026 at 11:20 am

    The tutorial at Channel 9, even though is in the old beta 2, is easy to convert. Here is final code(converted)

        public static class KinectExtensions
        {
            public static WriteableBitmap CreateLivePlayerRenderer(this KinectSensor sensor)
            {
                if (sensor.DepthStream.FrameWidth == 0)
                    throw new InvalidOperationException("Either open the depth stream before calling this method or use the overload which takes in the resolution that the depth stream will later be opened with.");
                return CreateLivePlayerRenderer(sensor, sensor.DepthStream.FrameWidth, sensor.DepthStream.FrameHeight);
            }
    
            public static WriteableBitmap CreateLivePlayerRenderer(this KinectSensor sensor, int depthWidth, int depthHeight)
            {
                AllFramesReadyEventArgs d = new AllFramesReadyEventArgs();
                using (DepthImageFrame depthImage = d.OpenDepthImageFrame())
                {
                    WriteableBitmap target = new WriteableBitmap(depthWidth, depthHeight, 96, 96, PixelFormats.Bgra32, null);
                    var depthRect = new System.Windows.Int32Rect(0, 0, depthWidth, depthHeight);
    
                    sensor.DepthFrameReady += (s, e) =>
                    {
                        Debug.Assert(depthImage.Height == depthHeight && depthImage.Width == depthWidth);
                    };
    
                    sensor.ColorFrameReady += (s, e) =>
                    {
                        // don't do anything if we don't yet have a depth image
                        DepthImageFrame colorImage = depthImage;
                        if (colorImage.BytesPerPixel == null) return;
    
                        byte[] color = new byte[sensor.ColorStream.FramePixelDataLength];
                        e.OpenColorImageFrame().CopyPixelDataTo(color);
    
                        byte[] output = new byte[depthWidth * depthHeight * 4];
    
                        // loop over each pixel in the depth image
                        int outputIndex = 0;
                        for (int depthY = 0, depthIndex = 0; depthY < depthHeight; depthY++)
                        {
                            for (int depthX = 0; depthX < depthWidth; depthX++, depthIndex += 2)
                            {
                                short[] bits = new short[colorImage.BytesPerPixel];
                                depthImage.CopyPixelDataTo(bits);
                                // combine the 2 bytes of depth data representing this pixel
                                short depthValue = (short)(bits[depthIndex] | (bits[depthIndex + 1] << 8));
    
                                // extract the id of a tracked player from the first bit of depth data for this pixel
                                int player = bits[depthIndex] & 7;
    
                                // find a pixel in the color image which matches this coordinate from the depth image
                                int colorX, colorY;
                                ColorImagePoint colorPoint = depthImage.MapToColorImagePoint(depthImage.Width, depthImage.Height, sensor.ColorStream.Format);
    
    
                                // ensure that the calculated color location is within the bounds of the image
                                colorX = colorPoint.X;
                                colorY = colorPoint.Y;
    
                                output[outputIndex++] = color[(4 * (colorX + (colorY * e.OpenColorImageFrame().Width))) + 0];
                                output[outputIndex++] = color[(4 * (colorX + (colorY * e.OpenColorImageFrame().Width))) + 1];
                                output[outputIndex++] = color[(4 * (colorX + (colorY * e.OpenColorImageFrame().Width))) + 2];
                                output[outputIndex++] = player > 0 ? (byte)255 : (byte)0;
                            }
                        }
                        target.WritePixels(depthRect, output, depthWidth * PixelFormats.Bgra32.BitsPerPixel / 8, 0);
                    };
                    return target;
                }
            }
        }
    

    And my answer at https://stackoverflow.com/questions/10599658/how-to-create-kinect-avatar/10600919#10600919 explains how to create the character. Good Luck! Hope this Helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a c# application that requires user authentication. When the user hits the
I am writing an application that requires root user privileges to execute. If executed
I am writing a an interface for a web application that requires a user
I am writing a web application that requires user interaction via email. I'm curious
I'm writing a jQuery Mobile application that requires user authentication. The same user cannot
I am writing an Android application that requires the user's current location. I register
I'm currently writing an application using Vala that requires me to send data over
I currently have an application I'm writing in c# (using .NET) that requires me
I am writing an application that allows a user to place images on a
I'm writing an application that gives the user the option to resize an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.