public DrawDemo(TouchlessMgr tlmgr, Rectangle displayBounds) { _tlmgr = tlmgr; // Initialize the display bounds _displayWidth = displayBounds.Width; _displayHeight = displayBounds.Height; // Initialize the canvas for drawing and its graphics object _canvas = new Bitmap(_tlmgr.CurrentCamera.CaptureWidth, _tlmgr.CurrentCamera.CaptureHeight); _canvas.RotateFlip(RotateFlipType.Rotate180FlipNone); _canvasGFX = Graphics.FromImage(_canvas); _canvasGFX.FillRectangle(new SolidBrush(Color.FromArgb(64, 255, 255, 255)), 0, 0, _canvas.Width, _canvas.Height); _canvasGFX.ScaleTransform(-1, 1); _canvasGFX.TranslateTransform(-_canvas.Width, 0); // Initialize the points and pen used for drawing segments _pen = new Pen(Color.Black); _p1 = new Point(); _p2 = new Point(); // Add marker update handling foreach (Marker marker in tlmgr.Markers) { marker.OnChange += new EventHandler <MarkerEventArgs>(updateMarker); } }
private void Form1_Load(object sender, EventArgs e) { //initialize the touchless manager object manager = new TouchlessMgr(); //Listing the available cameras in the combobox foreach (Camera item in manager.Cameras) { cmbCamera.Items.Add(item); } try { manager.CurrentCamera = (Camera)manager.Cameras[0]; } catch (Exception) { } //manager.CurrentCamera.OnImageCaptured += new EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); picSize = new Size(255, 209); publisher = new UdpClient(); client = new UdpClient(); computerName = Environment.MachineName; ipAddresses = System.Net.Dns.GetHostAddresses(computerName); //webcam defines publisher.Client.Blocking = false; client.Client.ReceiveTimeout = 100; client.Client.Blocking = false; client.ExclusiveAddressUse = false; publisher.ExclusiveAddressUse = false; }
private void InitCamera() { try { // Create Touchless lib manager to work with video camera _touchlessMgr = new TouchlessMgr(); // Iterate through available video camera devices foreach (Camera camera in _touchlessMgr.Cameras) { // Add to list of available camera devices cbCamera.Items.Add(camera); } // Select first available camera cbCamera.SelectedItem = _touchlessMgr.Cameras[0]; // Setting default image dimensions; see also camera selection event. _touchlessMgr.Cameras[0].CaptureWidth = int.Parse(tbCameraWidth.Text); _touchlessMgr.Cameras[0].CaptureHeight = int.Parse(tbCameraHeight.Text); } catch (Exception ex) { MessageBox.Show("No video camera available. Please connect camera.\n" + ex.Message); } }
public DrawPicture(TouchlessMgr tlmgr, Rectangle displayBounds, string fileName) { this.tlmgr = tlmgr; // Initialize the display bounds displayWidth = displayBounds.Width; displayHeight = displayBounds.Height; cameraWidth = tlmgr.Cameras[0].CaptureWidth; cameraHeight = tlmgr.Cameras[0].CaptureHeight; pics = new Pictures(@fileName); pic = pics.getPicAutoPlus(); // Initialize the canvas for drawing and its graphics object canvas = new Bitmap(tlmgr.CurrentCamera.CaptureWidth, tlmgr.CurrentCamera.CaptureHeight); canvasGFX = Graphics.FromImage(canvas); canvasGFX.FillRectangle(new SolidBrush(Color.FromArgb(64, 255, 255, 255)), 0, 0, canvas.Width, canvas.Height); // Initialize the points and pen used for drawing segments pen = new Pen(Color.Black); //p1 = new Point(); p2 = new Point(); // Add marker update handling foreach (Marker marker in tlmgr.Markers) { marker.OnChange += new EventHandler<MarkerEventArgs>(updateMarker); } //开始时间 pics.setStartTime(); }
private void InitCamera() { try { // create touchless lib manager to work with video camera MANAGER = new TouchlessMgr(); // iterate through available video camera devices foreach (Camera item in MANAGER.Cameras) { // add to the list of available camera devices cbCamera.Items.Add(item); } // select first available camera cbCamera.SelectedItem = MANAGER.Cameras[0]; // setting default image dimensions, see also camera selection event MANAGER.Cameras[0].CaptureWidth = int.Parse(tbCameraWidth.Text); MANAGER.Cameras[0].CaptureHeight = int.Parse(tbCameraHeight.Text); } catch (Exception ex) { MessageBox.Show("No video camera available. Please connect the camera\n" + ex.Message); } }
public void Start() { if (this.ComboBoxCameras.SelectedItem == null) { return; } thrashOldCamera(); this.TouchLessWebCamMgr = new TouchlessMgr(); try { foreach (Camera c in TouchLessWebCamMgr.Cameras) { if (this.ComboBoxCameras.SelectedItem.ToString() == c.ToString()) { this.CurrentCamera = c; } } if (this.CurrentCamera != null) { TouchLessWebCamMgr.CurrentCamera = this.CurrentCamera; this.CurrentCamera.OnImageCaptured += new EventHandler <CameraEventArgs>(OnImageCaptured); } } catch (Exception ex) { throw ex; } }
public DrawPicture(TouchlessMgr tlmgr, Rectangle displayBounds, string fileName) { this.tlmgr = tlmgr; // Initialize the display bounds displayWidth = displayBounds.Width; displayHeight = displayBounds.Height; cameraWidth = tlmgr.Cameras[0].CaptureWidth; cameraHeight = tlmgr.Cameras[0].CaptureHeight; pics = new Pictures(@fileName); pic = pics.getPicAutoPlus(); // Initialize the canvas for drawing and its graphics object canvas = new Bitmap(tlmgr.CurrentCamera.CaptureWidth, tlmgr.CurrentCamera.CaptureHeight); canvasGFX = Graphics.FromImage(canvas); canvasGFX.FillRectangle(new SolidBrush(Color.FromArgb(64, 255, 255, 255)), 0, 0, canvas.Width, canvas.Height); // Initialize the points and pen used for drawing segments pen = new Pen(Color.Black); //p1 = new Point(); p2 = new Point(); // Add marker update handling foreach (Marker marker in tlmgr.Markers) { marker.OnChange += new EventHandler <MarkerEventArgs>(updateMarker); } //开始时间 pics.setStartTime(); }
public void Start() { if (this.ComboBoxCameras.SelectedItem == null) return; thrashOldCamera(); this.TouchLessWebCamMgr = new TouchlessMgr(); try { foreach (Camera c in TouchLessWebCamMgr.Cameras) { if (this.ComboBoxCameras.SelectedItem.ToString() == c.ToString()) { this.CurrentCamera = c; } } if (this.CurrentCamera != null) { TouchLessWebCamMgr.CurrentCamera = this.CurrentCamera; this.CurrentCamera.OnImageCaptured += new EventHandler<CameraEventArgs>(OnImageCaptured); } } catch (Exception ex) { throw ex; } }
private void TouchlessDemo_Load(object sender, EventArgs e) { // Make a new TouchlessMgr for library interaction _touchlessMgr = new TouchlessMgr(); // Initialize some members _dtFrameLast = DateTime.Now; _fAddingMarker = false; _fChangingMode = false; _markerSelected = null; _addedMarkerCount = 0; // Put the app in camera mode and select the first camera by default radioButtonCamera.Checked = true; foreach (Camera cam in _touchlessMgr.Cameras) { comboBoxCameras.Items.Add(cam); } if (comboBoxCameras.Items.Count > 0) { comboBoxCameras.SelectedIndex = 0; } else { MessageBox.Show("Oops, this requires a Webcam. Please connect a Webcam and try again."); Environment.Exit(0); } // Try going directly to the markers tab if (radioButtonMarkers.Enabled) { radioButtonMarkers.Checked = true; } }
public DefendDemo(TouchlessMgr tlmgr, Rectangle displayBounds) { _tlmgr = tlmgr; _captureWidth = tlmgr.CurrentCamera.CaptureWidth; _captureHeight = tlmgr.CurrentCamera.CaptureHeight; _displayWidth = displayBounds.Width; _displayHeight = displayBounds.Height; _displayScale = _displayWidth / _captureWidth; _backgroundColor = Color.Black; _puckBrush = Brushes.WhiteSmoke; _puckRadius = 12; _rand = new Random(); _puckPosition = _puckStartPosition = new Point(_displayWidth / 2, _displayHeight / 2); _puckVelocity = new Point(_rand.Next(3) + 3, _rand.Next(3) + 3); if (_rand.Next(2) == 0) { _puckVelocity.X *= -1; } if (_rand.Next(2) == 0) { _puckVelocity.Y *= -1; } _lastPlayerToHit = -1; // Add marker update handling foreach (Marker marker in _tlmgr.Markers) { marker.OnChange += new EventHandler <MarkerEventArgs>(updateMarker); } // Add the players _players = new List <Player>(2); if (_tlmgr.MarkerCount >= 1) { _players.Add(new Player(_tlmgr.Markers[0], Color.Red, false, new Point(10, 10), new Rectangle(5, 0, _BasePaddle.Width, _BasePaddle.Height), new Rectangle(-50, -50, 52, _displayHeight + 100))); } if (_tlmgr.MarkerCount >= 2) { _players.Add(new Player(_tlmgr.Markers[1], Color.Blue, false, new Point(_displayWidth - 45, 10), new Rectangle(_displayWidth - 5 - _BasePaddle.Width, 0, _BasePaddle.Width, _BasePaddle.Height), new Rectangle(_displayWidth - 2, -50, 52, _displayHeight + 100))); } if (_tlmgr.MarkerCount >= 3) { _players.Add(new Player(_tlmgr.Markers[2], Color.Green, true, new Point(10, _displayHeight - 45), new Rectangle(0, _displayHeight - 5 - _BasePaddle.Width, _BasePaddle.Height, _BasePaddle.Width), new Rectangle(-50, _displayHeight - 2, _displayWidth + 100, 52))); } if (_tlmgr.MarkerCount >= 4) { _players.Add(new Player(_tlmgr.Markers[3], Color.Wheat, true, new Point(_displayWidth - 45, _displayHeight - 45), new Rectangle(0, 5, _BasePaddle.Height, _BasePaddle.Width), new Rectangle(-50, -50, _displayWidth + 100, 52))); } }
private void Form1_Load(object sender, EventArgs e) { _barcodeReader = new BarcodeReader(); _touch = new TouchlessMgr(); button2.Enabled = false; button4.Enabled = false; radioButton1.Select(); }
private void button3_Click(object sender, EventArgs e) { myCamera.Dispose(); myCamera = null; button2.Visible = true; button3.Visible = false; button4.Visible = false; }
private void thrashOldCamera() { // Dispose of the TouchlessMgr object if (TouchLessWebCamMgr != null) { TouchLessWebCamMgr.Dispose(); TouchLessWebCamMgr = null; } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { // Dispose of the TouchlessMgr object if (_touchlessMgr != null) { _touchlessMgr.Dispose(); _touchlessMgr = null; } }
public Form12() { InitializeComponent(); // Initialize Dynamsoft Barcode Reader _barcodeReader = new BarcodeReader(); // Initialize Touchless _touch = new TouchlessMgr(); }
public SnakeDemo(TouchlessMgr tlmgr, Rectangle displayBounds) { _tlmgr = tlmgr; _captureWidth = tlmgr.CurrentCamera.CaptureWidth; _captureHeight = tlmgr.CurrentCamera.CaptureHeight; _displayScale = displayBounds.Width / _captureWidth; _canvas = new Bitmap(displayBounds.Width, displayBounds.Height); _rows = 24; _cols = 32; _cellSize = new Size(_captureWidth * _displayScale / _cols, _captureHeight * _displayScale / _rows); _backgroundBrush = Brushes.Wheat; _collisionBrush = Brushes.Red; _nibbleBrush = Brushes.Green; _rand = new Random(); _updatingSnake = false; // Make a new snake _snake = new Snake(Brushes.Black); _snake.body.Insert(0, new Point(_captureWidth * _displayScale / 2, 0)); _snake.body.Insert(0, new Point(_captureWidth * _displayScale / 2, _cellSize.Height)); _snake.body.Insert(0, new Point(_captureWidth * _displayScale / 2, _cellSize.Height * 2)); _snake.dx = _snake.dxm = 0; _snake.dy = _snake.dym = 1; _lastStateUpdate = DateTime.Now; _hudStringMarkerDir = "Null (Center)"; _hudStringSnakeDir = "Down"; _hudStringSnakeSize = _snake.body.Count.ToString(); // Clear the canvas object using the background brush Graphics gfx = Graphics.FromImage(_canvas); gfx.FillRectangle(_backgroundBrush, 0, 0, _captureWidth * _displayScale, _captureHeight * _displayScale); // Draw the initial snake Rectangle snakeRect = new Rectangle(_snake.body[2], new Size(_cellSize.Width, 3 * _cellSize.Height)); gfx.FillRectangle(_snake.brush, snakeRect); // Make and draw the first nibble _nibble = new Point(_captureWidth * _displayScale / 2, _cellSize.Height * 6); Rectangle nibbleRect = new Rectangle(_nibble, _cellSize); gfx.FillRectangle(_nibbleBrush, nibbleRect); // Create a rectangle that represents the center-origin rect for null input _nullZone = new Rectangle(-_captureWidth / 8, -_captureHeight / 8, _captureWidth / 4, _captureHeight / 4); _nullZoneDisplay = new Rectangle(_captureWidth / 2 - _captureWidth / 8, _captureHeight / 2 - _captureHeight / 8, _captureWidth / 4, _captureHeight / 4); // Precalculate the corner angles for input partitioning _angleNW = (int)(Math.Atan2(_captureHeight / 2, -_captureWidth / 2) * 180 / Math.PI); _angleNE = (int)(Math.Atan2(_captureHeight / 2, _captureWidth / 2) * 180 / Math.PI); _angleSE = (int)(Math.Atan2(-_captureHeight / 2, _captureWidth / 2) * 180 / Math.PI); _angleSW = (int)(Math.Atan2(-_captureHeight / 2, -_captureWidth / 2) * 180 / Math.PI); // Add marker update handling _tlmgr.Markers[0].OnChange += new EventHandler <MarkerEventArgs>(updateMarker); }
private void Form1_Load(object sender, EventArgs e) { //initialize the touchless manager object manager = new TouchlessMgr(); //Listing the available cameras in the combobox foreach (Camera item in manager.Cameras) { cmbCamera.Items.Add(item); } }
public string decoded; //Biến phiên dịch public Form1() { InitializeComponent(); // Initialize Dynamsoft Barcode Reader _barcodeReader = new BarcodeReader(); // Initialize Touchless _touch = new TouchlessMgr(); button2.Enabled = false; button4.Enabled = false; }
// Form constructor public MainForm() { InitializeComponent(); // Create Touchless library manager _touchlessLibManager = new TouchlessMgr(); // Setup background worker _backgroundWorker.WorkerSupportsCancellation = true; _backgroundWorker.DoWork += BackgroundWorker_DoWork; _backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted; }
private void InitCameras() { TouchlessMgr _mgr = new TouchlessMgr(); ComboBoxCameras.Items.Clear(); foreach (Camera c in _mgr.Cameras) { this.ComboBoxCameras.Items.Add(c.ToString()); } _mgr.Dispose(); _mgr = null; PictureBox.Paint += new PaintEventHandler(PictureBox_Paint); }
public ImageDemo(TouchlessMgr tlmgr, Rectangle displayBounds) { _tlmgr = tlmgr; // Initialize the image (read from file) _image = new Bitmap("image.gif"); _imageWidth = _image.Width; _imageHeight = _image.Height; // Initialize the bounds _captureWidth = tlmgr.CurrentCamera.CaptureWidth; _captureHeight = tlmgr.CurrentCamera.CaptureHeight; _displayWidth = displayBounds.Width; _displayHeight = displayBounds.Height; _displayScale = _displayWidth / _tlmgr.CurrentCamera.CaptureWidth; // Add marker update handling (one or two markers?) if (tlmgr.MarkerCount >= 2) { _oneMarker = false; tlmgr.Markers[0].OnChange += new EventHandler <MarkerEventArgs>(updatePrimaryMarker); tlmgr.Markers[1].OnChange += new EventHandler <MarkerEventArgs>(updateSecondaryMarker); // Initialize the points used for placing the image _destPoints = new Point[3]; _destPoints[0] = new Point(); _destPoints[1] = new Point(); _destPoints[2] = new Point(); // Calculate the image's diagonal length _imageDiagonal = (float)Math.Sqrt(_imageWidth * _imageWidth + _imageHeight * _imageHeight); // The angle from the lower-left corner to the upper right corner (from North) _imageDiagonalAngle = (float)Math.Atan2(_imageWidth, _imageHeight); } else // For a single marker { _oneMarker = true; tlmgr.Markers[0].OnChange += new EventHandler <MarkerEventArgs>(updateSingleMarker); _markerPos = new Point(0, 0); _currentCenter = new Point(_displayWidth / 2, _displayHeight / 2); _velocityCenter = new PointF(0, 0); _baselineArea = 0; _sampleFrameCount = 0; _currentScale = 1.0F; } }
protected override void OnStart(string[] args) { _log.Info("{0}{0}Starting service.", Environment.NewLine); var outputPath = Config("OutputPath"); var interval = ConfigInt("Interval"); var cameraName = Config("CameraName"); var captureWidth = ConfigInt("ImageWidth"); var captureHeight = ConfigInt("ImageHeight"); var imageQuality = ConfigInt("ImageQuality"); // note: these must be stored as fields in this service _mgr = new TouchlessMgr(); _webCam = new WebCam(_mgr, outputPath, cameraName, captureWidth, captureHeight, imageQuality); _timer = new Timer(_webCam.Render, null, 0, interval); }
private void VisualLaneDetection_Load(object sender, EventArgs e) { manager = new TouchlessMgr(); foreach (Camera item in manager.Cameras) { comboBox_Camera.Items.Add(item); } variables = new Variables(); //this.TopMost = true; //this.FormBorderStyle = FormBorderStyle.None; //this.WindowState = FormWindowState.Maximized; }
private void DeinitCamera() { if (_touchlessMgr != null) { _touchlessMgr.CurrentCamera.OnImageCaptured -= CurrentCamera_OnImageCaptured; _touchlessMgr.CurrentCamera = null; } if (cbCamera.SelectedItem != null) { cbCamera.SelectedItem = null; } cbCamera.Items.Clear(); _touchlessMgr = null; Thread.Sleep(500); }
private void DeinitCamera() { if (MANAGER != null) { if (MANAGER.CurrentCamera != null) { MANAGER.CurrentCamera.OnImageCaptured -= CurrentCamera_OnImageCaptured; MANAGER.CurrentCamera = null; } } if (cbCamera.SelectedItem != null) { cbCamera.SelectedItem = null; } cbCamera.Items.Clear(); MANAGER = null; Thread.Sleep(500); }
private void Form1_Load(object sender, EventArgs e) { // Make a new TouchlessMgr for library interaction _touchlessMgr = new TouchlessMgr(); // Initialize some members _dtFrameLast = DateTime.Now; _fAddingMarker = false; // _fChangingMode = false; // _markerSelected = null; _addedMarkerCount = 0; // Put the app in camera mode and select the first camera by default foreach (Camera cam in _touchlessMgr.Cameras) { comboBoxCameras.Items.Add(cam); } if (comboBoxCameras.Items.Count > 0) { comboBoxCameras.SelectedIndex = 0; } else { MessageBox.Show("Oops, this requires a Webcam. Please connect a Webcam and try again."); Environment.Exit(0); } // _fChangingMode = true; pictureBoxDisplay.MouseDown += new MouseEventHandler(pictureBoxDisplay_MouseDown); pictureBoxDisplay.MouseMove += new MouseEventHandler(pictureBoxDisplay_MouseMove); pictureBoxDisplay.MouseUp += new MouseEventHandler(pictureBoxDisplay_MouseUp); if (ghk.Register()) { labelMarkerData.Text = "Hotkey registered."; } else { labelMarkerData.Text = "Hotkey failed to register"; } }
private void button1_Click(object sender, EventArgs e) { if (button1.Text.Equals("Disconnect")) { availableCamera.Dispose(); availableCamera = null; button1.Text = "Connect"; button1.Visible = true; textBox3.Enabled = true; button2.Visible = true; button4.Visible = false; textBox1.AppendText("\n Client disconnected successfully\n"); Cleanup(); } if (button1.Text.Equals("Connect")) { try { tc = new TcpClient(); tc.Connect(textBox3.Text.Trim(), 4000); textBox1.AppendText("Client is ready\n"); this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckKeys); TextChat.Start(); ep = new IPEndPoint(IPAddress.Parse(textBox3.Text.Trim()), 5001); HookRtpEvents(); JoinRtpSession(Dns.GetHostName()); button1.Text = "Disconnect"; textBox3.Enabled = false; button2.Visible = false; button4.Visible = true; udpcli = new UdpClient(6000); iep = new IPEndPoint(IPAddress.Any, 0); // ReadImg = new Thread(new ThreadStart(Start_Receiving_Video_Conference)); } catch (Exception) { } } }
void initCamera() { if (touchlessMgr != null || currentCamera !=null) finalizeCamera(); touchlessMgr = new TouchlessMgr(); IList<Camera> cameras = touchlessMgr.Cameras; foreach (Camera cam in cameras){ try{ touchlessMgr.CurrentCamera = cam; currentCamera = touchlessMgr.CurrentCamera; currentCamera.OnImageCaptured += currentCamera_OnImageCaptured; break; } catch (ApplicationException){ MessageBox.Show("There's seems error in webcam. Please stop and re-play the camera to troubleshoot.", "Message"); } } }
public WebCam(TouchlessMgr mgr, string outputPath, string cameraName, int captureWidth, int captureHeight, int imageQuality) { _outputPath = outputPath; _imageQuality = imageQuality; _log.Info("Found {0} cameras.", mgr.Cameras.Count); mgr.CurrentCamera = mgr.Cameras.Where(c => c.ToString().Contains(cameraName)).SingleOrDefault(); if (mgr.CurrentCamera == null) { _log.Error("Could not find camera with name {0}.", cameraName); return; } _encoder = _encoder ?? ImageCodecInfo.GetImageEncoders().Where(enc => enc.MimeType == "image/jpeg").SingleOrDefault(); _log.Info("Setting resolution to {0} x {1}.", captureWidth, captureHeight); mgr.CurrentCamera.CaptureWidth = captureWidth; mgr.CurrentCamera.CaptureHeight = captureHeight; _camera = mgr.CurrentCamera; }
private void button1_Click(object sender, EventArgs e) { if (button1.Text.Equals("Disconnect")) { availableCamera.Dispose(); availableCamera = null; button1.Text = "Connect"; button1.Visible = true; button1.Enabled = false; textBox3.Enabled = true; button2.Enabled = false; Cleanup(); } if (!t1.Pending()) { textBox1.AppendText("\n Client is offline please try again later \n"); } else { button2.Visible = false; textBox1.AppendText("\n Connected successfully............"); tc = t1.AcceptTcpClient(); this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(CheckKeys); TextChat.Start(); ep = new IPEndPoint(IPAddress.Parse(textBox3.Text), 5001); if (button1.Text.Equals("Connect")) { HookRtpEvents(); JoinRtpSession(Dns.GetHostName()); button1.Text = "Disconnect"; textBox3.Enabled = false; button4.Visible = true; } } }
void initCamera() { if (touchlessMgr != null || currentCamera != null) { finalizeCamera(); } touchlessMgr = new TouchlessMgr(); IList <Camera> cameras = touchlessMgr.Cameras; foreach (Camera cam in cameras) { try{ touchlessMgr.CurrentCamera = cam; currentCamera = touchlessMgr.CurrentCamera; currentCamera.OnImageCaptured += currentCamera_OnImageCaptured; break; } catch (ApplicationException) { MessageBox.Show("There's seems error in webcam. Please stop and re-play the camera to troubleshoot.", "Message"); } } }
private void MainForm_Load(object sender, EventArgs e) { //注册快捷键 HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.None, Keys.F1); HotKey.RegisterHotKey(Handle, 101, HotKey.KeyModifiers.None, Keys.F2); HotKey.RegisterHotKey(Handle, 102, HotKey.KeyModifiers.None, Keys.F3); // Make a new TouchlessMgr for library interaction touchlessMgr = new TouchlessMgr(); if (touchlessMgr.Cameras.Count > 0) { Camera c = touchlessMgr.Cameras[0]; c.OnImageCaptured += new EventHandler <CameraEventArgs>(OnImageCaptured); touchlessMgr.CurrentCamera = c; pictureBoxDisplay.Paint += new PaintEventHandler(drawLatestImage); } else { MessageBox.Show("没有可用的摄像头!"); Environment.Exit(0); } }
public CatchMouseDll(System.Windows.Forms.PictureBox pictureb) { Wspolny.w_touchlessMgr = new TouchlessMgr(); Wspolny.w_picturebox = pictureb; touchlessMgr = Wspolny.w_touchlessMgr; }
private void WUW_Load(object sender, EventArgs e) { // Make a new TouchlessMgr for library interaction _touchlessMgr = new TouchlessMgr(); // Initialize some members _dtFrameLast = DateTime.Now; _latestFrameTime = DateTime.Now; _latestFrameTimeSegment = false; //liyanchang _fAddingMarker = false; _markerSelected = null; _addedMarkerCount = 0; lblMarkerCount.Text = _touchlessMgr.MarkerCount.ToString(); //Hide Settings if (!_show_settings) { _show_settings = true; btnShowHide_Hover(this, e); } // Put the app in camera mode and select the first camera by default tabSettings.SelectedTab = tabPageCamera; foreach (Camera cam in _touchlessMgr.Cameras) { comboBoxCameras.Items.Add(cam); } if (comboBoxCameras.Items.Count > 0) { comboBoxCameras.SelectedIndex = 0; } else { MessageBox.Show("WUW was unable to find a webcam. Please make sure that a camera is connected and installed.", "WUW Camera Error"); Environment.Exit(0); } // Try going directly to the markers tab tabSettings.SelectedTab = tabPageTokens; //APPLICATION //Initialize TestDemo Controls pictureBoxTestDemo.Hide(); //Initialize DrawDemo Controls drawPanel.Hide(); elementHostDraw.Hide(); //Initialize MapDemo Controls webBrowserMap.Hide(); //Initialize PhotoDemo Controls photoDemo_TakePhoto.Hide(); pictureBoxAlbum.Hide(); //Initialize PreviewDemo Controls pictureBoxPreview.Hide(); graphics = pictureBoxPreview.CreateGraphics(); //Initialize GalleryDemo Controls webBrowserGallery.Hide(); //Initialize GlobeDemo Controls this.Hide(); this.Controls.Add(GlobeDemo_Flash); this.Show(); GlobeDemo_Flash.Dock = DockStyle.Fill; GlobeDemo_Flash.SendToBack(); GlobeDemo_Flash.Hide(); //GlobeDemo_Flash.LoadMovie(0, "http://localhost/SWF/dof05_02reverse.swf"); //uncomment this before demo //Initialize MailDemo Controls elementHostMail.Hide(); //Initialize WeatherDemo Controls elementHostWeather.Hide(); //Initialize StockDemo Controls elementHostStock.Hide(); //Initialize EffectsDemo Controls this.Hide(); this.Controls.Add(EffectsDemo_Flash); this.Show(); EffectsDemo_Flash.Dock = DockStyle.Fill; EffectsDemo_Flash.SendToBack(); EffectsDemo_Flash.Hide(); //Initialize NewsPaperDemo Controls elementHostNewsPaper.Hide(); x1 = 200; y1 = 200; x2 = 840; y2 = 680; Theta = Math.Atan2((y2 - y1), (x2 - x1)) - Math.Atan2(768, 1024); distance = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); System.Windows.Media.TransformGroup group1 = new System.Windows.Media.TransformGroup(); group1.Children.Add(new System.Windows.Media.ScaleTransform(distance / 1280, distance / 1280, 0, 0)); group1.Children.Add(new System.Windows.Media.RotateTransform(Theta / Math.PI * 180)); group1.Children.Add(new System.Windows.Media.TranslateTransform(x1, y1)); mediaElement1.RenderTransform = group1; //Initialize ClockDemo Controls elementHostClock.Hide(); //Initialize BookDemo Controls //Initialize MenuDemo Controls Control_menu.AppListSelectionChanged += new EventHandler(Control_menu_AppListSelectionChanged); elementHostMenu.Hide(); //Initialize GestureDemo Controls gestureLoad(); }
private void WUW_FormClosing(object sender, FormClosingEventArgs e) { // Dispose of the TouchlessMgr object if (_touchlessMgr != null) { _touchlessMgr.Dispose(); _touchlessMgr = null; } }
private void MainForm_Load(object sender, EventArgs e) { //注册快捷键 HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.None, Keys.F1); HotKey.RegisterHotKey(Handle, 101, HotKey.KeyModifiers.None, Keys.F2); HotKey.RegisterHotKey(Handle, 102, HotKey.KeyModifiers.None, Keys.F3); // Make a new TouchlessMgr for library interaction touchlessMgr = new TouchlessMgr(); if (touchlessMgr.Cameras.Count > 0) { Camera c = touchlessMgr.Cameras[0]; c.OnImageCaptured += new EventHandler<CameraEventArgs>(OnImageCaptured); touchlessMgr.CurrentCamera = c; pictureBoxDisplay.Paint += new PaintEventHandler(drawLatestImage); } else { MessageBox.Show("没有可用的摄像头!"); Environment.Exit(0); } }
public void StartVideo() { myCamera = new TouchlessMgr(); myCamera.CurrentCamera = myCamera.Cameras[0]; myCamera.Cameras[0].OnImageCaptured += new EventHandler <CameraEventArgs>(OnImageCaptured); }
public CatchMouseDll(System.Windows.Forms.PictureBox pictureb, TouchlessMgr touchlessMenager) { Wspolny.w_touchlessMgr = touchlessMenager; Wspolny.w_picturebox = pictureb; touchlessMgr = Wspolny.w_touchlessMgr; }