parameters: (self, params, corners, ids, last_frame_corners, last_frame_ids)
return_statement: return True
docstring: Returns true if the checkerboard detection described by params should be added to the database.
docstring_summary: Returns true if the checkerboard detection described by params should be added to the database.
docstring_tokens: Returns true if the checkerboard detection described by params should be added to the database .
function: def is_good_sample(self, params, corners, ids, last_frame_corners, last_frame_ids):
          """
          Returns true if the checkerboard detection described by params should be added to the database.
          """
          if not self.db:
              return True
  
          def param_distance(p1, p2):
              return sum([abs(a-b) for (a,b) in zip(p1, p2)])
  
          db_params = [sample[0] for sample in self.db]
          d = min([param_distance(params, p) for p in db_params])
          #print "d = %.3f" % d #DEBUG
          # TODO What's a good threshold here? Should it be configurable?
          if d <= 0.2:
              return False
  
          if self.max_chessboard_speed > 0:
              if not self.is_slow_moving(corners, ids, last_frame_corners, last_frame_ids):
                  return False
  
          # All tests passed, image should be good for calibration
          return True
function_tokens: def is_good_sample ( self , params , corners , ids , last_frame_corners , last_frame_ids ) : if not self . db : return True def param_distance ( p1 , p2 ) : return sum ( [ abs ( a - b ) for ( a , b ) in zip ( p1 , p2 ) ] ) db_params = [ sample [ 0 ] for sample in self . db ] d = min ( [ param_distance ( params , p ) for p in db_params ] ) #print "d = %.3f" % d #DEBUG # TODO What's a good threshold here? Should it be configurable? if d <= 0.2 : return False if self . max_chessboard_speed > 0 : if not self . is_slow_moving ( corners , ids , last_frame_corners , last_frame_ids ) : return False # All tests passed, image should be good for calibration return True