示例#1
0
        /// <summary>
        /// OpenNIスレッドの起動
        /// 
        /// </summary>
        private void StartOpenNI()
        {
            try
            {
                context = new Context(Application.StartupPath + Settings.OPENNI_CONFIG);
            } catch(GeneralException ge){
                Console.WriteLine(ge.Message);
                this.Close();
                return;
            }
            depthGenerator = context.FindExistingNode(NodeType.Depth) as DepthGenerator;
            if (this.depthGenerator == null)
            {
                throw new Exception("Viewer must have a depth node!");
            }

            userGenerator = new UserGenerator(context);
            userGenerator.NewUser += new UserGenerator.NewUserHandler(userGenerator_NewUser);
            userGenerator.LostUser += new UserGenerator.LostUserHandler(userGenerator_LostUser);
            userGenerator.StartGenerating();

            imageGenerator = context.FindExistingNode(NodeType.Image) as ImageGenerator;
            imageGenerator.StartGenerating();

            poseDetectionCapability = new PoseDetectionCapability(userGenerator);
            poseDetectionCapability.PoseDetected += new PoseDetectionCapability.PoseDetectedHandler(poseDetectionCapability_PoseDetected);

            skeletonCapability = new SkeletonCapability(userGenerator);
            skeletonCapability.CalibrationEnd += new SkeletonCapability.CalibrationEndHandler(skeletonCapability_CalibrationEnd);
            skeletonCapability.SetSkeletonProfile(SkeletonProfile.All);

            depthGenerator.GetAlternativeViewPointCap().SetViewPoint(imageGenerator);

            histogram = new int[depthGenerator.GetDeviceMaxDepth()];

            // 出力モード
            //this.mapMode = depthGenerator.GetMapOutputMode();
            this.mapMode = imageGenerator.GetMapOutputMode();

            bitmap = new Bitmap((int)mapMode.nXRes, (int)mapMode.nYRes/*, System.Drawing.Imaging.PixelFormat.Format24bppRgb*/);
            shouldRun = true;
            openNiThread = new Thread(ReaderThread);
            openNiThread.Start();
        }
示例#2
0
 public static extern XnStatus xnGetMapOutputMode(XnNodeHandle hInstance, ref MapOutputMode pOutputMode);
示例#3
0
文件: Query.cs 项目: roxlu/OpenNI
 public void AddSupportedMapOutputMode(MapOutputMode mode)
 {
     UInt32 status = OpenNIImporter.xnNodeQueryAddSupportedMapOutputMode(this.InternalObject, ref mode);
     WrapperUtils.CheckStatus(status);
 }
示例#4
0
 public static extern XnStatus xnNodeQueryAddSupportedMapOutputMode(XnNodeQuery pQuery, ref MapOutputMode pMapOutputMode);