Beispiel #1
0
#load the model
m=util2.load("%s%d.model"%(modelname,it))

import pylab

#show the model
if True:
    print "Show model"
    pylab.figure(100)
    pylab.clf()
    util2.drawModel(m["ww"])
    pylab.draw()

print "---- Image %s----"%imname
print
img=util2.myimread(imname)
#compute the HOG pyramid
f=pyrHOG2.pyrHOG(img,interv=10,savedir="",notload=True,notsave=True,hallucinate=True,cformat=True)
print
print "Complete search"
showImage(img,title="Complete search")
res=pyrHOG2.detect(f,m,bottomup=True,deform=True,usemrf=True,small=False,show=True)
pylab.axis((0,img.shape[1],img.shape[0],0))
dettime1=res[2]
numhog1=res[3]
print "Number of computed HOGs:",numhog1
print
print "Coarse-to-Fine search"
import pylab
showImage(img,title="Coarse-to-Fine")
res=pyrHOG2.detect(f,m,bottomup=False,deform=True,usemrf=True,small=False,show=True)
Beispiel #2
0
    
    #configuration class
    class config(object):
        pass
    cfg=config()
    cfg.testname="./data/finalRL/%s2_test"  #object model
    cfg.resize=1.0                          #resize the input image
    cfg.hallucinate=True                    #use HOGs up to 4 pixels
    cfg.initr=1                             #initial radious of the CtF search
    cfg.ratio=1                             #radious at the next levels
    cfg.deform=True                         #use deformation
    cfg.bottomup=False                      #use complete search
    cfg.usemrf=True                         #use lateral constraints

    #read the image
    img=util2.myimread(imname,resize=cfg.resize)    
    #compute the hog pyramid
    f=pyrHOG2.pyrHOG(img,interv=10,savedir="",notsave=True,notload=True,hallucinate=cfg.hallucinate,cformat=True)
    #show the image
    fig=pylab.figure(20)
    pylab.ioff()
    axes=pylab.Axes(fig, [.0,.0,1.0,1.0]) 
    fig.add_axes(axes) 
    pylab.imshow(img,interpolation="nearest",animated=True)
        
    t=time.time()
    #for each class
    for ccls in cls:
        print
        print "Class: %s"%ccls
        #load the class model