cm_opencvblobhandlers.h

00001 /* -- 2007-05-07 -- 
00002  *  ardev - an augmented reality library for robot developers
00003  *  Copyright 2005-2007 - Toby Collett (ardev _at_ plan9.net.nz)
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00018  *
00019  */
00020 #ifndef ARIDE_OPENCVBLOBHANDLERS_H
00021 #define ARIDE_OPENCVBLOBHANDLERS_H
00022 
00023 #include "cm_objecthandler.h"
00024 #include "cm_parameter.h"
00025 #include <ardev/opencv_blobtrack.h>
00026 
00027 void RegisterOpenCVBlobObjectHandlers();
00028 
00029 
00030 class OpenCVBlobTrackPreProcessHandler : public FrameProcessObjectHandler
00031 {
00032         public:
00033                 OpenCVBlobTrackPreProcessHandler();
00034                 ~OpenCVBlobTrackPreProcessHandler();
00035         
00036                 OpenCVBlobTrackPreProcess & GetObject();
00037                 void RemoveObject();
00038         
00039                 static ObjectHandler * CreateHandler() {return static_cast<ObjectHandler * > (new OpenCVBlobTrackPreProcessHandler);};
00040         protected:
00041                 OpenCVBlobTrackPreProcess * Obj;
00042         
00043                 CameraObjectParameter Cam;
00044                 DoubleParameter MinSize,MaxSize;
00045                 BooleanParameter Debug;
00046 };
00047 
00048 // --- OpenCVBlobTrackPreProcess Parameter ---
00049 class OpenCVBlobTrackPreProcessParameter : public StringParameter
00050 {
00051 public: 
00052                 OpenCVBlobTrackPreProcessParameter(QString _Name, QString _Description, QString _DefaultValue="") : StringParameter(_Name,_Description,_DefaultValue) {Type="ARToolKitPreProcess";};
00053                 virtual ~OpenCVBlobTrackPreProcessParameter() {};
00054 
00055                 OpenCVBlobTrackPreProcessHandler * GetClass() 
00056                 {
00057                         if (Value == "")
00058                                 throw aride_exception(ARDEV_CLASS_NOT_FOUND, __FILE__, __LINE__);
00059                         aride_object * temp = CurrentProject->GetObjectByGUID(Value);
00060                         if (temp == NULL)
00061                                 throw aride_exception(ARDEV_CLASS_NOT_FOUND, __FILE__, __LINE__);
00062                         if (temp->Section == ARIDE_PREPROCESS && temp->Type == "OpenCVBlobTrackPreProcess")
00063                                 return reinterpret_cast<OpenCVBlobTrackPreProcessHandler *> (temp->Handler);
00064                         throw aride_exception(ARDEV_CLASS_NOT_FOUND, __FILE__, __LINE__);
00065                 };                              
00066 };
00067 
00068 class OpenCVBlobTrackPositionHandler : public PositionObjectHandler
00069 {
00070         public:
00071                 OpenCVBlobTrackPositionHandler();
00072                 ~OpenCVBlobTrackPositionHandler();
00073         
00074                 PositionObject & GetObject();
00075                 void RemoveObject();
00076         
00077                 static ObjectHandler * CreateHandler() {return static_cast<ObjectHandler * > (new OpenCVBlobTrackPositionHandler);};
00078         protected:
00079                 OpenCVBlobTrackPosition * Obj;
00080 
00081                 IntParameter Hue1_Min;
00082                 IntParameter Hue1_Max;
00083                 IntParameter Hue2_Min;
00084                 IntParameter Hue2_Max;
00085                 DoubleParameter Height;
00086         
00087                 OpenCVBlobTrackPreProcessParameter Pre;
00088 };
00089 
00090 #endif

SourceForge.net Logo Generated on Sat May 12 15:25:43 2007 for ardev by doxygen 1.5.1