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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:21:08+00:00 2026-06-05T14:21:08+00:00

I need to make a console application that uses Kinect, with Kinect SDK and

  • 0

I need to make a console application that uses Kinect, with Kinect SDK and c#. Since it’s a console application, I’ve found polling to be the best way to retrieve the frames I need to process. I’ll need to retrieve frames from the depth camera and the rgb camera, do some processing on then in separate threads (one for the depth image and one for the rgb image), and give an output to the user for each of the two processed frames. The way I’ve been thinking about doing this is the following:

1 – create 2 threads, the first is on the method that polls the rgb camera and do the processing, the second is on the method that polls the depth camera and do the processing

2 – Start the threads

3 – enter a while some stop condition loop

4 – check separately if each thread is alive, if not, create them again and start them again

I’ve made a test program that follows those steps and it works, but I’m not sure it’s the best way of doing it. My test program is

class Program
{
    private static ClassExecutioner Executioner;
    private static Class1 Cls;

    static void Main(string[] args)
    {
        Executioner = new ClassExecutioner();
        Cls = new Class1();

        Thread fThread = new Thread(new ThreadStart(processA));
        Thread sThread = new Thread(new ThreadStart(processB));
        fThread.Start();
        sThread.Start();

        while (true)
        {
            if (!fThread.IsAlive)
            {
                fThread = new Thread(new ThreadStart(processA));
                fThread.Start();
            }

            if (!sThread.IsAlive)
            {
                sThread = new Thread(new ThreadStart(processB));
                sThread.Start();
            }
        }

    }
    static void processA()
    {
        String frameA = Cls.pollA();
        Executioner.CallA(frameA);
    }
    static void processB()
    {
        String frameB = Cls.pollB();
        Executioner.CallB(frameB);
    }
}

Class 1 methods represent the polling of the cameras on kinect

class Class1
{
    private int a;
    private int b;

    public Class1()
    {
        a = 0;
        b = 0;
    }

    public String pollA()
    {
        String frame = "this is " + a % 100;
        a++;
        return frame;
    }

    public String pollB()
    {
        String frame = "I am " + b % 100;
        b++;
        return frame;
    }
}

Executioner represents the methods that process the frames obtained from Kinect

class ClassExecutioner
{

    public ClassExecutioner()
    {
    }

    public void CallA(String frameA)
    {
        Random rand = new Random();
        int time = rand.Next() % 1000000000;
        //'processing' - wait some time
        for (int i = 0; i < time; i++)
        {
        }
        // finishes the processing of the 'frame' from stream A
        Console.WriteLine(frameA);
    }

    public void CallB(String frameB)
    {
        Random rand = new Random();
        int time = rand.Next() % 1000000000;
        // 'processing' - wait some time
        for (int i = 0; i < time; i++)
        {
        }
        // finishes the processing of the 'frame' from stream B
        Console.WriteLine(frameB);
    }
}

The program is very simple but ilustrates well what I want to do with the Kinect streams. The problem is, I’m not sure this is the best way of doing it or even if this is gonna work at all on a practical, Kinect application. Keep in mind that, for now, each processing (depth and rgb) doesn’t need information from the other.

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-05T14:21:09+00:00Added an answer on June 5, 2026 at 2:21 pm

    It might be cool to look into the ReactiveExtensions framework. It deals with async event streams very cleanly.

    You can write LINQ against the data sources and do very interesting composable operations.

    http://msdn.microsoft.com/en-us/data/gg577609.aspx

    You basically would have two IEnumerable sequences (the things that loop infinitely) that yield out the frame at the given interval. You can then “query” these sequences using Rx. RX handles all the complicated threading issues for you and makes your consumer code clean and simple.

    To be clear, you don’t want to be creating new threads each time. You can create two infinite enumerables that each run on their own thread and yield out the result on each iteration. That way they don’t even “die”

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

Sidebar

Related Questions

I have a simple console application written in .NET. I need to make an
I need to make a nodejs client application that can send a POST request
I have a console application that require to use some code that need administrator
I am coding a Console Application in c++ and I need to make something
I'm trying to make a little game for the console, so I need to
I need to make a div layer so that when you click on it
I need to make a proxy script that can access a page hidden behind
I need to make a stored procedure or function that returns a set of
I am making form application, that also runs a console process on different thread.
I have a console application that is server based. I only want 1 instance

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.