[gil] Constructing view from locator
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:
attempt #1 executes in ~400 ms
convolve_rows_fixed
Hi Mark,
On Wed, Nov 9, 2011 at 2:05 PM, Sapp, Mark
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#OneD... 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
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
Subimage views are usually pretty simple -- does the usage example in
Hi All I realized the major performance issue was because I was building in debug mode. I wasn't aware of the performance difference. It make sense now that I know :). I'm not sure if that is documented somewhere but it would be a good note at the beginning of the user guide. traversal. Fast enough means I need to process 1080p60 video in realtime and 1080p120 video in near realtime. I don't have specific performance metrics of the code I've written yet, as I'm still working things out, but I will keep you posted if interested. the following explain it?
http://www.boost.org/doc/libs/1_44_0/libs/gil/doc/html/giltutorial.html #OneDIteratorsSec
This specific code example was very helpful, I missed it when searching the online documentation to answer this question. I have some other unrelated [brief] questions I will send in a new thread. Thanks, Mark Notice: This e-mail is intended solely for use of the individual or entity to which it is addressed and may contain information that is proprietary, privileged, company confidential and/or exempt from disclosure under applicable law. If the reader is not the intended recipient or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If this communication has been transmitted from a U.S. location it may also contain data subject to the International Traffic in Arms Regulations or U.S. Export Administration Regulations and cannot be disseminated, distributed or copied to foreign nationals, residing in the U.S. or abroad, without the prior approval of the U.S. Department of State or appropriate export licensing authority. If you have received this communication in error, please notify the sender by reply e-mail or collect telephone call and delete or destroy all copies of this e-mail message, any physical copies made of this e-mail message and/or any file attachment(s).
participants (2)
-
Nathan Crookston
-
Sapp, Mark