jci's blog

Earthquakes can't stop the rock

Escrito el 05/23/11 02:40:36 pm por jci

After all this bullshit, something must come to a good end

Categories: Web Link Blog, GNOME, GNU/Linux, Programacion, Hacks

Hace un tiempo atras, Claudio subio un script en Python que permite esto:

jci@rock:~/Photos/l$ ls
IMG_1190.JPG  IMG_1191.JPG  IMG_1192.JPG  IMG_1193.JPG
jci@rock:~/Photos/l$ ~/scripts/picsdir.py .
IMG_1191.JPG
creating dir ./2011-05-23
./2011-05-23
IMG_1192.JPG
./2011-05-23
IMG_1193.JPG
./2011-05-23
IMG_1190.JPG
./2011-05-23
Traceback (most recent call last):
  File "/home/jci/scripts/picsdir.py", line 66, in <module>
    print sum(getsize(join(root, name)) for name in files)
NameError: name 'files' is not defined
jci@rock:~/Photos/l$ ls
2011-05-23

Pero desde que me dio por actualizar a Natty...

jci@socrates:~/Photos/untitled folder 2$ ~/scripts/picsdir.py  .
IMG_1101.JPG
Traceback (most recent call last):
  File "/home/jci/scripts/picsdir.py", line 64, in <module>
    start=Main(sys.argv)
  File "/home/jci/scripts/picsdir.py", line 62, in Main
    move_smartly (filename, dir_in, dir_out)
  File "/home/jci/scripts/picsdir.py", line 29, in move_smartly
    image = pyexiv2.Image(image_file)
AttributeError: 'module' object has no attribute 'Image'

Nada que un hack no pueda hacer :-)

#!/usr/bin/env python

# Copyright (C) 2008  Claudio Saavedra 
# modified by jci :-)
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .

import sys
import pyexiv2
import os
import os.path
import shutil
import mimetypes

def move_smartly(file, dir_in, dir_out):
    image_file = os.path.join (dir_in, file)
    image = pyexiv2.ImageMetadata(image_file)
    image.read()
    try:
    	date_creation = image['Exif.Image.DateTime']  
    except:
	print "i'm ignoring this"
        return
    print date_creation
    str_date = date_creation.value.strftime('%Y-%m-%d')
    target_dir = os.path.join (dir_out, str_date)

    if (not os.path.exists(target_dir)):
        print "creating dir " + target_dir
        os.mkdir(target_dir)
    print target_dir
    shutil.move (image_file, target_dir)


def Main(args):
    if (len (args) < 1):
        sys.exit("not enough parameters")
    dir_in = args[1]
    if (len (args) < 3):
        dir_out = dir_in
    else:
        dir_out = args[2]

    for root, dirs, files in os.walk (dir_in):
        for f in files:
	    print f
            filename = os.path.join (root, f)
            if mimetypes.guess_type(filename)[0] == 'image/jpeg':
                move_smartly (filename, dir_in, dir_out)

start=Main(sys.argv)

print sum(getsize(join(root, name)) for name in files)
2851 views » Send feedback »

Escrito el 05/15/11 11:19:38 am por jci

Pretty much like Nutella and Chocolate, but with less fat

Categories: Web Link Blog, GNOME, GNU/Linux, Beer, Fotografia, Hacks

Para la gente que no me conozca, tengo varios hobbies que he conservado a lo largo del tiempo. Aparte del PS3, es la fotografia.

Nublado en la plataforma en Paranal

Bueh, y como desde hace un tiempo estoy trabajando en un lugar que tecnicamente se pueden ver las estrellas durante la noche. El gran problema de ciudades como Santiago es que la contaminacion luminica no permite ver las estrellas. Algo similar a "los arboles no dejan ver el bosque".

Entonces pense que seria interesante hacer un stop motion de las estrellas moviendose. Asi que a mirar no solamente el manual de la camara, sino tambien que clase de desechos podria tener en casa que pudieran ayudarme.

IMG_0928

Gphoto

Libgphoto2 es una biblioteca de manejo de camaras digitales. Pero, lamentablemente, tiene un soporte medio fulero para algunas camaras. Y lamentablemente, tengo una camara que no soporta a libgphoto2...

"Canon and some Nikon cameras only: capturetarget - setting this to sdram will make the camera capture directly into the camera RAM and not on the memory card. You need to download the image in the same gphoto2 call..."

Bueh, puedo vivir con eso. Incluso, la comunicacion con la camara me permite hacer video!

jci@arthur:~$ gphoto2 --list-config
/main/actions/uilock                                                           
/main/actions/syncdatetime
/main/actions/autofocusdrive
/main/actions/manualfocusdrive
/main/actions/eoszoom
/main/actions/eoszoomposition
/main/actions/eosviewfinder
/main/actions/eosremoterelease
/main/settings/datetime
/main/settings/reviewtime
/main/settings/output
/main/settings/evfmode
/main/settings/ownername
/main/settings/artist
/main/settings/copyright
/main/settings/capturetarget
/main/settings/capture
/main/status/model
/main/status/ptpversion
/main/status/batterylevel
/main/status/lensname
/main/status/serialnumber
/main/status/shuttercounter
/main/status/availableshots
/main/imgsettings/imageformat
/main/imgsettings/imageformatsd
/main/imgsettings/iso
/main/imgsettings/whitebalance
/main/imgsettings/whitebalanceadjusta
/main/imgsettings/whitebalanceadjustb
/main/imgsettings/whitebalancexa
/main/imgsettings/whitebalancexb
/main/imgsettings/colorspace
/main/capturesettings/autoexposuremode
/main/capturesettings/drivemode
/main/capturesettings/picturestyle
/main/capturesettings/aperture
/main/capturesettings/shutterspeed
/main/capturesettings/meteringmode
/main/capturesettings/bracketmode
/main/capturesettings/aeb
/main/other/d402
/main/other/d407
/main/other/d406
/main/other/d303
/main/other/5001
jci@arthur:~$ 

Todas las anteriores son las opciones que puedo modificar : autoexposure, drive mode...pero no le puedo decir donde almacenar las fotos. Ok, como dije, puedo vivir con eso.

Asi que solamente dejar seteada la camara y hacer :

jci@arthur:~$ gphoto2 -I 60 -F 120 --capture-image-and-download

El veintiunico problema es que debe estar conectado a una maquina con USB. Lo otro es que, algunas veces, no tener actividad en la maquina termina activando los modos de ahorro de energia que a veces involucran desconectar el subsistema de USB.

Pollona FTW!
Like cooking this

Teniendo todas las imagenes, luego montar usando mencoder. Aqui esta la parte truculenta. Entre comillas, por que es la mas simple...

Encode all *.jpg files in the current directory:
mencoder "mf://*.jpg" -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4

// mencoder man page

La otra opcion, por cierto, es ir META. O sea, conseguir un disparador remoto. Programable, ojala.

Aqui es donde aparece este juguetito. Una baratela en Amazon :-)

IMG_1068

Con este juguetito se puede programar el delay inicial, la cantidad de tiempo de exposicion (dejando el sensor abierto), el intervalo entre capturas y la cantidad de tomas a sacar.

Es como tener

jci@arthur:~$ sleep 5s; gphoto2 -I 60 -F 120 --capture-image-and-download

pero en version fisica :-)

Ah, ademas estoy intentando comprender como funcionan las curvas de color automaticas/manuales de las camaras.

Algo que GIMP ayuda bastante para lograr algo como esto...

Clouds over the mountains

Como queda? Este es un resultado de un experimento, claro que fue hecho _manualmente_

O mejor aun...

1888 views » Send feedback »

Acerca de este glob

On the Sixth Day, there was a Running Man looking for a Predator to stop a Raw Deal with a Commando. Only True Lies were said. But nao, Junior is about to get Twins, with the help of a Kindergarden Cop. That will be the Terminator of all struggles.

Archives