Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] Some questions about 2D iteration
From: Nicolas Lelong (rotoglup_at_[hidden])
Date: 2010-04-07 02:39:41


Brett,

For your first question, it's probable that using 1d iterators would not
speed things, as they're less performant for 2d traversal. To gain some
speed, you could try storing the results of 'src.height()' and
'src.row_end(y)' into variables, this would allow the compiler to know for
sure that these values are constant.

Also note that using numerical values are not really a problem for your
algorithm reusability : you could feed it with, say, a view transformed with
'flipped_up_down_view<http://www.boost.org/doc/libs/1_42_0/libs/gil/doc/html/g_i_l_0163.html>'
so it could operate bottom-up, and so on.

For your second question, I'd look at creating a 'subimage_view' from your
source view, and then use 'copy_pixels' to copy it to your destination
image. This should be pretty close to optimal gil usage.

Cheers,
Nicolas.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net