Beispiel #1
0
    low = mat < 50
    mask = high  #+low
    ilog.log(pv.Image(1.0 * mask), 'Mask')

    #Composite operation using PIL
    e = edges.asPIL().convert('RGB')
    m = pv.Image(1.0 * mask).asPIL()
    i = im.asPIL()
    logo = pv.Image(composite(i, e, m))
    ilog.log(logo, 'Composite')
    #logo.show(window='Composite', pos=(0,300) )

    #Keypoint detection using OpenCV's SURF detector
    logo_surf = logo.copy()
    sm = pv.Image(im.asPIL().resize((320, 240), LINEAR))
    detector = DetectorSURF()
    points = detector.detect(sm)
    for score, pt, radius in points:
        logo_surf.annotateCircle(pt * 4, radius * 4)
    ilog.log(logo_surf, 'Annotated')
    #logo_surf.show(window='Annotated',pos=(360,300))

    #Demonstrate use of ImageMontage class to show a few small images in a single window
    print "Have the image montage focused in UI and hit spacebar to continue..."
    imontage = pv.ImageMontage([im, edges, logo, logo_surf],
                               layout=(2, 2),
                               tileSize=im.size,
                               gutter=3,
                               byrow=True,
                               nolabels=True)
    imontage.show(window="Image Montage", delay=0)
Beispiel #2
0
 def __init__(self):
     self.surf = DetectorSURF(n=1000, min_hessian=500)