private void btnSelectCamera_Click(object sender, EventArgs e) { VideoCaptureDeviceForm form = new VideoCaptureDeviceForm(); if (form.ShowDialog() == DialogResult.OK) { int deviceId = form.DeviceId; kinectDevice = Kinect.GetDevice(deviceId); if (videoCamera == null) { videoCamera = kinectDevice.GetVideoCamera(); videoCamera.CameraMode = VideoCameraMode.Color; controller.Device = videoCamera; controller.Start(); controller.NewFrame += new NewFrameEventHandler(controller_NewFrame); } if (depthCamera == null) { //depthCamera = kinectDevice.GetDepthCamera(); depthCamera = new KinectDepthCamera(deviceId, CameraResolution.Medium, true); videoSourcePlayer1.VideoSource = depthCamera; videoSourcePlayer1.Start(); } toolStripStatusLabel1.Text = "Initializing..."; } }
// Open local video capture device private void localVideoCaptureDeviceToolStripMenuItem_Click(object sender, EventArgs e) { VideoCaptureDeviceForm form = new VideoCaptureDeviceForm(); if (form.ShowDialog(this) == DialogResult.OK) { // create video source VideoCaptureDevice videoSource = new VideoCaptureDevice(form.VideoDevice); // open it OpenVideoSource(videoSource); } }
private void btnSelectCamera_Click(object sender, EventArgs e) { VideoCaptureDeviceForm form = new VideoCaptureDeviceForm(); if (form.ShowDialog() == DialogResult.OK) { VideoCaptureDevice device = new VideoCaptureDevice(form.VideoDevice); device.VideoResolution = selectResolution(device); controller.Device = device; controller.Start(); toolStripStatusLabel1.Text = "Initializing..."; } }
public MainWindow() { InitializeComponent(); var frm = new VideoCaptureDeviceForm(); frm.ShowDialog(); device = new Accord.Video.DirectShow.VideoCaptureDevice(frm.VideoDevice.Source, System.Drawing.Imaging.PixelFormat.Format32bppRgb); device.VideoResolution = frm.VideoDevice.VideoResolution; device.NewFrame += Device_NewFrame; rec = new Int32Rect(0, 0, device.VideoResolution.FrameSize.Width, device.VideoResolution.FrameSize.Height); rcsrc = new System.Drawing.Rectangle(0, 0, rec.Width, rec.Height); // imageWB.SetupSurface(RenderType.WriteBitmap, rec.Width, rec.Height, FrameFormat.RGB32); }