From: Michiel Salters (Michiel.Salters_at_[hidden])
Date: 2001-11-19 04:52:39
> -----Original Message-----
> From: Ullrich Koethe [mailto:u.koethe_at_[hidden]]
> Sent: Thursday, November 15, 2001 8:41 AM
> Subject: Re: [boost] VIGRA - Image processing for boost
> Michiel Salters wrote:
> > > -----Original Message-----
> > > From: Ullrich Koethe [mailto:u.koethe_at_[hidden]]
> > > Sent: Wednesday, November 14, 2001 9:44 AM
> > > Subject: Re: [boost] VIGRA - Image processing for boost
> > >
> > > Michiel Salters wrote:
> > > > 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
> > I know some of the people within the image processing group
> > were working on 1<<28 bits of map data (B/W); having to use
> > 1<<28 bytes wouldn't be fun.
> > I don't want to say that because of their needs,
> > image<bool> should be packed;
> > but if it isn't that should be clearly stated.
> > Perhaps there should be two image types ?
> Providing two image types would be easy, but I have doubts whether it
> will buy much. Consider the possibilities:
> * Image<bool> is unpacked. Than you can just as well use Image<byte>
That's untrue; Image<unsigned char> has (should have) operator+ and
operator&& with semantics differing from Image<bool>. Furthermore,
you can't pass a pixel of Image<unsigned char> to foo( bool& ).
> * Image<bool> is packed. Then you will very likely want to use
> algorithms optimized for packed data, e.g. filters that process 32 bit
> in parallel. However, I haven't found a way to provide this
> generically. And rewriting all algorithms would be a lot of work. Of
> course, you could process the data bit-by-bit with the existing
> algorithms, but this might be slower than using unpacked data.
> Any ideas?
Well, this is the same problem as with vector<bool>: Even the standard
doesn't provide algorithm specializations for vector<bool>::iterator. I do
think that the needs of image processing on 1-bit images warrant
writing these specializations, at least for basic operations. Complex
algorithms should be based on simple operations; let the compiler do
E.g. edge finding can be done by shifting an image over 1 pixel, and
XORing the original & shifted image. The shift & XOR could be
specialized for packed & unpacked 1-bit images, but the generic
edge find doesn't have to be.
Of course, one of the advantages of boost / open source is that you can
just leave such work to the first person who needs it done.
No money == much less obligations.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk