Beispiel #1
0
static vector<FindResult> 
find_image(FindInput& input){
   
   vector<FindResult> results;
   Mat source = input.getSourceMat();
   Mat image = input.getTargetMat();
   if(!source.rows || !source.cols || !image.rows || !image.cols)
      return results;
      
   TemplateFinder f(source);
   
   if (input.isFindingAll()){
      f.find_all(image, input.getSimilarity());
      while (f.hasNext()){
         results.push_back(f.next());
      }
   }
   else{
      f.find(image, input.getSimilarity());
      if (f.hasNext())
         results.push_back(f.next());
      
   }
   return results;
}
Beispiel #2
0
static vector<FindResult> 
find_image(FindInput& input){
   
   vector<FindResult> results;
   Mat source = input.getSourceMat();
   Mat image = input.getTargetMat();
   if(!source.rows || !source.cols || !image.rows || !image.cols)
      return results;
      
   TemplateFinder f(source);
   
   if (input.isFindingAll()){
      int maxReturn = Vision::getParameter("FindAllMaxReturn");
      f.find_all(image, input.getSimilarity());
      while (f.hasNext() && results.size() < maxReturn){
         results.push_back(f.next());
      }
   }
   else{
      f.find(image, input.getSimilarity());
      if (f.hasNext())
         results.push_back(f.next());
      
   }
   return results;
}
Beispiel #3
0
static vector<FindResult>
find_text(FindInput& input){

   vector<FindResult> results;

   Mat source = input.getSourceMat();
   if(!source.rows || !source.cols)
      return results;

   TextFinder f(source);
   if (input.isFindingAll()){

      int maxReturn = Vision::getParameter("FindAllMaxReturn");
      f.find_all(input.getTargetText().c_str(), input.getSimilarity());
      while (f.hasNext() && results.size() < maxReturn){
         results.push_back(f.next());
      }
   }
   else{
      f.find(input.getTargetText().c_str(), input.getSimilarity());
      if (f.hasNext())
         results.push_back(f.next());
   }


/*
   Mat result_image = source * 0.5;
   for (vector<FindResult>::iterator it = results.begin();
        it != results.end(); ++it){

      FindResult& r = *it;

      Point pt(r.x,r.y);
      putText(result_image, input.getTargetText(), pt,
              FONT_HERSHEY_SIMPLEX, 0.3, Color::RED);

   }
   VisualLogger::setEnabled(enable_visual_log);
   sualLogger::log("FindText-Result", result_image);
 */


   return results;
}