My code is not shown output

windows

#1

this is my code. and i’m use visual studio 2017

this is my ProcessCameraFeed Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CamDemoDevDay
{
public partial class ProcessCamerafeed : Form, Affdex.ImageListener
{
public ProcessCamerafeed(Affdex.Detector detector)
{
detector.setImageListener(this);
InitializeComponent();
}

    public void onImageResults(Dictionary<int, Affdex.Face> faces, Affdex.Frame frame)
    {
        foreach (KeyValuePair<int, Affdex.Face> pair in faces)
        {
            Affdex.Face face = pair.Value;
            if (faces != null)
            {
                foreach (PropertyInfo prop in typeof(Affdex.Emotions).GetProperties())
                {
                    float value = (float)prop.GetValue(face.Emotions, null);
                    string output = string.Format("{0}: (1:0.00)", prop.Name, value);
                    System.Console.WriteLine(output);
                }
                System.Console.WriteLine(face.Appearance.Gender.ToString());
                System.Console.WriteLine(face.Appearance.Glasses.ToString());
            }

        }
        frame.Dispose();
    }
    public void onImageCapture(Affdex.Frame frame)
    {
        frame.Dispose();
    }

}

}

this is my program.cs file code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CamDemoDevDay
{
class Program
{
static void Main(string[] args)
{
Affdex.Detector detector = new Affdex.CameraDetector(0, 30, 30, 3, Affdex.FaceDetectorMode.SMALL_FACES);
ProcessCamerafeed feed = new ProcessCamerafeed(detector);
detector.setClassifierPath(“C:\Program Files\Affectiva\AffdexSDK\data”);
detector.setDetectAllEmotions(true);
detector.setDetectBrowRaise(true);
detector.setDetectSmirk(true);
detector.setDetectGender(true);
detector.setDetectGlasses(true);
detector.start();
feed.ShowDialog();
detector.stop();
}
}
}

So, please help me.


#2

Hi, can you be more specific about the problem you’re encountering? Is your onImageResults callback being invoked? What results is it getting?


#3

hiii

you can see only gender is identify in this console output.

No camera output is show…


#4
                string output = string.Format("{0}: (1:0.00)", prop.Name, value);

should be something like:

                string output = string.Format("{0}: {1:N2}", prop.Name, value);

#5

thank you…andy_dennie

code is working…but my face is not shown.


#6

please help me about my previous problem.


#7

Hi, in order for us to assist, you’ll have to debug the problem further and give us some specific details. Are you are getting the onImageResults callback, and is it providing the expected information?