(_)
match pairs from two folders.

  it find frames in a folder, try to find a matching frame in an other folder,
  and build a pair.
match pairs from two folders.
match pairs from two folders .
def main(_):
  """match pairs from two folders.

  it find frames in a folder, try to find a matching frame in an other folder,
  and build a pair.

  """
  size = ARGS.size
  path = '{}/*.jpg'.format(ARGS.path_left)
  print('looking for recursive img in', path)
  l_list = glob.glob(path)
  print('found ', len(l_list), 'for left list')
  path = '{}/*.jpg'.format(ARGS.path_right)
  print('looking for frames img in', path)
  r_list = glob.glob(path)
  print('found ', len(r_list), 'for right list')
  if ARGS.limit > 0:
    shuffle(l_list)
    l_list = l_list[:ARGS.limit]
  for left in l_list:
    match, i = is_match(left, r_list)
    if match:
      print('load left', left, ' and right', match)
      img_left = Image.open(left)
      img_right = Image.open(match)

      # resize the images
      if size == -1:
        size = min(img_left.size)
      img_left = img_left.resize((size, size), Image.ANTIALIAS)
      img_right = img_right.resize((size, size), Image.ANTIALIAS)

      # create the pair
      pair = Image.new('RGB', (size * 2, size), color=0)
      pair.paste(img_left, (0, 0))
      pair.paste(img_right, (size, 0))

      # save file
      file_out = os.path.join(ARGS.path_out, '{}{:07d}.jpg'.format(
          ARGS.prefix, i))
      pair.save(file_out, 'JPEG')
def main ( _ ) : size = ARGS . size path = '{}/*.jpg' . format ( ARGS . path_left ) print ( 'looking for recursive img in' , path ) l_list = glob . glob ( path ) print ( 'found ' , len ( l_list ) , 'for left list' ) path = '{}/*.jpg' . format ( ARGS . path_right ) print ( 'looking for frames img in' , path ) r_list = glob . glob ( path ) print ( 'found ' , len ( r_list ) , 'for right list' ) if ARGS . limit > 0 : shuffle ( l_list ) l_list = l_list [ : ARGS . limit ] for left in l_list : match , i = is_match ( left , r_list ) if match : print ( 'load left' , left , ' and right' , match ) img_left = Image . open ( left ) img_right = Image . open ( match ) # resize the images if size == - 1 : size = min ( img_left . size ) img_left = img_left . resize ( ( size , size ) , Image . ANTIALIAS ) img_right = img_right . resize ( ( size , size ) , Image . ANTIALIAS ) # create the pair pair = Image . new ( 'RGB' , ( size * 2 , size ) , color = 0 ) pair . paste ( img_left , ( 0 , 0 ) ) pair . paste ( img_right , ( size , 0 ) ) # save file file_out = os . path . join ( ARGS . path_out , '{}{:07d}.jpg' . format ( ARGS . prefix , i ) ) pair . save ( file_out , 'JPEG' )