Boost logo

Boost Users :

Subject: Re: [Boost-users] [gil] Constructing view from locator
From: Nathan Crookston (nathan.crookston_at_[hidden])
Date: 2011-11-10 13:58:54


Hi Mark,

On Wed, Nov 9, 2011 at 2:05 PM, Sapp, Mark <Mark.Sapp_at_[hidden]> wrote:
> Hi All,
> I'm trying to iterate through each pixel in a view and calculate the average
> of the 9x9 pixels surrounding it. I initially tried following the
> convolution example, but it's performance isn't fast enough for my needs. I
> have tried several ways of iterating through the pixels on the 136x98 test
> image provided with the gil:
>
I'm not sure what 'fast enough' is, and without code samples it's hard
to say where a mistake might be made. Traversing the image in a
cache-friendly manner is usually the way to improve performance, but
I'm not sure that such a small image has a truly cache-unfriendly
traversal.

> Can you explain if this is an appropriate way to construct a subview and how
> I can retrieve the locator needed as the 3rd parameter to rgb8_view_t(),
> specifically I need the locator for 4 pixels left and 4 pixel up so that the
> average window is centered on in1/in2? Also, is it possible to get the view
> type from the locator inputs in1 and in2 so that I can change the subView
> instantiantion to in1Type subView1 = in1Type(9,9,in1)?
>
Subimage views are usually pretty simple -- does the usage example in
the following explain it?
http://www.boost.org/doc/libs/1_44_0/libs/gil/doc/html/giltutorial.html#OneDIteratorsSec

It seems like the section on Using Locators and cached locations *might* help.

>
> It seems that the  performance, with regard to speed, is much better using
> transform_pixel or transform_pixel_positions over iterating through the
> pixels myself unless I am doing something incorrect. Are there any other
> programming styles that provide better performance for doing similar
> calculations on groups of pixels?

I'd be happy to give more specific answers if you can provide
compilable examples. Pointing out the GIL image you're testing with
would also be beneficial.

Thanks,
Nate


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