void ImageGrabberThread() { while (!_isDone) { if (!_captured) { _capDev.ToImage(_image, 0, 0, Width, Height); _captured = true; _captureFPS.AddFrame(); //_capDev.Capture (); List <Rect> faces = _faceDetector.DetectFaces(); //foreach (var f in faces) { // Debug.Log ("Found face: " + f.position.ToString ()); //} if (faces.Count > 0) { _face = faces [0]; int x = (int)(Mathf.Max(0, _face.x - Margin)); int y = (int)(Mathf.Max(0, _face.y - Margin)); int w = (int)(Mathf.Min(Width - x, _face.width + Margin * 2)); int h = (int)(Mathf.Min(Height - y, _face.height + Margin * 2)); FaceRect.Set(x, y, w, h); _facePos.AddSample(new Vector3(x, y, w)); _capDev.ToImage(_faceImage, x, y, w, h); _faceCaptured = true; _faceDetected = true; } else { _faceDetected = false; } } } }
public string GetDebugString() { m_fpsHelper.AddFrame(); return("FPS= " + m_fpsHelper.FPS.ToString()); }