TarzaNN
TarzaNN neural network simulator
C:/Users/albertlr/projects/TarzaNN/TarzaNN/InputControllerAbstract.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  **
00003  ** Copyright C 2002-2012 Laboratory for Active and Attentive Vision (LAAV), Department of Computer Science and Engineering, York University, Toronto, ON, Canada.
00004  ** All rights reserved.
00005  **
00006  ** This file is part of the TarzaNN Neural Network Simulator.
00007  **
00008  ** This file may be distributed and/or modified under the terms of the
00009  ** GNU General Public License version 2 as published by the Free Software
00010  ** Foundation and appearing in the file LICENSE.GPL included in the
00011  ** packaging of this file.
00012  **
00013  ** See http://www.tarzann.org/gpl/ for GPL licensing information.
00014  **
00015  ** Contact info@tarzann.org if any conditions of this licensing are
00016  ** not clear to you.
00017  **
00018  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020  **
00021  ****************************************************************************/
00022 
00023 #ifndef INPUTCONTROLLERABSTRACT_H_INCLUDED
00024 #define INPUTCONTROLLERABSTRACT_H_INCLUDED
00025 
00026 #include "nowarn.h"
00027 #include "common.h"
00028 #include "Matrix.h"
00029 #include "InputFeaturePlaneAbstract.h"
00030 #include "NotifyStrategyASync.h"
00031 #include "NotifyStrategySync.h"
00032 #include "UI_ImageViewer.h"
00033 
00034 #include <QMutex>
00035 #include <QMessageBox>
00036 #include <QPainter>
00037 #include <QColor>
00038 #include <QBitmap>
00039 #include <QPen>
00040 #include <QEvent>
00041 #include <QPixmap>
00042 #include <time.h>
00043 #include <stdlib.h>
00044 
00045 #define IOR
00046 //#define RANDOM_SACCADE
00047 class InputControllerAbstract : public InputFeaturePlaneAbstract {
00048 public:
00049     InputControllerAbstract( Network* net, int l, QString* n, int w, int h, NotifyStrategyAbstract* notify);
00050     ~InputControllerAbstract();
00051     bool gotNewHeadImage();
00052     void moveEyeHist(int dx, int dy);
00053     virtual void processTargetPlane();
00054 
00055     void setActiveVisionData(FeaturePlaneAbstract* theTargetPlane,int histRatio, int abs_middle_x, int abs_middle_y, FeaturePlaneAbstract* theSolutionPlane,  double theSolutionPlaneThreshold, UI_ImageViewer* theImageViewer, QString solFilename);
00056 
00057     // the following data is pertaining to active visual search
00058     FeaturePlaneAbstract* targetPlane, *solutionPlane; // the plane that indicates where the head will move to
00059     bool solution_found;
00060     QString solFilename;
00061     UI_ImageViewer *imageViewer;
00062 
00063     Matrix *eyeMovePlane;
00064     int eyeMovePlane_x, eyeMovePlane_y;
00065 
00066     int eyeMovementsCounter;
00067     QPixmap* saccadeHistoryImage;
00068         
00069         QPixmap* saccadeBackgroundImage;
00070         QMutex saccadeBackgroundImageMutex;
00071         
00072     int abs_saccade_x, abs_saccade_y;
00073     int abs_saccade_prev_x, abs_saccade_prev_y;
00074         
00075     double targetPlaneThreshold; 
00076     double solutionPlaneThreshold; 
00077     int localIterator;
00078 
00079     InputControllerAbstract();
00080 protected:
00081     bool newHeadImage;
00082 
00083 private:
00084     PlaneInputs inputList;
00085 
00086     void step();
00087     bool foundSolution();
00088     virtual void run();
00089     void finalize();
00090     void sumActivations();
00091     void ThreadEntry();
00092     
00093     void updateSaccadeViewer(int dx, int dy);
00094 };
00095 #endif //INPUTCONTROLLERABSTRACT_H_INCLUDED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines