From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-11-16 09:54:58
From: "Fernando Cacciola" <fcacciola_at_[hidden]>
> From: Peter Dimov <pdimov_at_[hidden]>
> > > AFAIK, encoding schemes are different for color and bi-tonal (binary)
> > > images.
> > Which encoding schemes? linear, packed, RLE, huffman, LZW can be applied
> > elements of any size.
> This depends on how you interpret the meaning of 'being' a encoding
> That is, bi-tonal econdings exploit the fact that the image has only two
> tones, not only the redundancy of the data.
> For example, the RLE used for binary images is not exactly the same as the
> RLE used for color drawings.
> The former stores only the run length, while the last stores also the
> of the run.
> Binary images use truncated/modified huffman encondigs, again using the
> that these images have just two possible transitions.
I agree. But whether an image is bitonal is determined by the element type.
'bool' has two possible values, and hence a basic_image<bool> is bitonal.
You could define a type that has four possible values, and it will produce
an image with four levels.
It is true that basic_image<bool, rle> can use a specialized form of RLE
that exploits the fact that there is no need to store an element value. This
can be accomplished in various ways. One option is to make 'rle' simply a
type tag that determines the storage policy. Another is to templatize the
storage policy on the element type: basic_image<bool, rle<bool> > (or if you
want to be on the cutting (modern) C++ design edge, use a template template
parameter for the storage policy.)
> I'm not against the "pixel representation"/"enconding" orthogonality.
> I'm against blurring the distinction between color and binary images.
There is no inherent distinction between the two. An image is a
two-dimensional array of element (tuples.) When the element (tuple) is a
simple bool, this is a bitonal image.
This allows generic algorithms to still operate on bitonal images
unmodified, while in the same time allowing you to replace some with
> I don't understand what's the problem with the distinction between a color
> and a binary image.
There is none (problem, that is, not distinction.) A binary image is a
special case of an image.
> Most of the image processing literature makes that distinction clear:
> a color image contains an arbitrary number of colors, maybe two;
> while a binary image is restricted to 2 colors and thus this fact is
> exploited by the representation and the algorithms that operates on it.
This is a dangerous definiton of a binary image since it means 'a paletted
image with a palette size of 2.'
I don't know whether VIGRA will (or should) handle paletted images.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk