Ejemplo n.º 1
0
        private void OpticalflowView(OpenFileDialog openFileDialog1)
        {
            OpticalFlow.Text       = "Testing.. Please Wait";
            openFileDialog1.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";


            //selectedFilePath = result.ToString();

            int total = 0;

            foreach (String file in openFileDialog1.FileNames)
            {
                total++;
            }

            if (total < 14)
            {
                MessageBox.Show("Please select 14 images.");
            }

            Mat[] inputArray = new Mat[14];
            int   j          = 0;

            foreach (String file in openFileDialog1.FileNames)
            {
                // Create a PictureBox.
                try
                {
                    inputArray[j] = new Mat(file, ImreadModes.Color);
                    j++;
                }
                catch (SecurityException ex)
                {
                    // The user lacks appropriate permissions to read files, discover paths, etc.
                    MessageBox.Show("Security error. Please contact your administrator for details.\n\n" +
                                    "Error message: " + ex.Message + "\n\n" +
                                    "Details (send to Support):\n\n" + ex.StackTrace
                                    );
                }
                catch (Exception ex)
                {
                    // Could not load the image - probably related to Windows file system permissions.
                    MessageBox.Show("Cannot display the image: " + file.Substring(file.LastIndexOf('\\'))
                                    + ". You may not have permission to read the file, or " +
                                    "it may be corrupt.\n\nReported error: " + ex.Message);
                }
            }
            string emotion = EDRIPOpticalFlowMain.getInstance().predictEmotionGeneralized(inputArray);

            OpticalFlow.Text = "Predicted emotion is " + emotion;
        }
Ejemplo n.º 2
0
 private void OpticalflowViewTrain(string[] files)
 {
     EDRIPOpticalFlowMain.getInstance().trainEmotion(files);
 }