premier commit
This commit is contained in:
commit
82adff411e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
pylone3
|
17
HH_.py
Normal file
17
HH_.py
Normal file
@ -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
|
BIN
HH_.tar.gz
Normal file
BIN
HH_.tar.gz
Normal file
Binary file not shown.
8
HH_1.sh
Executable file
8
HH_1.sh
Executable file
@ -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
|
23
HH_2.sh
Executable file
23
HH_2.sh
Executable file
@ -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
|
34
enscribe_.sh
Normal file
34
enscribe_.sh
Normal file
@ -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
|
51
gris1.py
Normal file
51
gris1.py
Normal file
@ -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)
|
||||
'''
|
170
hacheuur.py
Normal file
170
hacheuur.py
Normal file
@ -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<im4.size[0] :
|
||||
|
||||
# constitution d'une liste de dimensions et de repetitions
|
||||
#dimen FAAAAT
|
||||
#randomListe = [(10240,1),(5120,1),(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,32),(20,16),(10,32),(10,16),(5,64)]
|
||||
#dimen FUZITU
|
||||
|
||||
#PLN back
|
||||
#randomListe = [(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,24),(20,16),(10,32),(10,16),(5,64),(2,64),(1,64),(1,16)]
|
||||
|
||||
#PLN recursif sept 2015
|
||||
#randomListe = [(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,24),(20,16),(10,32),(10,16),(5,64)]
|
||||
#randomListe = [(5120,1),(2560,1),(1280,2),(640,4),(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(10,32),(5,64),(3,24)]
|
||||
# test HH_
|
||||
randomListe = [(1280,2),(640,4),(320,5),(240,4),(160,6),(120,4),(120,8),(80,16),(60,16),(20,32),(8,24),(8,16),(5,64),(3,24),(2,24),(1,128),(1,64),(1,6)]
|
||||
|
||||
#dimen BLOG CUMULONIMBUS
|
||||
#randomListe = [(320,8),(320,3),(160,12),(160,6),(120,8),(80,24),(40,16),(20,32),(20,16),(10,32),(10,16),(5,64)]
|
||||
# repeter ce qui suit 2 ou 3 fois pour realiser non pas
|
||||
# un sample, mais carrement ue sequence
|
||||
# 8>< ------------------------------------------------------------------
|
||||
# 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<repeat:
|
||||
px1 = n
|
||||
px2 = n + randomCopyLargFinal
|
||||
|
||||
draw = ImageDraw.Draw(im3)
|
||||
|
||||
#lignes noires 1px autour
|
||||
#draw.line((0, 0, im3.size[0]-1, 0), fill="rgb(255,255,255)")
|
||||
draw.line((im3.size[0]-1, 0, im3.size[0]-1, im3.size[1]-1), fill="rgb(255,255,255)")
|
||||
|
||||
im4.paste(im3, (px1, haut, px2, bas))
|
||||
|
||||
n = n + randomCopyLargFinal
|
||||
loop = loop + 1
|
||||
|
||||
# les tranches horizontales intactes soulignees de blanc
|
||||
def TrancheHorizontale() :
|
||||
# tirage au hasard de la bande copiee
|
||||
pos = random.randint(0, im1.size[1]-im1.size[1]/20)
|
||||
# copiage
|
||||
im5 = im2.crop((0,pos,im1.size[0],pos+im1.size[1]/20))
|
||||
|
||||
# le soulignage en blanc
|
||||
draw = ImageDraw.Draw(im5)
|
||||
draw.line((0, im5.size[1]-1, im5.size[0], im5.size[1]-1), fill="black")
|
||||
draw.line((0, 1, im5.size[0], 1), fill="black")
|
||||
|
||||
# collage
|
||||
im4.paste(im5, (0,pos,im1.size[0],pos+im1.size[1]/20))
|
||||
|
||||
# HAACHEUUR
|
||||
for j in range(len(randomCoupeHauteur)-1):
|
||||
Hacheur(randomCoupeHauteur[j], randomCoupeHauteur[j+1])
|
||||
|
||||
# DEBUG
|
||||
#print liste
|
||||
#print sorted(set(liste),key=liste.count)
|
||||
|
||||
# CTRL + S
|
||||
#chemin du script
|
||||
#scriptpy = sys.argv[0]
|
||||
|
||||
#chemin de l'image : str(sys.argv[1])
|
||||
scriptpy = str(sys.argv[1])
|
||||
|
||||
script = scriptpy[:-3]
|
||||
|
||||
n = "%05d" % i
|
||||
|
||||
im4.save(script+"."+n+"_"+strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())+".png",'PNG', quality=100)
|
||||
|
||||
#print script+"."+str(i)+"_"+strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())+".jpg"
|
||||
|
||||
#millis = int(round(time.time() * 1000))
|
||||
#print "millis-secondes : "+str(millis)
|
||||
|
69
horizontal.simple.py
Normal file
69
horizontal.simple.py
Normal file
@ -0,0 +1,69 @@
|
||||
#!/usr/bin/python
|
||||
import os, sys, Image, ImageDraw, ImageColor
|
||||
from time import gmtime, strftime
|
||||
|
||||
fichier=sys.argv[1]
|
||||
|
||||
|
||||
try:
|
||||
#Image.open(fichier).save(outfile)
|
||||
im1 = Image.open(fichier).convert('1')
|
||||
im2 = im1.copy()
|
||||
im3 = im1.copy()
|
||||
draw = ImageDraw.Draw(im2)
|
||||
except IOError:
|
||||
print "FICHIER!!!", infile
|
||||
|
||||
date = strftime("%Y%m%d-%Hh%Mm%Ss", gmtime())
|
||||
|
||||
x=0
|
||||
while x < im1.size[0] :
|
||||
y = 0
|
||||
while y < im1.size[1] :
|
||||
colorpixel = im1.getpixel((x,y))
|
||||
draw.line( (0, y, im2.size[0], y) , fill=colorpixel)
|
||||
draw.line((x, 0, x, im2.size[1]-1), fill=1)
|
||||
|
||||
y = y + 1
|
||||
|
||||
#draw = ImageDraw.Draw(im2)
|
||||
#lignes noires 1px autour
|
||||
#draw.line((0, 0, im3.size[0]-1, 0), fill="rgb(255,255,255)")
|
||||
#draw.line((x, 0, x, im2.size[1]-1), fill="rgb(255,0,0)")
|
||||
|
||||
#------------------------------------------
|
||||
# ALPHA tout bete :
|
||||
im3 = Image.blend(im1, im2, 0.8)
|
||||
|
||||
# COMPOSITING :
|
||||
# im3 = Image.composite(im1, im2, mask)
|
||||
#im3 = Image.composite(im1, im2, im1)
|
||||
#------------------------------------------
|
||||
|
||||
n = "%05d" % x
|
||||
nomdefichier = "horizontal"+n+".png"
|
||||
im3.save(nomdefichier, "PNG")
|
||||
print nomdefichier
|
||||
|
||||
x = x + 1
|
||||
|
||||
#im4.save(script+"."+strftime('%Y%m%d-%Hh%Mm%Ss', gmtime())+".jpg",'JPEG', quality=100)
|
||||
|
||||
del draw
|
||||
|
||||
#os.system("ffmpeg -i horizontal%d.png -vcodec mjpeg -q:v 0 "+fichier+".avi")
|
||||
|
||||
os.system("ffmpeg -i horizontal%05d.png -i "+fichier+".enscribe.norm.wav -c:a libfaac -c:v libx264 -preset ultrafast -crf 32 "+fichier+".final.mp4")
|
||||
|
||||
print " OUTPUT FINAL : "+fichier+".final.mp4"
|
||||
|
||||
|
||||
#os.system("rm horizontal*.png")
|
||||
|
||||
|
||||
# ALPHA :
|
||||
# out = image1 * (1.0 - alpha) + image2 * alpha
|
||||
|
||||
|
||||
|
||||
|
BIN
test.jpg2015-09-29-21h22m05s.jpg
Normal file
BIN
test.jpg2015-09-29-21h22m05s.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 MiB |
Loading…
Reference in New Issue
Block a user