bool RecgWeightedHoughForest(int *binNum, int *itemIdx, cv::Mat color, cv::Mat Sub, double *workPos, double *score, std::vector<int>& WHFClusterIdx ){ //関数をvoid型からbool型に変更+ cv::Mar Subと WHF_cluster_idx を引数に追加 2015.04.26村田 int bin,itemNum; int *ref_num; int refNum; cv::Mat testImage; //1チャンネルのグレーススケール画像を作成 cv::cvtColor(color,testImage,CV_BGR2GRAY,1); bin=*binNum; itemNum=*itemIdx; //処理後書き換わってしまうので深いコピー cv::Mat Sub2 = Sub.clone(); cv::Mat opening = Sub.clone(); Detector detector; //入力画像のスケールをWHFcommon.hで定義したSCALEの値に変換(チャレンジ当日のスケールにあわせて調整) resize(testImage, testImage, Size() , SCALE, SCALE, INTER_CUBIC); resize(opening, opening, Size() , SCALE, SCALE, INTER_CUBIC); cv::erode(opening, opening, cv::Mat(), cv::Point(-1,-1), 2);//膨張収縮によるノイズ・穴の削減 村田 cv::dilate(opening, opening, cv::Mat(), cv::Point(-1,-1), 4); //cv::erode(opening, opening, cv::Mat(), cv::Point(-1,-1), 1); //検出用関数 detector.computeError(bin,itemNum,testImage,opening,workPos,score,ref_num);//リファレンス番号を返すように変更 村田 //リファレンスの確認 ポインタ型です。村田 std::cout<<"ref"<<*ref_num<<std::endl;; //LOG書き出しの判定 #ifdef LOGMODE std::ofstream ofs( "./WHF_LOG.txt" ,std::ios::app); ofs<<"binNum="<<bin<<"\titemIdx="<<itemNum<<"\tworkPos="<<workPos[0]<<","<<workPos[1]<<"\tscore="<<*score<<"\tref_num="<<*ref_num<<std::endl; ofs.close(); #endif cv::Mat WHFCluster( HEIGHT, WIDTH, CV_8UC1, cv::Scalar(0) ); //セグメンテーション refNum = *ref_num; //入力部分書き換え(金子) WHFCluster = item_segmentation(Sub, (int)workPos[0], (int)workPos[1], itemNum, refNum); int cnt; cnt =0; for( int i=0 ; i<WIDTH*HEIGHT ; i++ ){ if( Sub2.data[i] != 0 ){ if( WHFCluster.data[i] != 0 ){ WHFClusterIdx.push_back( cnt ); } cnt++; } } cv::imwrite("function_test.bmp", WHFCluster); return true; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MyWindow window; window.showMaximized(); QThread thread; Detector *detector = new Detector(); detector->moveToThread(&thread); detector->connect(&thread,SIGNAL(started()),SLOT(work())); QThread thread2; MyBluetooth *bt = new MyBluetooth(); bt->moveToThread(&thread2); bt->connect(&thread2,SIGNAL(started()),SLOT(scanList())); bt->connect(&window,SIGNAL(updateScan()),SLOT(scanList())); bt->connect(detector,SIGNAL(detected()),SLOT(checkAlert())); //typedef std::list<Phone> listPhone; qRegisterMetaType<std::list<Phone*> >("List<Phone>"); window.connect(bt,SIGNAL(finishedScan(std::list<Phone*>)),SLOT(setList(std::list<Phone*>))); window.connect(bt,SIGNAL(finishedCheck(std::list<Phone*>)),SLOT(checkAlert(std::list<Phone*>))); thread.start(); thread2.start(); return a.exec(); }
/** * @brief Tests whether the hero is cutting with his sword the specified detector * for which a collision was detected. * @param detector the detector to check * @return true if the sword is cutting this detector */ bool Hero::SwordSwingingState::is_cutting_with_sword(Detector &detector) { if (hero.get_movement() != NULL) { return false; } // check the distance to the detector int distance = detector.is_obstacle_for(hero) ? 14 : 4; Rectangle tested_point = hero.get_facing_point(); switch (get_sprites().get_animation_direction()) { case 0: // right tested_point.add_x(distance); break; case 1: // up tested_point.add_y(-distance); break; case 2: // left tested_point.add_x(-distance); break; case 3: // down tested_point.add_y(distance); break; } return detector.overlaps(tested_point.get_x(), tested_point.get_y()); }
/** * \brief Checks the collisions between all entities and a detector. * * This function is called when a detector wants to check entities, * typically when the detector has just moved. * If the map is suspended, this function does nothing. * * \param detector A detector. */ void Map::check_collision_from_detector(Detector& detector) { if (suspended) { return; } if (detector.is_being_removed()) { return; } // First check the hero. detector.check_collision(get_entities().get_hero()); // Check each entity with this detector. Rectangle box = detector.get_extended_bounding_box(8); std::vector<EntityPtr> entities_nearby; entities->get_entities_in_rectangle(box, entities_nearby); for (const EntityPtr& entity_nearby: entities_nearby) { if (entity_nearby->is_enabled() && !entity_nearby->is_suspended() && !entity_nearby->is_being_removed() && entity_nearby.get() != &detector ) { detector.check_collision(*entity_nearby); } } }
int main( int argc, char** argv ) { if (argc != 5) { cout<<"Need 4 arguments:\nembed or extract\nPath to cover image\nPath to destination stego image\nPayload bits to be embedded"<<endl; exit(1); } Detector detector; detector.surf_detect(argv[2]); //initialize variables for embeder and extractor Embeder embeder; Extractor extractor; string wavelet_name = "bior4.4"; vector<double> dwt_output, flag; vector<int> length; int rows, cols; Mat mat_G, mat_B; bool full; int J = 1; string message = argv[4]; if (strncmp(argv[1],"embed", 2) == 0) { //data embeding embeder.data_embed(argv[2], J, wavelet_name, dwt_output, flag, length, rows, cols, full, message, argv[3]); } if (strncmp(argv[1],"extract", 2) == 0) { //data extracting extractor.data_extract(argv[3], J, wavelet_name, dwt_output, flag, length, rows, cols, message); } return 0; }
/** * \brief Tests whether the hero is cutting with his sword the specified detector * for which a collision was detected. * \param detector the detector to check * \return true if the sword is cutting this detector */ bool Hero::SwordSwingingState::is_cutting_with_sword( Detector& detector) { Hero& hero = get_hero(); if (hero.get_movement() != nullptr) { return false; } // check the distance to the detector int distance = detector.is_obstacle_for(hero) ? 14 : 4; Point tested_point = hero.get_facing_point(); switch (get_sprites().get_animation_direction()) { case 0: // right tested_point.x += distance; break; case 1: // up tested_point.y -= distance; break; case 2: // left tested_point.x -= distance; break; case 3: // down tested_point.y += distance; break; } return detector.overlaps(tested_point); }
/** * createOneDetectorInstrument, creates the most simple possible definition of an instrument in which we can extract a valid L1 and L2 distance for unit calculations. * * Beam direction is along X, * Up direction is Y * * @param sourcePos : V3D position * @param samplePos : V3D sample position * @param detectorPos : V3D detector position * @return Instrument generated. */ Geometry::Instrument_sptr createMinimalInstrument(const Mantid::Kernel::V3D& sourcePos, const Mantid::Kernel::V3D& samplePos, const Mantid::Kernel::V3D& detectorPos ) { Instrument_sptr instrument = boost::make_shared<Instrument>(); instrument->setReferenceFrame( boost::make_shared<ReferenceFrame>(Mantid::Geometry::Y /*up*/, Mantid::Geometry::X /*along*/, Left, "0,0,0")); // A source ObjComponent *source = new ObjComponent("source"); source->setPos(sourcePos); source->setShape(createSphere(0.01 /*1cm*/, V3D(0,0,0), "1")); instrument->add(source); instrument->markAsSource(source); // A sample ObjComponent *sample = new ObjComponent("some-surface-holder"); sample->setPos(samplePos); sample->setShape(createSphere(0.01 /*1cm*/, V3D(0,0,0), "1")); instrument->add(sample); instrument->markAsSamplePos(sample); // A detector Detector *det = new Detector("point-detector", 1 /*detector id*/, NULL); det->setPos(detectorPos); det->setShape(createSphere(0.01 /*1cm*/, V3D(0,0,0), "1")); instrument->add(det); instrument->markAsDetector(det); return instrument; }
TEST(SoftCascadeDetector, readCascade) { std::string xml = cvtest::TS::ptr()->get_data_path() + "cascadeandhog/cascades/inria_caltech-17.01.2013.xml"; Detector cascade; cv::FileStorage fs(xml, cv::FileStorage::READ); ASSERT_TRUE(fs.isOpened()); ASSERT_TRUE(cascade.load(fs.getFirstTopLevelNode())); }
void processImage(Detector& detector, Mat &image) { if (!image.empty()) { cout << "Detecting objects on image ... "; Scene scene = detector.describe(image); vector<Detection> detections = detector.detect(scene); cout << "[DONE]" << endl; BOOST_FOREACH(Detection d, detections) { drawDetection(image, d); }
static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { xml_det_t x_det = e; xml_dim_t dim = x_det.dimensions(); Material air = description.air(); string det_name = x_det.nameStr(); DetElement sdet (det_name,x_det.id()); double z = dim.outer_z(); double rmin = dim.inner_r(); double r = rmin; int n = 0; Tube envelope(rmin,2*rmin,2*z); Volume envelopeVol(det_name+"_envelope",envelope,air); for(xml_coll_t c(x_det,_U(layer)); c; ++c) { xml_comp_t x_layer = c; for(int i=0, im=0, repeat=x_layer.repeat(); i<repeat; ++i, im=0) { string layer_name = det_name + _toString(n,"_layer%d"); double rlayer = r; Tube layer_tub(rmin,rlayer,2*z); Volume layer_vol(layer_name,layer_tub,air); for(xml_coll_t l(x_layer,_U(slice)); l; ++l, ++im) { xml_comp_t x_slice = l; double router = r + x_slice.thickness(); Material slice_mat = description.material(x_slice.materialStr()); string slice_name = layer_name + _toString(im,"slice%d"); Tube slice_tube(r,router,z*2); Volume slice_vol (slice_name,slice_tube,slice_mat); if ( x_slice.isSensitive() ) { sens.setType("calorimeter"); slice_vol.setSensitiveDetector(sens); } r = router; slice_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); // Instantiate physical volume layer_vol.placeVolume(slice_vol); } layer_vol.setVisAttributes(description,x_layer.visStr()); layer_tub.setDimensions(rlayer,r,z*2,0,2*M_PI); PlacedVolume layer_physvol = envelopeVol.placeVolume(layer_vol); layer_physvol.addPhysVolID("layer",n); ++n; } } envelope.setDimensions(rmin,r,2*z); // Set region of slice envelopeVol.setAttributes(description,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); PlacedVolume physvol = description.pickMotherVolume(sdet).placeVolume(envelopeVol); physvol.addPhysVolID("system",sdet.id()).addPhysVolID(_U(barrel),0); sdet.setPlacement(physvol); return sdet; }
CPose2D getPataMesa(){ FILE* file=fopen("patamesa.dat","r"); CPose2D pataMesa; int nDatos(0); if(file){ float x,y; // Archivo existe fscanf(file,"x:%f,y:%f",&x,&y); pataMesa.x(x); pataMesa.y(y); fclose(file); } else{ //Archivo no existe file=fopen("patamesa.dat","w"); for(int i=1;i<21;i++){ Detector detector; char nombre[100]; sprintf(nombre,"/home/jplata/Eclipse/MedidasPiernas/23Mayo/laser%i.dat",i); cout << "Fichero: " << nombre << endl; detector.abrirFichero(nombre,false); // Clusteres detectados vector<Cluster> piernas=detector.clusterizar(0.1,3); detector.printClusters(piernas); // El ultimo cluster corresponde a la pata de la mesa en las primeras muestras nDatos++; pataMesa+=piernas.back().getCentro(); } pataMesa.x(pataMesa.x()/nDatos); pataMesa.y(pataMesa.y()/nDatos); fprintf(file,"x:%f,y:%f",pataMesa.x(),pataMesa.y()); fclose(file); } return pataMesa; }
extern "C" const char * run_detector (const char * buf, int len) { const char * r; Detector *det = new Detector; det->HandleData (buf, len); det->DataEnd (); r = det->getresult(); delete det; return r; }
int main() { char filename[100], imagename[100]; //define test_image, file_reader, feature_extrator, classifier and detector IplImage* img; std::ifstream ifile; EdgeletFeatures hf(WIDTH,HEIGHT); CascadeClassifier cc; Detector dt; //load defult features // ifile.open("./data/haar_features.txt"); //hf.ReadFromFile(ifile); //ifile.close(); //load default classifier sprintf(filename,"%s/cascadeclassifier.txt",dir_prefix); ifile.open(filename); cc.ReadFromFile(ifile); dt.SetClassifier(&cc); dt.SetExtractor(&hf); std::vector<CvRect> results; std::ifstream f1; int num,i; //general test /**/ sprintf(filename,"%s/detect_samples.txt",dir_prefix); f1.open(filename); f1>>num; f1.ignore(256,'\n'); for(i=0;i<num;i++) { //read image f1>>imagename; img = cvLoadImage(imagename); std::vector<CvRect> results; std::clog<<"Checking the "<<i<<"st image: "<<imagename<<std::endl; dt.Check(img,results); dt.DrawResults(img,results); sprintf(filename,"%s/result_%d.bmp",dir_prefix,i); cvSaveImage(filename,img); cvReleaseImage(&img); } f1.close(); return 1; }
B_USE_NAMESPACE int main() { TestEnv env; Detector detector; if (!detector.isValid()) { qCritical() << "Detector is not valid!"; return FAIL; } auto plates = detector.detectPlates(nullptr); return (plates.empty() ? PASS : FAIL); }
TEST(SoftCascadeDetector, detectEmptyRoi) { std::string xml = cvtest::TS::ptr()->get_data_path() + "cascadeandhog/cascades/inria_caltech-17.01.2013.xml"; Detector cascade; cv::FileStorage fs(xml, cv::FileStorage::READ); ASSERT_TRUE(cascade.load(fs.getFirstTopLevelNode())); cv::Mat colored = cv::imread(cvtest::TS::ptr()->get_data_path() + "cascadeandhog/images/image_00000000_0.png"); ASSERT_FALSE(colored.empty()); std::vector<Detection> objects; cascade.detect(colored, cv::Mat::zeros(colored.size(), CV_8UC1), objects); ASSERT_EQ(0, (int)objects.size()); }
TEST(SoftCascadeDetector, detectSeparate) { std::string xml = cvtest::TS::ptr()->get_data_path() + "cascadeandhog/cascades/inria_caltech-17.01.2013.xml"; Detector cascade; cv::FileStorage fs(xml, cv::FileStorage::READ); ASSERT_TRUE(cascade.load(fs.getFirstTopLevelNode())); cv::Mat colored = cv::imread(cvtest::TS::ptr()->get_data_path() + "cascadeandhog/images/image_00000000_0.png"); ASSERT_FALSE(colored.empty()); cv::Mat rects, confs; cascade.detect(colored, cv::noArray(), rects, confs); ASSERT_EQ(719, confs.cols); }
int main ( int argc,char **argv ) { Detector detector; Mat rawimage; double total_time = 0; if (argc < 3) { cout << "Usage: " << argv[0] << " <calib> <imgs...>" << endl; exit(1); } for (int i = 2; i < argc; i++) { cout << "Reading image " << argv[i] << "..." << endl; rawimage = imread(argv[i], 0); auto start = getTickCount(); cout << "Looking for spots..." << endl; auto spots = detector.find_spots(rawimage, argv[1]); if (spots.empty()) cout << "No spot!" << endl; else { cout << "Found " << spots.size() << " spots" << endl; for (auto spot : spots) { cout << "Center at (" << spot.x << ", " << spot.y << ")" << endl; } } auto spot = *spots.begin(); // just take the first one auto color = Color::fromHSV(360 * spot.x, 1, spot.y); stringstream cmd; cmd << "/?content={\"mode\":\"PLAIN\",\"src\":{\"id\":1,\"type\":\"color\",\"value\":" << color << ",\"x\":0,\"y\":0}}"; perform_request("localhost", "8080", cmd.str()); total_time += (getTickCount() - start) * 1000./getTickFrequency(); } cout << "In average, " << total_time / (argc - 2) << "ms per image." << endl; return 0; }
/** * Factory: DD4hep_XML-In-Memory * * Though there is a file name given, it is read FIRST and then parsed. * Similar to a in memory XML string. * * \author M.Frank * \version 1.0 * \date 20/01/2018 */ static int multiply_constants (Detector& detector, int argc, char** argv) { bool help = false; for(int i=0; i<argc && argv[i]; ++i) { if ( 0 == ::strncmp("-help",argv[i],4) ) help = true; else help = true; } if ( help ) { /// Help printout describing the basic command line interface cout << "Usage: -plugin <name> -arg [-arg] \n" " name: factory name DD4hep_TestConstantsMultiplier \n" "\tArguments given: " << arguments(argc,argv) << endl << flush; ::exit(EINVAL); } int num_test = 0; const auto& constants = detector.constants(); for(const auto e : constants) { Constant c = e.second; if ( c.dataType() == "number" ) { try { double res = _multiply(c.name(),1.0); printout(INFO,"TestConstantsMultiplier","+++ Constant: %-16s = %-16s [%s] -> %-16s = %9.3g", c.name(), c->GetTitle(), c.dataType().c_str(), c.name(), res); ++num_test; } catch(...) { } } } printout(ALWAYS,"TestConstantsMultiplier", "+++ Tested %d numeric constants for expression evaluation.",num_test); return 1; }
/// Create a volume using the plugin mechanism from the attributes of the XML element Volume dd4hep::xml::createStdVolume(Detector& description, xml::Element element) { xml_dim_t e(element); if ( e.hasAttr(_U(material)) ) { xml_dim_t x_s = e.child(_U(shape)); string typ = x_s.typeStr(); Material mat = description.material(e.attr<string>(_U(material))); Solid sol = createShape(description, typ, x_s); Volume vol("volume", sol, mat); if ( e.hasAttr(_U(name)) ) vol->SetName(e.attr<string>(_U(name)).c_str()); vol.setAttributes(description,e.regionStr(),e.limitsStr(),e.visStr()); return vol; } xml_h h = e; xml_attr_t a = h.attr_nothrow(_U(type)); if ( a ) { string typ = h.attr<string>(a); if ( typ.substr(1) == "ssembly" ) { Assembly vol("assembly"); if ( e.hasAttr(_U(name)) ) vol->SetName(e.attr<string>(_U(name)).c_str()); vol.setAttributes(description,e.regionStr(),e.limitsStr(),e.visStr()); return vol; } } except("xml::createVolume","Failed to create volume. No material specified!"); return Volume(); }
/** * \brief Tests whether the hero is cutting with his sword the specified detector * for which a collision was detected. * \param detector the detector to check * \return true if the sword is cutting this detector */ bool Hero::RunningState::is_cutting_with_sword(Detector& detector) { // check the distance to the detector const int distance = 8; Point tested_point = get_entity().get_facing_point(); switch (get_sprites().get_animation_direction()) { case 0: // right tested_point.x += distance; break; case 1: // up tested_point.y -= distance; break; case 2: // left tested_point.x -= distance; break; case 3: // down tested_point.y += distance; break; } return detector.overlaps(tested_point); }
/** * \brief Tests whether the hero is cutting with his sword the specified detector * for which a collision was detected. * \param detector the detector to check * \return true if the sword is cutting this detector */ bool Hero::SwordTappingState::is_cutting_with_sword(Detector& detector) const { const Hero& hero = get_hero(); return detector.is_obstacle_for(hero) // only obstacle entities can be cut && hero.get_facing_entity() == &detector // only one entity at a time && get_sprites().get_current_frame() >= 3; // wait until the animation shows an appropriate frame }
/** * \brief Tests whether the hero is cutting with his sword the specified detector * for which a collision was detected. * \param detector the detector to check * \return true if the sword is cutting this detector */ bool Hero::RunningState::is_cutting_with_sword(Detector& detector) const { // check the distance to the detector const int distance = 8; Rectangle tested_point = get_hero().get_facing_point(); switch (get_sprites().get_animation_direction()) { case 0: // right tested_point.add_x(distance); break; case 1: // up tested_point.add_y(-distance); break; case 2: // left tested_point.add_x(-distance); break; case 3: // down tested_point.add_y(distance); break; } return detector.overlaps(tested_point.get_x(), tested_point.get_y()); }
/** * Factory: dd4hep_DetElementConditionsDump * * \author M.Frank * \version 1.0 * \date 01/04/2016 */ static int ddcond_detelement_processor(Detector& description, int argc, char** argv) { /// Internal class to perform recursive printout /* * \author M.Frank * \version 1.0 * \date 01/12/2016 */ struct Actor : public DetElementProcessor<ConditionsProcessor> { /// Standard constructor Actor(ConditionsProcessor* p) : DetElementProcessor<ConditionsProcessor>(p){} /// Default destructor virtual ~Actor() { } /// Dump method. virtual int operator()(DetElement de, int) { return de.hasConditions() ? processor->processElement(de) : 1; } }; ConditionsProcessor* processor = 0; if ( argc > 0 ) { processor = createProcessor<ConditionsProcessor>(description, argc, argv); } else { const void* args[] = { "-processor", "DD4hep_ConditionsPrinter", 0}; processor = createProcessor<ConditionsProcessor>(description, 2, (char**)args); } dd4hep_ptr<ConditionsSlice> slice(ddcond_prepare(description,"run",1500,argc,argv)); UserPool* pool = slice->pool.get(); Actor actor(processor); pool->print("User pool"); processor->setPool(pool); int ret = Actor(processor).process(description.world(),0,true); slice->manager.clean(pool->validity().iovType, 20); return ret; }
TEST(SoftCascadeDetector, detectRoi) { std::string xml = cvtest::TS::ptr()->get_data_path() + "cascadeandhog/cascades/inria_caltech-17.01.2013.xml"; Detector cascade; cv::FileStorage fs(xml, cv::FileStorage::READ); ASSERT_TRUE(cascade.load(fs.getFirstTopLevelNode())); cv::Mat colored = cv::imread(cvtest::TS::ptr()->get_data_path() + "cascadeandhog/images/image_00000000_0.png"); ASSERT_FALSE(colored.empty()); std::vector<Detection> objects; std::vector<cv::Rect> rois; rois.push_back(cv::Rect(0, 0, 640, 480)); cascade.detect(colored, rois, objects); ASSERT_EQ(719, (int)objects.size()); }
/// Initializing constructor. The tree will automatically be built if possible Geant4VolumeManager::Geant4VolumeManager(const Detector& description, Geant4GeometryInfo* info) : Handle<Geant4GeometryInfo>(info), m_isValid(false) { if (info && info->valid && info->g4Paths.empty()) { Populator p(description, *info); p.populate(description.world()); return; } throw runtime_error(format("Geant4VolumeManager", "Attempt populate from invalid Geant4 geometry info [Invalid-Info]")); }
bool configure(ResourceFinder &rf) { if(rf.check("period")) period = rf.find("period").asDouble(); else period = 0.3; return detector->open(rf); }
/// Install the consitions and the alignment manager ConditionsManager dd4hep::ConditionExamples::installManager(Detector& description) { // Now we instantiate the conditions manager description.apply("DD4hep_ConditionsManagerInstaller",0,(char**)0); ConditionsManager manager = ConditionsManager::from(description); manager["PoolType"] = "DD4hep_ConditionsLinearPool"; manager["UserPoolType"] = "DD4hep_ConditionsMapUserPool"; manager["UpdatePoolType"] = "DD4hep_ConditionsLinearUpdatePool"; manager.initialize(); return manager; }
/** * \brief Checks the collisions between all entities and a detector. * * This function is called when a detector wants to check entities, * typically when the detector has just moved. * If the map is suspended, this function does nothing. * * \param detector A detector. */ void Map::check_collision_from_detector(Detector& detector) { if (suspended) { return; } // First check the hero. detector.check_collision(get_entities().get_hero()); // Check each entity with this detector. const std::list<MapEntityPtr>& all_entities = entities->get_entities(); for (const MapEntityPtr& entity: all_entities) { if (entity->is_enabled() && !entity->is_being_removed()) { detector.check_collision(*entity); } } }
/** * \brief Checks the collisions between an entity and the detectors of the map. * * This function is called by an entity sensitive to the entity detectors * when this entity has just moved on the map, or when a detector * wants to check this entity. * We check whether or not the entity overlaps an entity detector. * If the map is suspended, this function does nothing. * * \param entity the entity that has just moved (this entity should have * a movement sensible to the collisions) */ void Map::check_collision_with_detectors(MapEntity& entity) { if (suspended) { return; } const std::list<Detector*>& detectors = entities->get_detectors(); // Check each detector. std::list<Detector*>::const_iterator it; const std::list<Detector*>::const_iterator end = detectors.end(); for (it = detectors.begin(); it != end; ++it) { Detector* detector = *it; if (detector->is_enabled() && !detector->is_being_removed()) { detector->check_collision(entity); } } }
bool lookForFaces() { yarp::sig::Vector pxl(2,0.0); yarp::sig::Vector pxr(2,0.0); while (true) { imageInR = imagePortInR -> read(false); imageInL = imagePortInL -> read(false); if (imageInL) { ImageOf<PixelBgr> imageOutL; detectorL->loop(imageInL,imageOutL); imagePortOutL.write(imageOutL); } if (imageInR) { ImageOf<PixelBgr> imageOutR; detectorR->loop(imageInR,imageOutR); imagePortOutR.write(imageOutR); } printMessage(2,"counterL: %i counterR: %i\n",detectorL->counter,detectorR->counter); if (detectorL->counter > certainty && detectorR->counter > certainty) { pxl=detectorL->getCenterOfFace(); pxr=detectorR->getCenterOfFace(); printMessage(1,"I have found a face! pxl: %s pxr: %s\n",pxl.toString().c_str(),pxr.toString().c_str()); if (pxl(0)!=0.0 && pxr(0)!=0.0) { igaze->lookAtStereoPixels(pxl,pxr); } return true; } Time::delay(0.1); } return false; }