
Michael, here is my version of your algorithm. Please have a look: std::vector<float> buffer( 1024 * 1024 ); //GenerateNoise( pBuffer, 1024, 1024 ) gray32f_view_t src = interleaved_view( 1024, 1024 , (gray32f_pixel_t*) &buffer.front() , 1024 * 4 // bytes per scanline ); for( int y = 0; y < src.height(); ++y ) { gray32f_view_t::x_iterator src_it = src.row_begin( y ); float ycopy = y; if(y > 511) { ycopy = 511 - std::abs( 512.f - ycopy ); } for( int x = 0; x < src.width(); ++x ) { float xcopy = x; if(x > 511) { xcopy = 511 - std::abs( 512.f - xcopy ); } src_it[x] = src[xcopy][ycopy]; } } I haven't really tested it, though. Most of the code you find in the gil tutorial: http://stlab.adobe.com/gil/html/giltutorial.html Christian On Mon, Jun 16, 2008 at 11:59 AM, Michael Marcin <mike.marcin@gmail.com> wrote:
Hi,
I've found a small block of adhoc image manipulation code written by someone in my current project.
std::vector<float> pBuffer( 1024*1024 ); GenerateNoise( pBuffer, 1024, 1024 ) int n = 0; for(int y=0; y<1024; y++) { for(int x=0; x<1024; x++) { int xcopy = x, ycopy = y; if(x > 511) xcopy = 511 - CMath::Abs(512 - xcopy); if(y > 511) ycopy = 511 - CMath::Abs(512 - ycopy); pBuffer[n] = pBuffer[ycopy*1024 + xcopy]; n++; } }
This takes the upper left corner and copies it to the upper right flipped horizontally, lower left flipper vertically, and lower right flipped horizontally and vertically.
The code is poorly written but instead of trying to clean it up myself I thought this would be a good opportunity to learn to use gil.
I think to get started I first need to create a gil image view from the raw data. Is this right?
I looked at the image view from raw data function in the doxygen documentation but I don't see any for 1 channel data image data. Am I missing something?
Thanks,
Michael Marcin
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost