Esempio n. 1
0
def draw(image, ftype, x, y, w, h):
    """Draw shapes on an image (default rectangles)

    :param image: an image path
    :param x: rect x origin
    :param y: rect y origin
    :param w: rect w size
    :param h: rect h size
    """
    shape = (x, y, w, h)
    img = lmb_detect.img_url(image)
    out = lmb_draw.draw_rect(img, shape)
    sys.stdout.write('%s\n' % out)
    return out
Esempio n. 2
0
def detect(*images):
    """Detect faces in images, output rects.

    Outputs serialized shapes

    :param images: a list of images to detect
    """
    def write_out(image, featname, recttup):
        stdout.write('%s %s %s %s %s %s\n' % ((image, featname) + recttup))

    for image in images:
        img = lmb_detect.img_url(image)
        for face in img.faces:
            r = face['rect']
            write_out(image, 'face', tuple_rect(r))
            for fkey, fval in face.iteritems():
                if is_rect(fval):
                    write_out(image, fkey, tuple_rect(fval))
Esempio n. 3
0
 def GET(self):
     urls_str = web.input(urls="").urls
     urls = urls_str.split(",") if urls_str else []
     images = [detect.img_url(url) for url in urls if url]
     return response(images, "images")
Esempio n. 4
0
 def GET(self):
     urls_str = web.input(urls='').urls
     urls = urls_str.split(',') if urls_str else []
     images = [detect.img_url(url) for url in urls if url]
     return response(images, 'images')