commit 82adff411eca843b82d23fef7b79d4bf5f440683 Author: rep Date: Thu Oct 15 18:16:50 2015 +0200 premier commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..696c84d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +pylone3 diff --git a/HH_.py b/HH_.py new file mode 100644 index 0000000..5098f71 --- /dev/null +++ b/HH_.py @@ -0,0 +1,17 @@ +(a) chargement_IMAGE + (1) mise à l échelle + (2) passage à 1 bit (noir|blanc) + (3) si nécessaire, conversion de format en non compressé (raw) + +(b) haacheuurr + (1) plusieurs mode pour les traites de coupes : + - tout le tour + - juste les bords droit/gauche (plus épais si sample plus grand ?) + - aucun contour + - couleur blanche|noire + +(c) horizontal_IMAGE + (1) largeur Image (en pixels) / FPS = temps de diffusion + +(d) horizontal_AUDIO + (1) calcul de la FTT inverse en fonction de la hauteur de l image diff --git a/HH_.tar.gz b/HH_.tar.gz new file mode 100644 index 0000000..95f3678 Binary files /dev/null and b/HH_.tar.gz differ diff --git a/HH_1.sh b/HH_1.sh new file mode 100755 index 0000000..7d0a708 --- /dev/null +++ b/HH_1.sh @@ -0,0 +1,8 @@ +# ------------- FILE INFO OUTPUT +echo $1 + +# ------------- RESIZE IMAGE (512, 1024, 2048, 4096 pixels de haut) +#convert $1 -resize 768x512 $1.768x512 + +# ------------- HACHAGE +python ./hacheuur.py $1 diff --git a/HH_2.sh b/HH_2.sh new file mode 100755 index 0000000..d279d11 --- /dev/null +++ b/HH_2.sh @@ -0,0 +1,23 @@ +# ------------- FILE INFO OUTPUT +echo $1 + +# ------------- ROTATE IMAGE 90 DEGRES SENS HORAIRE +convert -rotate 90 $1 $1.rotate + +# ------------- ENSCRIBE +# 1536 pixels / 25 fps = 61 secondes (durée fichier audio) +# enscribe -ts=1 -hf=20 -mask /usr/local/share/horizontal/sounds/piano-major7.flac -length=61.0 _MG_8817.out.2colors.tiff _MG_8817.out.2colors.tiff.wav +#enscribe -ts=0 -length=30.72 $1.rotate $1.enscribe.wav +enscribe -ts=0 -length=82 -hf=40 $1.rotate $1.enscribe.wav + +# ------------- NORMALIZE AUDIO +sox --norm $1.enscribe.wav $1.enscribe.norm.wav + +echo '-- END NORM --' + +# ------------- HORIZONTAL +python ./horizontal.simple.py $1 + +#NETTOYAGE +rm $1.rotate +rm $1.enscribe.wav diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/enscribe_.sh b/enscribe_.sh new file mode 100644 index 0000000..5a67583 --- /dev/null +++ b/enscribe_.sh @@ -0,0 +1,34 @@ +# ------------- FILE INFO OUTPUT + +file = $1 +echo 'file : '+file + +# ------------- RESIZE IMAGE (512, 1024, 2048, 4096 pixels de haut) +# donc de 5184*3456 pix à 1536*1024 pix par exemple +#convert $image_input -resize 768x512 $image_output_resize + +# ------------- HACHAGE +#python ~/Projets/haacheur/hacheuur.py $image_output_resize + +# ------------- HORIZONTAL + + +# ------------- ROTATE IMAGE 90 DEGRES SENS HORAIRE +#convert -rotate 90 $image_input $image_output + + +# ------------- ENSCRIBE +# 1536 pixels / 25 fps = 61 secondes (durée fichier audio) +# enscribe -ts 1024 -hf 20 -o output.wav input.wav -mask /usr/local/share/horizontal/sounds/piano_7.flac -lenght $tailleImage/$fps +# enscribe -ts=1 -hf=20 -mask /usr/local/share/horizontal/sounds/piano-major7.flac -length=61.0 _MG_8817.out.2colors.tiff _MG_8817.out.2colors.tiff.wav + + +# enscribe retenu : sans mask, avec du hissing : -h, largeur image : 1024 -ts=1, sur une png 2 couleurs +#enscribe -ts=0 -length=30.72 image_input.jpg sound_output.enscribe.wav + +#enscribe -ts=1 -h -length=61.0 -mask /usr/local/share/horizontal/sounds/alto-majormode.flac _MG_8817.out.2colors.png _MG_8817.out.2colors.png.61s.alto-majormode.wav + + +# ------------- NORMALIZE ENSCRIBE AUDIO OUTPUT +# normaliser l'audio, histoire d'avoir une amplitude (volume) optimale +#sox --norm sound_output.enscribe.wav sound_output.wav diff --git a/gris1.py b/gris1.py new file mode 100644 index 0000000..ea64352 --- /dev/null +++ b/gris1.py @@ -0,0 +1,51 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import sys +import Image +import random +import os +import ImageDraw +import ImageFont +import ImageFilter +from time import gmtime, strftime +# modifs du 30/10/2013 +import ImageEnhance + +im1 = Image.open(str(sys.argv[1])) +im1 = im1.convert('RGB') + +# BLUR +'''for i in range(40): + im1 = im1.filter(ImageFilter.BLUR) +''' + +#operation 'degoulinage', pixel par pixel +imagesource = im1 +imagedest = im1 +for i in range (60000) : + posrandX = random.randint(1, imagesource.size[0]-1) + posrandY = random.randint(1, imagesource.size[1]-55) + pixelRGB = imagesource.getpixel((posrandX,posrandY)) + + for Y in range (1, 49) : + imagedest.putpixel((posrandX, posrandY + random.randint(1,Y)+5), pixelRGB) + +imagedest.save("test.jpg"+strftime("%Y-%m-%d-%Hh%Mm%Ss", gmtime())+".jpg",quality=100) + +''' +#collage de l'image résultante dans une image 1bit +im4 = Image.new("1", (im1.size[0], im1.size[1])) +im4.paste(im1, (0, 0, im1.size[0], im1.size[1])) + +# CTRL + S +im4.save("griis-out-"+strftime("%Y-%m-%d-%Hh%Mm%Ss", gmtime())+".jpg",quality=100) +''' + +#COPIER/COLLAGE SIMPLE ET EFFICACE : +''' +box = (30, 30, 110, 110) +sample = image.crop(box) +for i in range(10): # with the BLUR filter, you can blur a few times to get the effect you're seeking + sample = sample.filter(ImageFilter.BLUR) +image.paste(sample, box) +''' diff --git a/hacheuur.py b/hacheuur.py new file mode 100644 index 0000000..a40b48c --- /dev/null +++ b/hacheuur.py @@ -0,0 +1,170 @@ +#!/usr/bin/python +# coding: utf-8 + +# haacheuur 0.24 +# port industriel de port la nouvelle - couleur - 60cm*30cm +# image source : pln.jpg +# image rendue : pln..20150910-11h59m53s.jpg + + +import sys +import Image +import random +import os +import ImageDraw +import ImageFont +import ImageFilter + +from time import gmtime, strftime +import time + +# modifs du 30/10/2013 +import ImageEnhance + +#ouvertrure de l'image source et conversion en mode 1bit +im1 = Image.open(str(sys.argv[1])).convert('1') +#im1 = Image.open(str(sys.argv[1])) +im2 = im1.copy() +#im3 = Image.new("1", (im1.size[0], im1.size[1])) +#im4 = Image.new("1", (im1.size[0]*3, im1.size[1])) + +#rapport d'allongement de la nouvelle image par rapport à la largeur de l'image originale +allongement = 1 + +im3 = Image.new("RGBA",(im1.size[0], im1.size[1])) +im4 = Image.new("RGBA",(im1.size[0]*allongement, im1.size[1])) + +Larg = im1.size[0] +Haut = im1.size[1] + +for i in range(10): + + # nombre aleatoire compris dans les limites de l'image + def randHaut(): return random.randint(0, im1.size[1]) + + # constitution de la liste des tranches horizontales + # genre comme si qu'on avait un 16 pistes :) + randomCoupeHauteur = [0, \ + randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ + randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ + randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ + randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ + randHaut(),randHaut(),randHaut(),randHaut(),randHaut(), \ + im1.size[1]] + + # rangement des valeurs des plus petites au plus grandes + randomCoupeHauteur.sort() + + # DEBUG + liste = [] + + # les hachures + def Hacheur(haut, bas) : + n=0 + while n< ------------------------------------------------------------------ + # tirage au sort + #randomFacteur = random.randint(0, len(randomListe)*3) + choix = 0 + + # DEBUG + #print len(randomListe)*3 + + # ponderation du tirage au sort + randomFacteur = random.randint(0, len(randomListe)-1) + + # DEBUG + #liste.append(choix) + + # assignation des valeurs (paires) finales choisies + randomCopyLargFinal = randomListe[randomFacteur][0] + repeat = randomListe[randomFacteur][1] + + # positionnement de la copie, aleatoirement, entre 0 et la largeur totale de l'image + randomCopyPosi = random.randint(0, (im1.size[0]-randomCopyLargFinal)) + + cx1 = randomCopyPosi + cx2 = randomCopyPosi + randomCopyLargFinal + # decoupage du sample + im3 = im2.crop((cx1,haut,cx2,bas)) +# 8>< ------------------------------------------------------------------ + + draw = ImageDraw.Draw(im4) + loop = 0 + + #collage, n fois, du sample + while loop