Retrieving the outermost pixel border of a raster image

Discussion created by smjohnson1790 on Mar 10, 2014
Latest reply on Mar 24, 2014 by Hornbydd

I want to read all the outer pixel values of an image - i.e. one pixel in from each of the edges and I'm not interested in any of the pixel values within this one-pixel border.

I've tried too approaches

1. Call IRaster::GetPixelValue for each of the edge pixels.

2. Using a raster cursor (i.e. iraster::CreateCursorEx). This involves iterating though all the blocks in a raster image and then working out which are the edge ones. It's not possible using the cursor interface to skip to the "edge" blocks as it forces you to use the "Next" method to iterate through every block.

Both methods are really slow for a large image - although the 2nd approach is quicker.

Is there a way of efficiently retrieving just the outer edge of pixels.

Many thanks in advance