2016-04-24 225 views
1

我目前正在做一個項目,我必須使用Affectiva SDK來分析我錄製的一些視頻。我已經下載了他們給我的文件,並開始編寫SDK的代碼來工作,但是當我在代碼中調用回調函數時,Visual Studio似乎不接受放入的參數。所以我想回調函數的接口必須完成。我不清楚如何做到這一點,因爲我認爲這些都是在彙編代碼中完成的。到目前爲止我的代碼看起來是這樣的:Affdex視頻檢測器

using System; 
using System.Collections.Generic; 
using System.Configuration; 
using System.Data; 
using System.Linq; 
using System.Threading.Tasks; 
using System.Windows; 
using Affdex; 


namespace ConsoleApplication2 
{ 
class Program 
{ 
    public interface FaceListener { } 
    public interface ImageListener { } 
    public interface ProcessStatusListener { } 

    static void Main(string[] args) 
    { 
     VideoDetector detector = new VideoDetector(15); 

     String licensePath = "C:/Users/hamud/Desktop/[email protected]"; 
     detector.setLicensePath(licensePath); 

     String classifierPath = "C:/Programmer/Affectiva/Affdex SDK/data"; 
     detector.setClassifierPath(classifierPath); 

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

     detector.setDetectSmile(true); 
     detector.setDetectSurprise(false); 
     detector.setDetectBrowRaise(false); 
     detector.setDetectAnger(false); 
     detector.setDetectDisgust(false); 
     detector.setDetectAllExpressions(false); 

     detector.start(); 

     detector.stop(); 
    } 
} 

}

據我知道,我必須編寫代碼的接口,如果我沒有記錯......還是我?請幫忙。

回答

0

以下是關於開始分析視頻文件的tutorial

據我所知,如果我沒有弄錯,我必須爲接口編寫代碼......或者我呢?

不,你不知道。如果你要使用它們,你只需要在接口中實現這些方法。

這裏是鏈接到示例應用程序使用攝像機探測器,它可以涉及到,因爲在相機檢測和視頻檢測器實現FaceListenerProcessListenerImageListener接口。

編輯:你必須實現聽衆。例如,在代碼示例中,您正在使用FaceListener,因此您需要編寫回調的實現,即onFaceFound()onFaceLost()

您也可能希望創建processStatusListener的對象,並等待進程結束的視頻文件是這樣的:

AffdexProcessStatusListener processStatusListener = new AffdexProcessStatusListener(); 
processStatusListener.wait(); 

這裏是我們的C# app AffdexMe一個鏈接,使用CameraDetector。您可以在我們的getting started guide中找到CameraDetector,PhotoDetector,VideoDetector和FrameDetector的例子。

+0

我已經試過了這個教程,但是我似乎無法得到它的工作。順便說一句,你指的是相機探測器的鏈接? –

+0

@MartinMansour:我已經編輯了上面的回覆請看看。 –

+0

@MartinMansour是否解決了您的問題? –