Boost logo

Boost :

From: Ullrich Koethe (u.koethe_at_[hidden])
Date: 2001-11-14 12:43:33


Michiel Salters wrote:
>
> Not bad at all.
>
> I do think we should have a good review, from a C++ point of view. E.g.
> Having
> members "Iterator" instead of "iterator" doesn' t affect the image
> processing part,
> but it makes it a bit harder to treat an image as just another container.
>

I have thought about this a lot. Currently, the names are different
because the concepts are in fact incompatible.
std::vector<...>::iterator is a 1D iterator, while
vigra::BasicImage<...>::Iterator is 2D. The names remind me of the
difference. It would be consistent with the STL to rename
vigra::BasicImage<...>::ScanOrderIterator into
vigra::BasicImage<...>::iterator because this iterator is in fact 1D.
But then the 2D iterator should be renamed as well to avoid confusion.
What would be intuitive names?

> Having worked in the Image Processing group at Delft University, I know from
> experience
> that having operator+ on images is liked very much; having to write (in C)
> AddImg( &img1, &img2, &img_dest ) was seen as a bad thing. Those people
> won't like
> having to use std::transform and std::plus.
>

This is also something I have thought about a lot. The basic problem is
that a naive implementation of the arithmetic operators creates lots of
temporary images. This can be overcome by means of expression template
techniques as used in Blitz. However, this is quite involved and doesn't
work on all compilers. Given that image arithmetic constitutes only a
small part of an image algorithm (much less than in linear algebra) I
decided that transform(), along with a lightweight lambda library, would
be suffucient. So you can write

   // gradient magnitude
   combineTwoImages(srcImageRange(gx), srcImage(gy), destImage(gradMag),
                    sqrt(Arg1()*Arg1() + Arg2()*Arg2()));

> In the list of common image types, perhaps the most common pixel type is
> missing: bool.
> However, given the annoyance caused by std::vector<bool>, this is a type we
> should give
> proper attention. Here I can't come up with an easy fix.
>

I think that the savings in memory consumption don't justify the extra
trouble. I'm using BasicImage<unsigned char> for binary data as well and
haven't had problems. But different applications may certainly change
the picture.

Regards
Ulli

-- 
 ________________________________________________________________
|                                                                |
| 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, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk