Beispiel #1
0
        /*
         * /// <summary>
         * /// Raises the show debug toggle event.
         * /// </summary>
         * public void OnShowDebugToggle()
         * {
         *  Debug.Log("User clicked [Debug] button.");
         *  m_debug = !m_debug;
         *  Debug.Log("Debug mode: " + m_debug + ".");
         * }
         */

        /// <summary>
        /// Raises the save button event.
        /// </summary>
        public void OnSaveButton()
        {
            Debug.Log("User clicked [Save] button.");

            if (model != null)
            {
                // Cleaning old files.
                string[] filePaths = Directory.GetFiles(Application.temporaryCachePath);
                foreach (string filePath in filePaths)
                {
                    File.SetAttributes(filePath, FileAttributes.Normal);
                    File.Delete(filePath);
                }

                // save the train data.
                model.save(Application.temporaryCachePath + "/traindata.yml");

                // save the preprocessedfaces.
                for (int i = 0; i < m_numPersons; ++i)
                {
                    Imgcodecs.imwrite(Application.temporaryCachePath + "/preprocessedface" + i + ".jpg", preprocessedFaces [m_latestFaces [i]]);
                }
            }
            else
            {
                Debug.Log("save failure. train data does not exist.");
            }
        }