Example #1
0
#read a folder of images
#save top profile to a txt file
import os,glob,sys,pickle
from DynamicWarping import EventHorizon

EV=EventHorizon()
       
Images=[]
Feats=[]        

ImageSet=glob.glob(sys.argv[1]+'*.png')

for img in ImageSet:
    print 'extracting from ',img
    series=EV.getSingleFeature(img)
    #print 'inserting ',os.path.basename(img),'in database'
    Images.append(os.path.basename(img))
    Feats.append(series)


pickle.dump( Images, open( sys.argv[2], "wb" ) )
pickle.dump( Feats, open( sys.argv[3], "wb" ) )


Example #2
0
HandGroundTruth=[]
Thres_Len=float(sys.argv[4])
Band_Width=int(sys.argv[5])

with open('/tmp/DTWStilesParamts.txt','w') as arxeio:
    arxeio.write('thres len ' + sys.argv[4] + '\n')
    arxeio.write('rzoni ' + sys.argv[5] + '\n')
  

#read handwritten truth
with open(sys.argv[3],'r') as file:
    for line in file:
        HandGroundTruth.append(line)


EV=EventHorizon()

print len(HandFileNames)
RealComps=0 # how many comparisons returned a non infinite cost
Infinities=0 #count infinities as well

#Store in memory only the handwritten features
Hand_Series=[]
Truth=[]

#for each handwritten image

for i in xrange(0,len(HandFileNames)):
        print '------------------------------'
        for line in HandGroundTruth: