public MainMenu(Login form2) { Instance = this; InitializeComponent(); FaceCamera camera = new FaceCamera(); //初始化相机 if (!camera.Init()) { MessageBox.Show("面部识别库初始化失败!\n" + "点击确定关闭程序。", "人脸库失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); System.Environment.Exit(0); } if (!SQLModel.InitDB()) { MessageBox.Show("数据库初始化失败!\n" + "点击确定关闭程序。", "人脸库失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); System.Environment.Exit(0); } camera.Data.DataSource = DataAccess.DataSrcType.DataBase; camera.Data.InitDB(SQLEngine.Instance.Connection); camera.Data.LoadFaceData(null); camera.SpeechEnable = true; }
public ExistingUserForm() { InitializeComponent(); faceCam = new FaceCamera(loginPicBox.Width, loginPicBox.Height, new FaceRecognition()); faceCam.FrameGrabbed += OnFrameGrabbed; faceCam.ExistingUserRecognised += OnExistingUserRecognised; }
public void SetUp() { go = new GameObject(); fc = go.AddComponent <FaceCamera>(); Camera.main.transform.position = new Vector3(0, 1, 0); go.transform.position = Vector3.zero; }
/// <summary> /// Internal function which is the base for the different public Show methods /// Displays a MessageBox and sets it either at a fixed position or to follow the user /// </summary> /// <param name="text">The text message which should be displayed to the user</param> /// <param name="type">The type of the MessageBox</param> /// <param name="fixedPosition">True if the MessageBox should be displayed at a fixed position</param> /// <param name="position">The global position where the message box is shown (only used if fixedPosition true)</param> /// <param name="rotation">The global rotation of the message box (only used if fixedPosition true)</param> private static void Show(string text, MessageBoxType type, bool fixedPosition, Vector3 position, Quaternion rotation) { // load the MessageBox from the resources and set the necessary variables GameObject messageBox = (GameObject)Instantiate(Resources.Load("MessageBox")); //messageBox.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 3; MessageBox msgBox = messageBox.GetComponent <MessageBox>(); msgBox.Text = text; msgBox.type = type; if (fixedPosition) { // if a fixed position is used: destroy all compononents from the prefab which modify the position and rotation SimpleTagalong tagalong = messageBox.GetComponent <SimpleTagalong>(); Destroy(tagalong); FaceCamera faceCamera = messageBox.GetComponent <FaceCamera>(); Destroy(faceCamera); Window3D window = messageBox.GetComponent <Window3D>(); Destroy(window); // then set the position and rotation messageBox.transform.position = position; messageBox.transform.rotation = rotation; } count++; }
void Start() { characterObject = transform.GetChild(1).gameObject; wallAnimator = gameObject.GetComponent <Animator>(); charAnim = characterObject.transform.GetChild(0).GetComponent <Animator>(); rotationScript = gameObject.GetComponent <FaceCamera>(); canvas = GameObject.Find("Canvas"); }
/// <summary> /// this is called when the component is created => register it in the window manager /// </summary> public void Start() { externalWindowLogic = GetComponent <IWindow>(); tagalong = GetComponent <SimpleTagalong>(); faceCamera = GetComponent <FaceCamera>(); WindowManager.Instance.Add(this); renderers = GetComponentsInChildren <Renderer>(); started = true; }
// Start is called before the first frame update private void Start() { FaceCamera faceCamera = GetComponent <FaceCamera>(); Transform head = faceCamera.head; Vector3 offset = faceCamera.offset; transform.position = head.position + offset; gameObject.SetActive(false); }
// Use this for initialization void Start () { m_StartPos = transform; m_TargetPos = transform.position; m_Camera = GameObject.FindGameObjectWithTag("MainCamera").transform; m_Cursor = GameObject.FindGameObjectWithTag("Cursor").transform; m_FaceCamera = GetComponent<FaceCamera> (); m_FaceCamera.enabled = false; //m_Anim.GetComponentInChildren<Animator> (); m_Anim = transform.GetChild(0).GetComponent<Animator>(); }
public RegisterForm(IUserModel user) { User = user; InitializeComponent(); faceCam = new FaceCamera(registerPicBox.Width, registerPicBox.Height, new FaceRecognition()); faceCam.ExistingUserRecognised += OnExistingUserRecognised; faceCam.NewUserRegistered += OnNewUserRegistered; faceCam.FrameGrabbed += OnFrameGrabbed; faceCam.FacePhotoSaved += UpdateProgressBar; progressBar.Maximum = LibraryDataIO.Instance.PicturesPerUser; }
// Use this for initialization void Start () { m_StartPos = transform; m_TargetPos = transform.position; m_Camera = GameObject.FindGameObjectWithTag("MainCamera").transform; m_Cursor = GameObject.FindGameObjectWithTag("Cursor").transform; m_FaceCamera = GetComponent<FaceCamera> (); m_FaceCamera.enabled = false; m_ObjectList = GameObject.FindGameObjectWithTag("ListTree").transform; m_EmptySprite.SetActive (true); m_TreeInstance.SetActive (false); }
public UserAdd(UserManagement f) { InitializeComponent(); _parent = f; _fcamera = FaceCamera.Instance; if (!_fcamera.Open("0", 640, 480)) { MessageBox.Show("相机打开失败!\n" + "请确认相机硬件连接。", "相机启动失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } _fcamera.PicBoxRealTime = pictureBox_rt; _fcamera.PicBoxFoundPic = null; _fcamera.PicBoxShotFace = null; _fcamera.FaceHandler += onFaceHandler; _fcamera.Start(); _fcamera.FaceCmd = FaceCamera.FaceCommand.None; }
public Recharge() { InitializeComponent(); _faceCamera = FaceCamera.Instance; if (!_faceCamera.Open("0", 640, 480)) { MessageBox.Show("相机打开失败!\n" + "请确认相机硬件连接。", "相机启动失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //设置人脸相机参数 _faceCamera.PicBoxRealTime = pictureBox1; //指定实时图像的图片框 _faceCamera.PicBoxShotFace = pictureBox2; //实时人脸 _faceCamera.PicBoxFoundPic = pictureBox3; _faceCamera.FaceHandler += onFaceHandler; _faceCamera.Start(); _faceCamera.FaceCmd = FaceCamera.FaceCommand.ShotOneAndFind; }
public BrushFace() { this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; InitializeComponent(); _faceCamera = FaceCamera.Instance; if (!_faceCamera.Open("0", 640, 480)) { MessageBox.Show("相机打开失败!\n" + "请确认相机硬件连接。", "相机启动失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //设置人脸相机参数 _faceCamera.PicBoxRealTime = realTime; //指定实时图像的图片框 _faceCamera.PicBoxShotFace = null; //实时人脸 _faceCamera.PicBoxFoundPic = pictureBox_dicFace; _faceCamera.FaceHandler += onFaceHandler; _faceCamera.Start(); _faceCamera.FaceCmd = FaceCamera.FaceCommand.ShotOneAndFind; }
private static void Display(string label, string text, int maxNumberOfCharacters, Action <string> callWithResult, bool fullKeyboard, bool fixedPosition, Vector3 position, Quaternion rotation) { GameObject keyboardInstance; if (fullKeyboard) { keyboardInstance = GameObject.Instantiate(WindowResources.Instance.Keyboard); } else { keyboardInstance = GameObject.Instantiate(WindowResources.Instance.Numpad); } Keyboard keyboard = keyboardInstance.GetComponent <Keyboard>(); keyboard.label.text = label; keyboard.Text = text; keyboard.callWithResult = callWithResult; keyboard.IsFullKeyboard = fullKeyboard; keyboard.MaxLength = maxNumberOfCharacters; if (fixedPosition) // use a fixed position for the keyboardi instead of tracking it with the view { // delete the components from the prefab which realize the view tracking SimpleTagalong tagalong = keyboardInstance.GetComponent <SimpleTagalong>(); Destroy(tagalong); FaceCamera faceCamera = keyboardInstance.GetComponent <FaceCamera>(); Destroy(faceCamera); Window3D window = keyboardInstance.GetComponent <Window3D>(); Destroy(window); // set the position of the keyboard keyboardInstance.transform.position = position; keyboardInstance.transform.rotation = rotation; } currentlyOpenedKeyboard = keyboard; }