parameters: (self, obj, eps, fps)
return_statement: return newframes
docstring: Creates dense annotations for a BeaverDam JSON object.
  		
  		Dense annotations will be created between the first and last keyframe.
  		Between keyframes linear interpolation is used to advance bounding rectangle
  		information. State information is always copied from the earlier of two
  		keyframes involved in interpolation. Interpolation will be replaced by a
  		direct keyframe copy if the keyframe timestamp is within `eps` of
  		the current timestamp.
  		
  		The following information is stored within generated annotations:
  			- `frameid` : Zero based frame index.
  			- `frame`: timestamp of current frame, computed as `framerate * frameid`.
  			- `state`: State set during labeling. See BeaverDam documentation.
  			- `x,y,w,h`: Bounds information.
  			- `refid`: Keyframe reference index if direct keyframe copy is applied.
docstring_summary: Creates dense annotations for a BeaverDam JSON object.
  		
  		Dense annotations will be created between the first and last keyframe.
  		Between keyframes linear interpolation is used to advance bounding rectangle
  		information. State information is always copied from the earlier of two
  		keyframes involved in interpolation. Interpolation will be replaced by a
  		direct keyframe copy if the keyframe timestamp is within `eps` of
  		the current timestamp.
  		
  		The following information is stored within generated annotations:
  			- `frameid` : Zero based frame index.
  			- `frame`: timestamp of current frame, computed as `framerate * frameid`.
  			- `state`: State set during labeling. See BeaverDam documentation.
  			- `x,y,w,h`: Bounds information.
  			- `refid`: Keyframe reference index if direct keyframe copy is applied.
docstring_tokens: Creates dense annotations for a BeaverDam JSON object . Dense annotations will be created between the first and last keyframe . Between keyframes linear interpolation is used to advance bounding rectangle information . State information is always copied from the earlier of two keyframes involved in interpolation . Interpolation will be replaced by a direct keyframe copy if the keyframe timestamp is within eps of the current timestamp . The following information is stored within generated annotations : - frameid : Zero based frame index . - frame : timestamp of current frame computed as framerate * frameid . - state : State set during labeling . See BeaverDam documentation . - x y w h : Bounds information . - refid : Keyframe reference index if direct keyframe copy is applied .
function: def create_dense_annotations(self, obj, eps, fps):
  		'''Creates dense annotations for a BeaverDam JSON object.
  		
  		Dense annotations will be created between the first and last keyframe.
  		Between keyframes linear interpolation is used to advance bounding rectangle
  		information. State information is always copied from the earlier of two
  		keyframes involved in interpolation. Interpolation will be replaced by a
  		direct keyframe copy if the keyframe timestamp is within `eps` of
  		the current timestamp.
  		
  		The following information is stored within generated annotations:
  			- `frameid` : Zero based frame index.
  			- `frame`: timestamp of current frame, computed as `framerate * frameid`.
  			- `state`: State set during labeling. See BeaverDam documentation.
  			- `x,y,w,h`: Bounds information.
  			- `refid`: Keyframe reference index if direct keyframe copy is applied.
  		'''
  
  		keyframes = sorted(obj['keyframes'], key=lambda x: x['frame'])
  			
  		newframes = []
  		if len(keyframes) == 0:
  			return newframes
  
  		framerate = 1. / fps
  		fidx = int(math.floor(keyframes[0]['frame'] / framerate))
  		knext = 0
  		
  		while knext < len(keyframes):        
  
  			tnext = keyframes[knext]['frame']
  			t = fidx * framerate
  			td = tnext - t
  			
  			isinrange = abs(td) <= eps
  
  			if isinrange:
  				frame = dict(keyframes[knext])
  				frame['frame'] = t
  				frame['frameid'] = fidx    
  				frame['refid'] = knext   
  				newframes.append(frame)
  			elif knext > 0:
  				kprev = knext - 1
  				frac = (t - keyframes[kprev]['frame']) / (tnext - keyframes[kprev]['frame'])
  				closer = kprev if frac <= 0.5 else knext
  				b = self.interpolate(
  					self.bounds_from_json(keyframes[kprev]), 
  					self.bounds_from_json(keyframes[knext]), 
  					frac)
  
  				frame = dict(keyframes[closer])
  				frame['frame'] = t
  				frame['state'] = keyframes[kprev]['state']
  				frame['frameid'] = fidx
  				frame.update(self.bounds_to_json(b))
  				newframes.append(frame)
  
  			if t + framerate > tnext:
  				knext += 1
  
  			fidx += 1
  
  		return newframes
function_tokens: def create_dense_annotations ( self , obj , eps , fps ) : keyframes = sorted ( obj [ 'keyframes' ] , key = lambda x : x [ 'frame' ] ) newframes = [ ] if len ( keyframes ) == 0 : return newframes framerate = 1. / fps fidx = int ( math . floor ( keyframes [ 0 ] [ 'frame' ] / framerate ) ) knext = 0 while knext < len ( keyframes ) : tnext = keyframes [ knext ] [ 'frame' ] t = fidx * framerate td = tnext - t isinrange = abs ( td ) <= eps if isinrange : frame = dict ( keyframes [ knext ] ) frame [ 'frame' ] = t frame [ 'frameid' ] = fidx frame [ 'refid' ] = knext newframes . append ( frame ) elif knext > 0 : kprev = knext - 1 frac = ( t - keyframes [ kprev ] [ 'frame' ] ) / ( tnext - keyframes [ kprev ] [ 'frame' ] ) closer = kprev if frac <= 0.5 else knext b = self . interpolate ( self . bounds_from_json ( keyframes [ kprev ] ) , self . bounds_from_json ( keyframes [ knext ] ) , frac ) frame = dict ( keyframes [ closer ] ) frame [ 'frame' ] = t frame [ 'state' ] = keyframes [ kprev ] [ 'state' ] frame [ 'frameid' ] = fidx frame . update ( self . bounds_to_json ( b ) ) newframes . append ( frame ) if t + framerate > tnext : knext += 1 fidx += 1 return newframes