A shot in the dark: are you sure the data format is double precision float? Try float16 RGBA via numpy 1.7.

import numpy
data = numpy.empty((spec.height, spec.width, spec.nchannels), 
dtype=numpy.float16)
image.read_image(spec.format, data)
from matplotlib import pyplot
pyplot.imshow(data)
pyplot.show()

Christoph


On 3/11/2013 8:10 PM, Scott Wilson wrote:
Hello,

I have another issue. I'm reading an exr file, and the result is not
expected.

Code:
import OpenImageIO as oiio
import os, array

file_dir = 'C:\Users\digi\Pictures\inspiration'
image_path = os.path.join(file_dir, 'test.exr')
image_input = oiio.ImageInput.create(image_path)
image = image_input.open(image_path)
spec = image.spec()

data = array.array('d', '\0' * spec.image_bytes(True))

image.read_image(spec.format, data)

for channel in range(len(data)):
     print(data[channel])


Result:
print: 5.9578290394e-39


On Mon, Mar 11, 2013 at 7:46 PM, Christoph Gohlke <[email protected]
<mailto:[email protected]>> wrote:

    Hi Scott,

    There are some scripts at
    <https://github.com/__OpenImageIO/oiio/tree/master/__src/python
    <https://github.com/OpenImageIO/oiio/tree/master/src/python>> but
    they seem outdated. The "Python Bindings" chapter in the
    documentation
    <https://github.com/__OpenImageIO/oiio/blob/RB-1.1/__src/doc/openimageio.pdf
    <https://github.com/OpenImageIO/oiio/blob/RB-1.1/src/doc/openimageio.pdf>>
    is empty. For now it's probably best to follow the C++ API and/or
    read the source code of the Python bindings.

    Christoph



    On 3/11/2013 7:16 PM, Scott Wilson wrote:

        Hi Chris,

        Looks like it works. Thanks! Is there any more examples or
        documentation
        on the Python bindings?

        Regards,
        Scott Wilson


        On Mon, Mar 11, 2013 at 6:55 PM, Christoph Gohlke
        <[email protected] <mailto:[email protected]>
        <mailto:[email protected] <mailto:[email protected]>>> wrote:

             Hi,

             I think the API recently changed. This works for me:

                         import OpenImageIO as oiio
                         image_input = oiio.ImageInput.create('jpg', '')
                         image =
        image_input.open('oiio-images.____git\\tahoe-gps.jpg')

                         spec = image.spec()
                         print image, spec.width, spec.height

             <OpenImageIO.ImageInput object at 0x00000000029AE7B8> 2048 1536

             --
             Christoph



                 Hello,

                 The following code is throwing me the following error
        while running:

                 import OpenImageIO as oiio
                 import os

                 oiio_path = 'C:\Python27\Lib\site-____packages'
                 file_dir =
        'C:\Users\scott\Pictures\____inspiration\characters'

                 ext = 'jpg'
                 image_path = os.path.join(file_dir, '000g1kzq.jpg')

                 image_input = oiio.ImageInput.create(ext, oiio_path)
                 spec = oiio.ImageSpec()

                 result = image_input.open(image_path, spec)
                 print(result)

                 I get the following traceback:
                 Traceback (most recent call last):
                     File "C:/Users/scott/Desktop/oiio_____test.py",
        line 12, in

                 <module>
                       result = image_input.open(image_path, spec)
                 ArgumentError: Python argument types in
                       ImageInput.open(str, ImageSpec)
                 did not match C++ signature:
                       open(class std::basic_string<char,struct
                 std::char_traits<char>,class
                 std::allocator<char> > filename)

                 I'm using OpenImageIO 1.1.6 64 bit for Python 2.7
        compiled here:
        http://www.lfd.uci.edu/~____gohlke/pythonlibs/#openimageio
        <http://www.lfd.uci.edu/%7E__gohlke/pythonlibs/#openimageio>

        <http://www.lfd.uci.edu/%__7Egohlke/pythonlibs/#__openimageio
        <http://www.lfd.uci.edu/%7Egohlke/pythonlibs/#openimageio>>


                 If anyone could let me know if I am doing anything
        wrong, that
                 would be
                 extremely appreciated. Thanks.

             ___________________________________________________
             Oiio-dev mailing list
        [email protected]
        <mailto:[email protected]>
        <mailto:Oiio-dev@lists.__openimageio.org
        <mailto:[email protected]>>
        
http://lists.openimageio.org/____listinfo.cgi/oiio-dev-____openimageio.org
        <http://lists.openimageio.org/__listinfo.cgi/oiio-dev-__openimageio.org>

        <http://lists.openimageio.org/__listinfo.cgi/oiio-dev-__openimageio.org
        <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>>





        _________________________________________________
        Oiio-dev mailing list
        [email protected]
        <mailto:[email protected]>
        http://lists.openimageio.org/__listinfo.cgi/oiio-dev-__openimageio.org
        <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>

    _________________________________________________
    Oiio-dev mailing list
    [email protected] <mailto:[email protected]>
    http://lists.openimageio.org/__listinfo.cgi/oiio-dev-__openimageio.org
    <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>




_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to