From: Ullrich Koethe (u.koethe_at_[hidden])
Date: 2001-11-15 14:54:34
Peter Dimov wrote:
> > that allocates a contigous block of memory, and considers stretches of n
> > values as one pixel. The iterator would then return an appropriate proxy
> > that implements the required interface on top of this. (Which brings me
> > to proxies, who would warrant a discussion of their own...)
> Ah, I see. In effect I'd have to define a 'virtual image' with the
> appropriate accessors. But how would the import function know how to create
> my custom 'virtual image' when importing an 11-channel .PSD?
The general approach is this:
// read image header information
// create appropriate images
VectorImage vimage(info.width(), info.height(), info.bands());
MultibandImage mimage(info.width(), info.height(), info.bands());
// import the image using iterators and accessors, so that
// the target's storage format is transparent.
In the worst case, an intermediate copy of the image data is created.
But since VIGRA uses mostly external libraries for import, this happens
anyway. In your case, the overhead might not be acceptable, of course.
> And if I go to these lengths wouldn't it be easier for me to create a band
> image. ;-)
Probably, but the difference isn't great.
The right format depends on the question whether an application uses
mainly in-band or accross-band operations. For example, consider the
satellite people: They often classify terrain by looking at a single
pixel's intensity signature over 10 spectral channels. Then cache
locality, and thus performance, is better in a non-banded format.
-- ________________________________________________________________ | | | Ullrich Koethe Universität Hamburg / University of Hamburg | | FB Informatik / Dept. of Computer Science | | AB Kognitive Systeme / Cognitive Systems Group | | | | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 | | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg | | Email: u.koethe_at_[hidden] Germany | | koethe_at_[hidden] | | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ | |________________________________________________________________|
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk