1
Affectiva SDK for C#の使用を開始したばかりで、数回実行した後、クラッシュの問題が発生しました。 私はx86アーキテクチャと.Net 4.5.1上でカメラ処理を使用しています。私はVS 2013をインストールしました。私のOSはWindows 10です。出力に「opencv_ffmpeg248」と「affdex-native」を追加しました。 コードは正常にビルドされて実行されますが、実行時にこのエラーがスローされ、アプリケーションが終了します。Affectiva C#SDKがクラッシュする
これは私が使用していたコードです:
public class Class1 : Affdex.ImageListener
{
private Affdex.CameraDetector _detector;
public event EventHandler<string[]> AllValuesEvent;
public Class1()
{
_detector = new Affdex.CameraDetector();
_detector.setDetectAllEmotions(true);
_detector.setDetectAllAppearances(true);
String classifierPath = @"C:\Program Files (x86)\Affectiva\Affdex SDK\data";
_detector.setClassifierPath(classifierPath);
_detector.setImageListener(this);
_detector.start();
}
public void StopCamera()
{
_detector.stop();
}
public void onImageCapture(Frame frame)
{
}
public void onImageResults(Dictionary<int, Face> faces, Frame frame)
{
if (faces.Count > 0)
{
Face face = faces.First().Value;
Console.WriteLine("Age: {0} Gender: {1} Glasses: {2}",
face.Appearance.Age,
face.Appearance.Gender,
face.Appearance.Glasses);
string[] names = new string[8];
string[] values = new string[8];
names[0] = "Anger";
names[1] = "Contempt";
names[2] = "Disgust";
names[3] = "Engagement";
names[4] = "Fear";
names[5] = "Joy";
names[6] = "Sadness";
names[7] = "Surprise";
values[0] = face.Emotions.Anger.ToString("F2");
values[1] = face.Emotions.Contempt.ToString("F2");
values[2] = face.Emotions.Disgust.ToString("F2");
values[3] = face.Emotions.Engagement.ToString("F2");
values[4] = face.Emotions.Fear.ToString("F2");
values[5] = face.Emotions.Joy.ToString("F2");
values[6] = face.Emotions.Sadness.ToString("F2");
values[7] = face.Emotions.Surprise.ToString("F2");
RaiseAllValuesEvent(names, values);
}
}
private void RaiseAllValuesEvent(string[] names, string[] values)
{
if (AllValuesEvent != null)
{
AllValuesEvent(names, values);
}
}
}
誰もが何か提案を持っていますか?
ありがとうございました。
ねえ、1つの問題は、デバッグとリリースDLLを混在させている可能性があります。ビルドプロファイルに一致するDLLをインポートできることを確認できますか。 – ahamino
まあ、あなたの提案は私の問題を解決したようです。 私はまだリリースのDLLを使用してエラーが発生し、結果を返すかどうかを確認するために、今後数日間監視を続けます。 –
こんにちは、 @ahaminoあなたの提案は私の問題を解決しました。ありがとうございました。私は答えとしてあなたのコメントにフラグを立てる方法を知らない。 –