Recreando fotos usando collages y metapixel

Crear una foto como un collage usando miniaturas de más fotos es el objetivo de este artículo. Antes de empezar os voy a dejar con un ejemplo de como podría quedar.

Al hacer zoom en la foto podremos observar el collage.

Lo primero será instalar metapixel. Es algo sencillo y suele estar en los repositorios oficiales de las distribuciones.

Necesitaremos una biblioteca de fotos para metapixel, así que primero copiamos las fotos que vayamos a necesitar a cualquier carpeta de nuestro sistema, por ejemplo ~/collage.

Dentro de ~/collage, creamos un directorio que se llame new, ya que ahí guardaremos las versiones miniaturizadas de las fotos que son las que usará metapixel a la hora de recrear nuevas fotos.

Para conseguir una versión en miniatura de cada foto, usamos el siguiente script:

#!/bin/bash

for file in `ls *.jpg`
do
          convert -resize 64x64 $file new/$file
done

El script lo guardamos en el directorio de ~/collage y lo ejecutamos.

Ahora indicaremos a metapixel que las fotos que debe usar están en ~/collage/new.

mkdir ~/.metapixel
metapixel-prepare -r ~/collage/new/ ~/.metapixel

Para probar, elegimos una foto por ejemplo foto.jpg y hacemos lo siguiente:

metapixel --metapixel foto.jpg foto_collage.jpg -l ~/.metapixel/ --cheat=30 --width=35 --height=35 --metric=wavelet --distance=10 

Y sólo falta ver el resultado en la foto fot_collage.jpg.

Se puede probar a cambiar los parámetros y observar el resultado obtenido, aquí os dejo la ayuda de metapixel.

Usage:
  metapixel --version
      print out version number
  metapixel --help
      print this help text
  metapixel [option ...] --prepare <inimage> <outimage> <tablefile>
      calculate and output tables for <file>
  metapixel [option ...] --metapixel <in> <out>
      transform <in> to <out>
  metapixel [option ...] --batch <batchfile>
      perform all the tasks in <batchfile>
Options:
  -l, --library=DIR            add the library in DIR
  -x, --antimosaic=PIC         use PIC as an antimosaic
  -w, --width=WIDTH            set width for small images
  -h, --height=HEIGHT          set height for small images
  -y, --y-weight=WEIGHT        assign relative weight for the Y-channel
  -i, --i-weight=WEIGHT        assign relative weight for the I-channel
  -q, --q-weight=WEIGHT        assign relative weight for the Q-channel
  -s  --scale=SCALE            scale input image by specified factor
  -m, --metric=METRIC          choose metric (subpixel or wavelet)
  -e, --search=SEARCH          choose search method (local or global)
  -c, --collage                collage mode
  -d, --distance=DIST          minimum distance between two instances of
                               the same constituent image
  -a, --cheat=PERC             cheat with specified percentage
  -f, --forbid-reconstruction=DIST
                               forbid placing antimosaic images on their
                               original locations or locations around it
  --out=FILE                   write protocol to file
  --in=FILE                    read protocol from file and use it

Report bugs and suggestions to 


Comentarios

Enviar un comentario nuevo

El contenido de este campo se mantiene como privado y no se muestra públicamente.
CAPTCHA
Esta pregunta sirve para comprobar si usted es un visitante humano y prevenir que máquinas automáticas de publicidad puedan entrar en esta sección.
4 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.