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 8318965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:09:30+00:00 2026-06-08T22:09:30+00:00

I am using the Kinect SDK and trying to add a color frame. I

  • 0

I am using the Kinect SDK and trying to add a color frame. I am using the code:

byte[] pixels = new byte[sensor.ColorStream.FramePixelDataLength];

WriteableBitmap image = new WriteableBitmap(sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight, 96, 96,
        PixelFormats.Bgra32, null);

video.Source = image;

colorFrame.CopyPixelDataTo(pixels);

image.WritePixels(new Int32Rect(0, 0, image.PixelWidth, image.PixelHeight), pixels, image.PixelWidth * sizeof(int), 0);

But the image isn’t displaying. I know that I can connect to the Kinect because I can change the elevation angle. What am I doing wrong? Thanks in advance. Note: I am trying to avoid using Coding4Fun

  • 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-08T22:09:32+00:00Added an answer on June 8, 2026 at 10:09 pm

    Noooo, you were so close. I’m assuming video is a WPF image.

    private WriteableBitmap wBitmap; 
    private byte[] pixels;
    
    private void WindowLoaded(...)
    {
        //set up kinect first, but don't start it
        ...
    
        pixels = new byte[sensor.ColorStream.FramePixelDataLength];
    
        wBitmap = new WriteableBitmap(sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight, 
            96, 96, PixelFormats.Bgra32, null);
    
        video.Source = wBitmap;
    
        sensor.Start();
    }
    
    private void ColorFrameReady(object sender, ColorImageFrameReadyArgs e)
    {
        using (ColorImageFrame colorFrame = e.OpenColorImageFrame())
        {
            if (colorFrame == null)
            {
                return;
            }
    
    
            colorFrame.CopyPixelDataTo(pixels);
    
            wBitmap.WritePixels(new Int32Rect(0, 0, wBitmap.PixelWidth, wBitmap.PixelHeight),
                pixels, image.PixelWidth * 4, 0);
        }
    }
    

    You shouldn’t be creating a new BitmapSource on every frame, it’s a lot better to create the single WriteableBitmap in the beginning and just refresh it on each frame.

    Also, the reason you couldn’t see the image before wasn’t actually because it wasn’t being refreshed. It absolutely was, but it was invisible. You set the WriteableBitmap format to Bgra32, where a is alpha. The Kinect sends data in the Bgr32 format; no alpha channel is set. So when you create a Bgra32 bitmap, it sees that the Kinect left the alpha channel set to 0, and therefore the image is shown as entirely transparent.

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

Sidebar

Related Questions

I'm using the Microsoft Kinect SDK to get the depth and color information from
I'm doing a kinect Application using Kinect SDK . The Result I want that
Currently I am using the DTWGestureRecognizer open source tool for Kinect SDK v1.5. I
I am using Xbox-Unity and am trying to make a Kinect game. I need
Really new to kinect. I am trying to read up material I find. I
I'm trying to determine if my Kinect is plugged into the PC using the
I have a byte[] I captured from Kinect using OpenKinect and it's Java JNA
I'm trying to develop a software where can detect face recognition using Kinect. Until
I am new to Kinect. i am trying to use skeleton tracking but i
I'm trying to output realtime 3D point clouds (307,200 points) using XNA and Kinect;

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.