Example #1
0
        public EmotionRecognizer(ImageListener listener)
        {
            detector = new PhotoDetector(3, FaceDetectorMode.SMALL_FACES);
            var classifierPath = @"D:\dev\AffdexSDK\data";

            detector.setClassifierPath(classifierPath);
            detector.setDetectAllEmotions(true);

            detector.setImageListener(listener);

            detector.start();
        }
Example #2
0
        private AffdexAdapter(FaceDetectorMode mode)
        {
            detector = new PhotoDetector(1, mode);

            detector.setClassifierPath(classifierPath);

            detector.setProcessStatusListener(this);
            detector.setImageListener(this);

            detector.setDetectAllAppearances(true);
            detector.setDetectAllEmojis(true);
            detector.setDetectAllEmotions(true);
            detector.setDetectAllExpressions(false);
        }
Example #3
0
        static void Main(string[] args)
        {
            /*
             *          CmdOptions options = new CmdOptions();
             *          if (CommandLine.Parser.Default.ParseArguments(args, options))
             *          {
             *              Affdex.Detector detector = null;
             *              List<string> imgExts = new List<string> { ".bmp", ".jpg", ".gif", ".png", ".jpe" };
             *              List<string> vidExts = new List<string> { ".avi", ".mov", ".flv", ".webm", ".wmv", ".mp4" };
             *              bool isCamera = (options.Input.ToLower() == "camera");
             *              bool isImage = imgExts.Any<string>(s => (options.Input.Contains(s) || options.Input.Contains(s.ToUpper())));
             *              bool isVideo = (!isImage && !isCamera);
             *
             *              if (isCamera)
             *              {
             *                  System.Console.WriteLine("Trying to process a camera feed...");
             *                  detector = new Affdex.CameraDetector(0, 30, 30, (uint)options.numFaces, (Affdex.FaceDetectorMode)options.faceMode);
             *
             *              }
             *              else if (isImage)
             *              {
             *                  System.Console.WriteLine("Trying to process a bitmap image..." + options.Input.ToString());
             *                  detector = new Affdex.PhotoDetector((uint)options.numFaces, (Affdex.FaceDetectorMode)options.faceMode);
             *              }
             *              else if (isVideo)
             *              {
             *                  System.Console.WriteLine("Trying to process a video file..." + options.Input.ToString());
             *                  detector = new Affdex.VideoDetector(30, (uint)options.numFaces, (Affdex.FaceDetectorMode)options.faceMode);
             *              }
             *              else
             *              {
             *                  System.Console.WriteLine("File-Type not supported.");
             *              }
             *              if (detector != null)
             *              {
             *                  ProcessVideo videoForm = new ProcessVideo(detector);
             *                  detector.setClassifierPath(options.DataFolder);
             *                  detector.setDetectAllEmotions(true);
             *                  detector.setDetectAllExpressions(true);
             *                  detector.setDetectAllEmojis(true);
             *                  detector.setDetectAllAppearances(true);
             *                  detector.start();
             *                  System.Console.WriteLine("Face detector mode = " + detector.getFaceDetectorMode().ToString());
             *                  if (isVideo) ((Affdex.VideoDetector)detector).process(options.Input);
             *                  else if (isImage) ((Affdex.PhotoDetector)detector).process(LoadFrameFromFile(options.Input));
             *
             *                  videoForm.ShowDialog();
             *                  detector.stop();
             *              }
             *
             *          }
             */

            PhotoDetector detector       = new PhotoDetector(1, FaceDetectorMode.SMALL_FACES);
            String        classifierPath = "C:\\Program Files\\Affectiva\\AffdexSDK\\data";


            detector.setClassifierPath(classifierPath);
            ProcessVideo videoForm = new ProcessVideo(detector);

            detector.setDetectAllEmotions(true);
            detector.getDetectAge();
            detector.start();
            // System.Console.WriteLine("Face detector mode = " + detector.getFaceDetectorMode().ToString());
            ((Affdex.PhotoDetector)detector).process(LoadFrameFromFile(@"C:\Users\Mantas\Desktop\6.jpg"));

            videoForm.ShowDialog();
            detector.stop();
        }