Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('fname')
    args = parser.parse_args()
    img = load_image(args.fname)
    if img is not None:
        show_image_in_window(img, args.fname)
    else:
        print("Image %s could not be loaded!" % args.fname)
Exemplo n.º 2
0
import os.path
from renmas3.base import load_image, save_image
from renmas3.win32 import show_image_in_window

fname = 'lena2.ppm'
filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), fname)
print(filename)
img = load_image(filename)
print(img)

show_image_in_window(img)

fname = "lena3.ppm"
filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), fname)
save_image(filename, img)
Exemplo n.º 3
0
import time

import renmas3
import renmas3.core
from renmas3.win32 import show_image_in_window

start = time.clock()
ren = renmas3.core.Renderer()
irender = renmas3.core.IRender(ren)
end = time.clock()
print(end-start)

filename = 'I:\\GitRENMAS\\tests3\\renderer\\sphere1.py'
filename = 'E:\\GitRENMAS\\renmas\\tests3\\renderer\\sphere1.py'

exec(compile(open(filename).read(), filename, 'exec'), dict(locals()), dict(globals()))

ren.prepare()

start = time.clock()
ren.render()
ren.tone_map()
end = time.clock()
print(end-start)
show_image_in_window(ren._image)

Exemplo n.º 4
0
    contents = tmo_loader.load(tmo_shader, 'tmo.py')
    tmo = Tmo(contents, props)
    return tmo


hdr_image = load_image('Desk_oBA2.hdr')
#hdr_image = load_image('AtriumNight_oA9D.hdr')
width, height = hdr_image.size()
ldr_image = ImagePRGBA(width, height)

output_image = ImageBGRA(width, height)
reinhard = ReinhardOperator()
tmo = create_tmo('log_tmo')

start = time.clock()

#tmo shader
tmo.tone_map(hdr_image, ldr_image)
blt_prgba_to_bgra(ldr_image, output_image)

#old asm implementation
#reinhard.tone_map(hdr_image, output_image)

#without tone mapping
#blt_prgba_to_bgra(hdr_image, output_image)

end = time.clock()
print(end - start)

show_image_in_window(output_image)
Exemplo n.º 5
0
from renmas3.base import GraphicsPRGBA, RGBSpectrum, ImagePRGBA, ImageRGBA
from renmas3.utils import blt_prgba_to_rgba
from renmas3.win32 import show_image_in_window

img = ImagePRGBA(400, 400)
gr = GraphicsPRGBA()
gr.draw_rect(img, 20, 20, 80, 50, RGBSpectrum(0.6, 0.0, 0.0))

width, height = img.size()
img2 = ImageRGBA(width, height)
blt_prgba_to_rgba(img, img2)

show_image_in_window(img2)

Exemplo n.º 6
0
def show_hdr_image(hdr_image, key=0.18, saturation=0.6, fname=None):
    reinhard = ReinhardOperator(key, saturation)
    width, height = hdr_image.size()
    ldr_image = ImageBGRA(width, height)
    reinhard.tone_map(hdr_image, ldr_image)
    show_image_in_window(ldr_image, fname)
Exemplo n.º 7
0
def show_hdr_image(hdr_image, key=0.18, saturation=0.6, fname=None):
    reinhard = ReinhardOperator(key, saturation)
    width, height = hdr_image.size()
    ldr_image = ImageBGRA(width, height)
    reinhard.tone_map(hdr_image, ldr_image)
    show_image_in_window(ldr_image, fname)
Exemplo n.º 8
0
    contents = tmo_loader.load(tmo_shader, 'tmo.py')
    tmo = Tmo(contents, props)
    return tmo

hdr_image = load_image('Desk_oBA2.hdr')
#hdr_image = load_image('AtriumNight_oA9D.hdr')
width, height = hdr_image.size()
ldr_image = ImagePRGBA(width, height)

output_image = ImageBGRA(width, height)
reinhard = ReinhardOperator()
tmo = create_tmo('log_tmo')

start = time.clock()

#tmo shader
tmo.tone_map(hdr_image, ldr_image)
blt_prgba_to_bgra(ldr_image, output_image)

#old asm implementation
#reinhard.tone_map(hdr_image, output_image)

#without tone mapping
#blt_prgba_to_bgra(hdr_image, output_image)

end = time.clock()
print(end-start)

show_image_in_window(output_image)

Exemplo n.º 9
0
import time

import renmas3
import renmas3.core
from renmas3.win32 import show_image_in_window

start = time.clock()
ren = renmas3.core.Renderer()
irender = renmas3.core.IRender(ren)
end = time.clock()
print(end - start)

filename = 'I:\\GitRENMAS\\tests3\\renderer\\sphere1.py'
filename = 'E:\\GitRENMAS\\renmas\\tests3\\renderer\\sphere1.py'

exec(compile(open(filename).read(), filename, 'exec'), dict(locals()),
     dict(globals()))

ren.prepare()

start = time.clock()
ren.render()
ren.tone_map()
end = time.clock()
print(end - start)
show_image_in_window(ren._image)
Exemplo n.º 10
0
from renmas3.base import GraphicsRGBA, RGBSpectrum, ImagePRGBA, ImageRGBA
from renmas3.utils import blt_prgba_to_rgba, blt_rgba_to_prgba
from renmas3.win32 import show_image_in_window

img = ImageRGBA(400, 400)
gr = GraphicsRGBA()
gr.draw_rect(img, 20, 20, 80, 50, RGBSpectrum(0.6, 0.2, 0.4))

width, height = img.size()
img2 = ImagePRGBA(width, height)
blt_rgba_to_prgba(img, img2)

img3 = ImageRGBA(width, height)
blt_prgba_to_rgba(img2, img3)

print (img.get_pixel(25,25))
print (img2.get_pixel(25,25))
print (img3.get_pixel(25,25))
show_image_in_window(img3)
Exemplo n.º 11
0
def show_hdr_image(hdr_image, m=0.6, c=0.5, a=0.5, f=1.0, fname=None):
    reinhard = PhotoreceptorOperator(m, c, a, f)
    width, height = hdr_image.size()
    ldr_image = ImageBGRA(width, height)
    reinhard.tone_map(hdr_image, ldr_image)
    show_image_in_window(ldr_image, fname)