Boost logo

Boost :

From: Lubomir Bourdev (lbourdev_at_[hidden])
Date: 2006-10-23 18:06:44


> Both items taken together, what do you think about the following idea:
> model GIL's core functionality according to
> DataAccessor/Iterator, and provide an STL-style
> RandomAccessTraversalIterator as a wrapper on top of that?

Hi Thorsten,

As a user of GIL I don't see why you should care if it internally uses
DataAccessor/Iterator or STL-style iterators. All you should care about
is how easy it is to use and extend GIL. In particular, if you have a
DataAccessor+Iterator can you make easily from it a GIL iterator and
image view?

For immutable DataAccessors, it is trivial. You can think of GIL's
PixelDereferenceAdaptor almost like a DataAccessor.
It has an application operator that takes anything you want (for example
a pixel reference) and must return something convertible to
PixelValueConcept.

To attach a PDA (PixelDereferenceAdaptor) to a given View, you simply do
this:

typename View::add_deref<PDA>::type newView
   = View::add_deref<PDA>::make(myView, myPDA);

That's it! Now if you want to save the even pixels of the first channel
of the view, and apply your custom transformation, you do this:

jpeg_write_view("out.jpg",
      subsampled_view(nth_channel_view(newView, 0), 2,2));

With the DataAccessor/Iterator style, piping of views is not as nice.
You will have to duplicate the piping chain for the accessor as well:

jpeg_write_view("out.jpg",
      subsampled_view(nth_channel_view(newView, 0), 2,2),
      subsampled_accessor(nth_channel_accessor(newAcc, 0), 2,2));

Adapting a mutable DataAccessor requires a bit more work, and we can
certainly add some utilities to make it easier, but I am having a hard
time thinking of a practical example where you need this.

Thorsten wrote:
> From how it appears to me (and what you and others stated), GIL's
> selling points are currently pixel and image view
> abstractions, not so much the actual algorithms. As a user, I
> don't have too much use for that, I'm more interested in
> turn-key solutions like a Canny edge detector...

Ulli also wrote:
> Yes, images alone are not of much use.

Please don't forget that computer vision is a niche domain. There is a
much broader domain of basic image manipulation, like loading an image
from file and converting it to a format that your window manager can
display, or making a thumbnail out of an image.

Far more people need basic utilities like the above. People like you who
need a Canny edge detector, or even know what it means, are a minority.

Lubomir


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk