Beispiel #1
0
    for row in ftable:
        i = 0
        for item in row:
            file.write("/".join(item.filename().split("/")[-3:]) + " ")
            interimdir = os.path.join(dir, cams[i], item.filename().split("/")[-2])
            # create_dir makes sure we don't create it if already created
            common.create_dir(interimdir)
            shutil.copy(item.filename(), interimdir)
            i += 1
        file.write("\n")
    file.close()


if __name__ == "__main__":
    """
        - simplest example on how to call:
            ./sequence.py -b ~/work/darpa/data/finaltest01/out/ -d ~/tmp/seqout01 
                    -s 8486A360_2010_03_04-16:04:31.556.jpg -i 10
        
        NOTE:
            -s value must be a "keyframe" image, which is in the first dir listed 
                by common.list_cams.. which is currently the West image in 8486A360
            -i is the count of images in the sequence to write
    """
    parser = common.get_opts()
    opts, args = parser.parse_args()
    cams = common.list_cams(common.CAMS)
    ftable = common.create_frametable(opts.base, cams, opts.start_file, opts.image_count)
    common.create_dir(opts.dest)
    write_sequence(ftable, opts.dest, cams)
Beispiel #2
0
'''

import __init__ as common
import gen_web, run_web, composite
import sys, os, threading

BASE_DIR    = "/media/disk/out"
EVENT_FILE  = "/media/disk/out/GPSTEST-TAGFILE.log" 
GPS_FILE    = "/media/disk/out/LOCATION-LOG.log"
SQL_FILE    = "/tmp/images.sqlite3"
FONT_FILE   = "FreeMonoBold.ttf"

if __name__ == '__main__':
    if len(sys.argv) == 3 and sys.argv[1] == "composite":
        cams = composite.order_for_composite(common.CAMS)
        ftable = common.create_frametable(BASE_DIR, cams)
        common.create_dir(sys.argv[2])
        composite.write_images(ftable, sys.argv[2], "960x720", 
                 len(cams), FONT_FILE) 
    elif len(sys.argv) == 2 and sys.argv[1] == "avgsizes":
        cams = common.list_cams(common.CAMS)
        ftable = common.create_frametable(BASE_DIR, cams)
        totsize = 0
        count = 0
        for frame in ftable:
            for fi in frame:
                totsize += os.path.getsize(fi.filename())
                count += 1
        print ((totsize / count) / 1024.00)
    else:
        cams = common.list_cams(common.CAMS)
Beispiel #3
0
def get_more_opts(parser):
    """ Gets options specific to this module """
    parser.add_option("-S", "--size", default="960x720")
    parser.add_option("-F", "--font", help="Path to a font to use")
    parser.add_option("-N",
                      "--start_frame_n",
                      help="start generating at frame N",
                      type="int",
                      default=0)
    sizere = re.compile(r'^([0-9]{2,4})x([0-9]{2,4})$')
    opts, args = parser.parse_args()
    if not sizere.match(opts.size):
        parser.error("Invalid format for size.  Use WIDTHxHEIGHT")
    return opts, args


if __name__ == '__main__':
    """
    Create a series of composite image frames.
    - simplest example on how to call:
        ./composite.py -b ~/work/darpa/data/finaltest01/out/ -F FreeMonoBold.ttf -d ~/tmp/finalout01
    """
    parser = common.get_opts()
    opts, args = get_more_opts(parser)
    cams = order_for_composite(common.CAMS)
    ftable = common.create_frametable(opts.base, cams, opts.start_file,
                                      opts.image_count)
    common.create_dir(opts.dest)
    write_images(ftable, opts.dest, opts.size, len(cams), opts.font,
                 opts.start_frame_n)