Think of an ImageInput as a file handle. Its primary purpose is to read from
the file incrementally (for example, telling it, "read pixels of scanline Y
into my memory *here*"). It hides all the details of what kind of file it is,
presenting a single interface no matter what image file format you are reading
from, and does data conversion for you, and so on.
Think of an ImageBuf as a representation of a whole image -- a rectangular
array of pixels. You can initialize it from a file, or you can populate it with
values that you compute. But mainly you deal with conceptually as a whole
image, or the pixel values it contains, and it totally hides from you the
memory management and I/O.
An ImageSpec describes everything about an image except the pixel values; that
is, the dimensions, data types, channel names, any metadata associated with the
image. So you can read it from an open ImageInput ("what's the description of
the image in this open file that I'm reading from?") as well as from an
ImageBuf ("what's the description of the image that you are storing in
memory?").
DeepData is just a handy (and as simple as possible) data structure for holding
"deep" pixels -- ones where each pixel may hold multiple values, each
associated with its own depth value, and possibly differing in number from
pixel to pixel. Deep images don't really fit into the usual mold of a
rectangular array, so we use this data structure to represent it in memory.
If you have read a deep image into an ImageBuf, you can get a pointer to its
underlying DeepData with the ImageBuf::deepdata() method.
You can't "get an ImageBuf from an ImageInput", but you shouldn't need to.
ImageBuf is a higher level concept that totally hides the I/O from you (though,
in fact, if it needs to read from an image file, it does use an ImageInput to
do it).
> On Dec 7, 2016, at 9:52 PM, Ben Andersen <[email protected]> wrote:
>
> Can someone articulate the precise differences between them? I can sort of
> understand the difference between ImageInput and DeepData, but:
>
> * Why can I instantiate an ImageBuf from a file path?
>
> * Why can I grab a spec() from both ImageInput and ImageBuf?
>
> * Is there a way to go from ImageBuf to DeepData?
>
> * Is there a way to get an ImageBuf from an ImageInput?
>
> Thanks
> Ben
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org