Esempio n. 1
0
vector<FindResult> 
Vision::find(FindInput input){
   VisualLogger::next();

   vector<FindResult> results;

   if (input.getTargetType() == TARGET_TYPE_IMAGE){
      
      results = find_image(input);
      
   }
   else if (input.getTargetType() == TARGET_TYPE_TEXT){
    
      results = find_text(input);
      
   }else if (input.getTargetType() == TARGET_TYPE_BUTTON){

      results = find_button(input);
   
   }
   
   vector<FindResult> final_results;
   int n = min((int)results.size(), (int)input.getLimit());
   for (int i=0; i< n; ++i){
      final_results.push_back(results[i]);
   }

   return final_results;
}
Esempio n. 2
0
vector<FindResult>
Vision::findChanges(FindInput input){
   vector<FindResult> results;
   Mat source = input.getSourceMat();
   Mat image = input.getTargetMat();
   ChangeFinder f(source);
   f.find(image);
   while (f.hasNext() && (results.size() < input.getLimit())){
      results.push_back(f.next());
   }
   vector<FindResult> final_results;
   int n = input.getLimit();
   if(n < results.size()){
      copy(results.begin(), results.begin()+n, final_results.begin());
      return final_results;
   }
   else return results;
}