# Subsampler

Generate an output image where the input image has been reduced in resolution and size. Subsampling can allow other vision tools to operate faster on the reduced image, although reducing the image size can result in less accuracy. The Subsampler operation provides two types of algorithms for generating the output image.

The first algorithm divides the input image into blocks of pixels and copies the pixel at the center of the block into the output image. If the block contains an even number of rows or columns, the operation copies the upper-left pixel closest to the center of the block. The following figure demonstrates subsampling with a 3x3 block:

The second algorithm the Subsampler operation offers is spatial averaging, which divides the input image into blocks of pixels, determines the average grey value of the pixels in each block, and places that average into the output image. The following figure demonstrates spatial averaging with a 2x2 block:

Between the two algorithms, the subsampling operation executes faster, but the spatial averaging algorithm offers a higher degree of accuracy.

Note: If you specify an even number for the subsampling rate and you do not use spatial averaging, the tool selects the pixel above and to the left of the center of the sampling area. This introduces a one-half pixel shift in the locations of features in the sampled image. The tool automatically adjusts the output image coordinate space tree by shifting the coordinate space by one-half pixel. Because spatial averaging averages pixel values evenly across the sampling area regardless of its size, no such adjustment is performed when spatial averaging is enabled.