static void Main() { b = new Bitmap(640, 480, PixelFormat.Format32bppArgb); hand = new JointTracker(); elbow = new JointTracker(); myK = KinectSensor.KinectSensors[0]; myK.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); myK.SkeletonStream.Enable(); myK.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30); myK.Start(); myK.SkeletonFrameReady += new EventHandler <SkeletonFrameReadyEventArgs>(SkeletonFrameReady); myK.ColorFrameReady += new EventHandler <ColorImageFrameReadyEventArgs>(ColorImageFrameReady); myK.DepthFrameReady += new EventHandler <DepthImageFrameReadyEventArgs>(DepthFrameReady); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); f = new cameraForm(); beginListening(); f.setConnectionL("Listening on port " + PORT); Application.Run(f); }
static void draw(cameraForm f) { Bitmap temp; temp = b; short[] data = new short[depth.PixelDataLength]; depth.CopyPixelDataTo(data); for (int y = 0; y < depth.Height; y++) { for (int x = 0; x < depth.Width; x++) { short s = data[(depth.Width * y + x)]; Color col = temp.GetPixel(2 * x, 2 * y); if ((s & 0x0007) != 0) { col = Color.FromArgb(col.R, col.G, (col.B + 255) / 2); temp.SetPixel(2 * x, 2 * y, col); } } } f.draw(temp); }
static void Main() { b = new Bitmap(640, 480, PixelFormat.Format32bppArgb); hand = new JointTracker(); elbow = new JointTracker(); myK = KinectSensor.KinectSensors[0]; myK.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); myK.SkeletonStream.Enable(); myK.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30); myK.Start(); myK.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(SkeletonFrameReady); myK.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(ColorImageFrameReady); myK.DepthFrameReady += new EventHandler<DepthImageFrameReadyEventArgs>(DepthFrameReady); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); f = new cameraForm(); beginListening(); f.setConnectionL("Listening on port " + PORT); Application.Run(f); }
static void draw(cameraForm f) { Bitmap temp; temp = b; short[] data = new short[depth.PixelDataLength]; depth.CopyPixelDataTo(data); for (int y = 0; y < depth.Height; y++) { for (int x = 0; x < depth.Width; x++) { short s = data[(depth.Width*y+x)]; Color col = temp.GetPixel(2*x,2*y); if((s&0x0007)!=0) { col = Color.FromArgb(col.R,col.G,(col.B+255)/2); temp.SetPixel(2 * x, 2 * y, col); } } } f.draw(temp); }