parameters: (imgname,res,db)
docstring: Add the synthetically generated text image instance
    and other metadata to the dataset.
docstring_summary: Add the synthetically generated text image instance
    and other metadata to the dataset.
docstring_tokens: Add the synthetically generated text image instance and other metadata to the dataset .
function: def add_res_to_db(imgname,res,db):
    """
    Add the synthetically generated text image instance
    and other metadata to the dataset.
    """
    ninstance = len(res)
    for i in xrange(ninstance):
      print colorize(Color.GREEN,'added into the db %s '%res[i]['txt'])
      
      dname = "%s_%d"%(imgname, i)
      db['data'].create_dataset(dname,data=res[i]['img'])
      db['data'][dname].attrs['charBB'] = res[i]['charBB']
      db['data'][dname].attrs['wordBB'] = res[i]['wordBB']
      print 'type of res[i][\'txt\'] ',type(res[i]['txt'])
           
      #db['data'][dname].attrs['txt'] = res[i]['txt']
      db['data'][dname].attrs.create('txt', res[i]['txt'], dtype=h5py.special_dtype(vlen=unicode))
      print 'type of db ',type(db['data'][dname].attrs['txt']) 
      print colorize(Color.GREEN,'successfully added')
      print res[i]['txt']
      print res[i]['img'].shape
      print 'charBB',res[i]['charBB'].shape
      print 'charBB',res[i]['charBB']
      print 'wordBB',res[i]['wordBB'].shape
      print 'wordBB',res[i]['wordBB']
      '''
      img = Image.fromarray(res[i]['img'])
      hsv_img=np.array(rgb2hsv(img))
      print 'hsv_img_shape',hsv_img.shape
      print 'hsv_img',hsv_img
      H=hsv_img[:,:,2]
      print 'H_channel',H.shape,H
      #img = Image.fromarray(db['data'][dname][:])
      '''
function_tokens: def add_res_to_db ( imgname , res , db ) : ninstance = len ( res ) for i in xrange ( ninstance ) : print colorize ( Color . GREEN , 'added into the db %s ' % res [ i ] [ 'txt' ] ) dname = "%s_%d" % ( imgname , i ) db [ 'data' ] . create_dataset ( dname , data = res [ i ] [ 'img' ] ) db [ 'data' ] [ dname ] . attrs [ 'charBB' ] = res [ i ] [ 'charBB' ] db [ 'data' ] [ dname ] . attrs [ 'wordBB' ] = res [ i ] [ 'wordBB' ] print 'type of res[i][\'txt\'] ' , type ( res [ i ] [ 'txt' ] ) #db['data'][dname].attrs['txt'] = res[i]['txt'] db [ 'data' ] [ dname ] . attrs . create ( 'txt' , res [ i ] [ 'txt' ] , dtype = h5py . special_dtype ( vlen = unicode ) ) print 'type of db ' , type ( db [ 'data' ] [ dname ] . attrs [ 'txt' ] ) print colorize ( Color . GREEN , 'successfully added' ) print res [ i ] [ 'txt' ] print res [ i ] [ 'img' ] . shape print 'charBB' , res [ i ] [ 'charBB' ] . shape print 'charBB' , res [ i ] [ 'charBB' ] print 'wordBB' , res [ i ] [ 'wordBB' ] . shape print 'wordBB' , res [ i ] [ 'wordBB' ] '''
      img = Image.fromarray(res[i]['img'])
      hsv_img=np.array(rgb2hsv(img))
      print 'hsv_img_shape',hsv_img.shape
      print 'hsv_img',hsv_img
      H=hsv_img[:,:,2]
      print 'H_channel',H.shape,H
      #img = Image.fromarray(db['data'][dname][:])
      '''