
Ok that's the result. Ok, it is not the most impressive HDR ever, BUT it is the first one that was created and tonemapped using my very first HDR/Tonemapping algorithm.



Here you can see the source code (python):
import Image
import ImageEnhance
import math
print "Salendrons HDR Tonemapper"
out = raw_input("Save as: ")
im1 = Image.open("1.jpg")
im2 = Image.open("2.jpg")
im3 = Image.open("3.jpg")
imOut = out
w = im1.size[0]
h = im1.size[1]
print w
print h
x = 0
while x < w:
y = 0
while y < h:
p1 = im1.getpixel((x,y))
p2 = im2.getpixel((x,y))
p3 = im3.getpixel((x,y))
try:
npr = int((math.log10(p1[0] + p2[0] + p3[0] + 1.0) / (math.log10(255 + 255 + 255 + 1.0))) * 255)
except:
npr = p1[0]
print "ERR " + str(x)
try:
npg = int((math.log10(p1[1] + p2[1] + p3[1] + 1.0) / (math.log10(255 + 255 + 255 + 1.0))) * 255)
except:
npg = p1[1]
print "ERR " + str(x)
try:
npb = int((math.log10(p1[2] + p2[2] + p3[2] + 1.0) / (math.log10(255 + 255 + 255 + 1.0))) * 255)
except:
npb = p1[2]
print "ERR " + str(x)
im1.paste((npr,npg,npb),(x,y,x+1,y+1))
y = y + 1
x = x + 1
if x % 10 == 0:
print x
enh1 = ImageEnhance.Color(im1)
im1 = enh1.enhance(2)
enh2 = ImageEnhance.Contrast(im1)
im1 = enh2.enhance(2)
enh3 = ImageEnhance.Brightness(im1)
im1 = enh3.enhance(0.9)
im1.save(imOut)
print "end"
1 comment:
Hi!
I saw your HDR algoritm... very vey useful.
I wanna do the same in labview, but i cant find any HDR algoritm... could you help me?
please send me a mail to:
durnek60@gmail.com
Post a Comment