locked
is there sample code for near mode in C++ or C#? RRS feed

  • Question

  • near mode is a great change comparing to the old kinect, but the sdk supplies little information and no sample code about it. why?
    Sunday, February 5, 2012 2:20 PM

Answers

  • I thought that Kinect Explorer (AKA skeletonviewer) provided an implementation of this?

    Clever, witty forum signature.
    • Marked as answer by tkingcer Monday, February 6, 2012 2:32 AM
    Monday, February 6, 2012 12:51 AM
  • Yes, the sample code Kinect Explorer provided an brief implementation in C#. Thank you.

    It would be much better if the sdk can supply a same sample in C++. 

    • Marked as answer by tkingcer Monday, February 6, 2012 2:33 AM
    Monday, February 6, 2012 2:32 AM
  • You're right, we haven't added it to any of the C++ samples yet. It's on our to-do list.

    The usage is fairly simple, though: After obtaining your image depth stream handle from NuiImageStreamOpen, call...

    NuiImageStreamSetImageFrameFlags(hStream, NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE);

    You may also want to combine ("or") this with the NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES, which will give you distinct values when the depth is outside the supported range (without this flag, all out-of-bounds values are just reported as zero):

    NUI_IMAGE_DEPTH_NO_VALUE means closer than minimum depth;

    NUI_IMAGE_DEPTH_TOO_FAR_VALUE means further than maximum depth;

    NUI_IMAGE_DEPTH_UNKNOWN_VALUE means no reading was obtained by the sensor.

    John
    K4W Dev

     

    • Marked as answer by tkingcer Tuesday, February 7, 2012 6:05 AM
    Monday, February 6, 2012 6:43 PM

All replies

  • I thought that Kinect Explorer (AKA skeletonviewer) provided an implementation of this?

    Clever, witty forum signature.
    • Marked as answer by tkingcer Monday, February 6, 2012 2:32 AM
    Monday, February 6, 2012 12:51 AM
  • Yes, the sample code Kinect Explorer provided an brief implementation in C#. Thank you.

    It would be much better if the sdk can supply a same sample in C++. 

    • Marked as answer by tkingcer Monday, February 6, 2012 2:33 AM
    Monday, February 6, 2012 2:32 AM
  • You're right, we haven't added it to any of the C++ samples yet. It's on our to-do list.

    The usage is fairly simple, though: After obtaining your image depth stream handle from NuiImageStreamOpen, call...

    NuiImageStreamSetImageFrameFlags(hStream, NUI_IMAGE_STREAM_FLAG_ENABLE_NEAR_MODE);

    You may also want to combine ("or") this with the NUI_IMAGE_STREAM_FLAG_DISTINCT_OVERFLOW_DEPTH_VALUES, which will give you distinct values when the depth is outside the supported range (without this flag, all out-of-bounds values are just reported as zero):

    NUI_IMAGE_DEPTH_NO_VALUE means closer than minimum depth;

    NUI_IMAGE_DEPTH_TOO_FAR_VALUE means further than maximum depth;

    NUI_IMAGE_DEPTH_UNKNOWN_VALUE means no reading was obtained by the sensor.

    John
    K4W Dev

     

    • Marked as answer by tkingcer Tuesday, February 7, 2012 6:05 AM
    Monday, February 6, 2012 6:43 PM
  • Thank you. I appreciate your detailed explanation a lot.
    Tuesday, February 7, 2012 6:05 AM
  • thanks but how and where i should use these three value ?i want to know where if the player is near or out of range, then to do some actions.

    NUI_IMAGE_DEPTH_NO_VALUE

    NUI_IMAGE_DEPTH_TOO_FAR_VALUE

    NUI_IMAGE_DEPTH_UNKNOWN_VALUE


    farhood

    Monday, May 14, 2012 4:19 PM