Boost logo

Boost :

From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2008-06-16 11:59:43


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


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