00001 #include "DetectorChain.H"
00002 #include <Logger.H>
00003 #include <string>
00004 #include <opencv/cv.h>
00005 #include <opencv/highgui.h>
00006
00007 using namespace std;
00008 using namespace RobotObjects;
00009 using namespace RobotVision;
00010
00011 DetectorChain::DetectorChain(std::string name) : VisionOperator(name),m_laser(STRAT_ASSIGNED,"FaceLaser") {
00012 registerConsumer(&m_laser);
00013 }
00014
00015 void DetectorChain::initOperator(){
00016
00017 m_state=STATE_RUN;
00018 m_format=FORMAT_CHAR_1_GRAY;
00019 m_stereo=false;
00020
00021 if(g_globalConfiguration.haveModuleOPtion(m_name,"stereo")){
00022 string tmpstereo=g_globalConfiguration.getModuleOption(m_name,"stereo");
00023 std::transform(tmpformat.begin(),tmpformat.end(), tmpformat.begin(), (int (*) (int)) tolower);
00024 if(tmpformat=="yes"||tmpformat=="true"){
00025 m_stereo=true;
00026 }
00027 }
00028
00029 parseConfig();
00030
00031 for(vector<ObjectDetector>::iterator iter=m_detectorChain.begin();
00032 iter!=m_detectorChain.end();
00033 iter++){
00034 vector<RobotObjects *> consumers=iter->getConsumers();
00035 m_consumers+=consumers;
00036 }
00037
00038 for(vector<RobotObjects *>::iterator iter=m_consumers.begin();
00039 iter!=m_consumers.end();
00040 iter++){
00041 registerConsumer(*iter);
00042 }
00043 }
00044
00045 void runOperator(RobotObjects::RoleImage image, RobotObjects::RoleImage stereo){
00046
00047
00048 }
00049
00050 void runOperator(RobotObjects::RoleImage theimage){
00051
00052 std::vector<ProbabilityRegions> currentRegions;
00053
00054
00055 for(vector<ObjectDetector>::iterator iter=m_detectorChain.begin();
00056 iter!=m_detectorChain.end();
00057 iter++){
00058 iter->filterRegions(¤tRegions,theimage);
00059 }
00060
00061
00062
00063 }
00064
00065 void quitOperator(){
00066
00067 }
00068
00069 void parseConfig(){
00070
00071 }
00072
00073
00074 extern "C" {
00075
00076 VisionOperator *DetectorChain_factory(std::string name) {
00077 return new DetectorChain(name);
00078 }
00079
00080 class DetectorChainProxy {
00081 public:
00082 DetectorChainProxy(){
00083 operatorFactory["DetectorChain"] = DetectorChain_factory;
00084 }
00085 };
00086
00087 DetectorChainProxy p_imagewriter;
00088 }