/// <summary> /// A constructor for RawDataHandler, requires a reference to a kinect camera and a list of the active gestureDetectors. /// The reference to the gestureDetectors is solely stored because body data decides if a person is still in view, /// if a person has left the view, RawDataHandler will update the gestureDetector trackingID's and pause them. /// </summary> /// <param name="aKinect">A reference to the acitve Kinect camera</param> /// <param name="aEvHandler">An eventhandler so instances can send error logs</param> /// <param name="aGestDectList">A list of all active gestureDetectors which can be paused</param> public RawDataHandler(KinectSensor aKinect, LibEventHandler aEvHandler, List <GestureDetector> aGestDectList) { //store a reference to the common eventhandler this.evHandler = aEvHandler; //store a reference to the kinectSensor that is currently in use this.kinect = aKinect; //store a reference to the total list of gesturedetectors that have been made this.gestureDetectorList = aGestDectList; // open the reader for the body frames this.bodyFrameReader = this.kinect.BodyFrameSource.OpenReader(); // set the BodyFramedArrived event notifier this.bodyFrameReader.FrameArrived += this.Reader_BodyFrameArrived; }
/// <summary> /// Constructor for the GestureHandler class /// </summary> /// <param name="aDbLocation">location of the gesture database + name of the database</param> /// <param name="aConfLocation">location of a config file</param> public GestureHandler(string aDbLocation, LibEventHandler aEvHandler, GestureLibraryConfiguration aLibraryConf) { this.DatabaseLocation = @aDbLocation; this.evHandler = aEvHandler; this.conf = aLibraryConf; }
/// <summary> /// Constructor for the GestureHandler class /// </summary> /// <param name="aDbLocation">location of the gesture database + name of the database</param> public GestureHandler(string aDbLocation, LibEventHandler aEvHandler) { this.DatabaseLocation = @aDbLocation; this.evHandler = aEvHandler; }
/// <summary> /// Initializes a new instance of the GestureDetector class along with the gesture frame source and reader /// </summary> /// <param name="kinectSensor">Active sensor to initialize the VisualGestureBuilderFrameSource object with</param> /// <param name="aEventHandler">The main event handler that accepts all event triggers</param> /// <param name="aGestureHandler">A gesture configurator object</param> public GestureDetector(KinectSensor kinectSensor, LibEventHandler aEventHandler, GestureHandler aGestureHandler) { //test if (kinectSensor == null) { throw new ArgumentNullException("kinectSensor"); } //store the location of the database this.dbLocation = aGestureHandler.DatabaseLocation; //store a reference to the gestureHandler this.gestureHandler = aGestureHandler; // store a reference to a common event handler this.eventHandler = aEventHandler; // create the vgb source. The associated body tracking ID will be set when a valid body frame arrives from the sensor. this.vgbFrameSource = new VisualGestureBuilderFrameSource(kinectSensor, 0); // open the reader for the vgb frames this.vgbFrameReader = this.vgbFrameSource.OpenReader(); Console.WriteLine("VGB capture initialized on a body."); if (this.vgbFrameReader != null) { this.vgbFrameReader.IsPaused = true; this.vgbFrameReader.FrameArrived += this.Reader_GestureFrameArrived; } try { // load the gesture database using (VisualGestureBuilderDatabase database = new VisualGestureBuilderDatabase(this.dbLocation)) { // load all gestures from the gesture database try { this.vgbFrameSource.AddGestures(database.AvailableGestures); } catch (Exception e) { Console.WriteLine("Couldn't locate AdaboostTech.dll and/or RFRProgressTech.dll"); Console.WriteLine(e.StackTrace); eventHandler.raiseMessageEvent(1, "Couldn't locate AdaboostTech.dll and/or RFRProgressTech.dll"); throw; } } }catch (Exception e) { Console.WriteLine("Couldn't locate database file"); Console.WriteLine(e.StackTrace); eventHandler.raiseMessageEvent(1, "Couldn't locate database file"); throw; } bufferSize = gestureHandler.getBufferSize(); discreteResultsBuffer = new IReadOnlyDictionary <string, float> [bufferSize]; continuousResultsBuffer = new IReadOnlyDictionary <string, float> [bufferSize]; }
/// <summary> /// A constructor for the ConfigSerializer class /// </summary> /// <param name="aEvhandler">eventhandler</param> public ConfigSerializer(LibEventHandler aEvhandler) { this.evHandler = aEvhandler; }