# Sampling Tool Parameters

The Sampling tool parameters control the way that images are sampled during training.

Note:

- The Border Type, Masking Mode and Centered parameters are only available when Expert Mode is enabled. This is enabled via the Help menu.
- The Centered parameter is only available with the Red Analyze Tool.
- Changes to the Sampling parameters after a tool has been trained will invalidate the training, because the underlying image statistics may be fundamentally changed, which will necessitate retraining the tool.

Parameter | Description
--- | ---
Feature Size | Specifies the typical feature diameter, in pixels. The Feature Size parameter is graphically displayed in the lower left of the image, and can be graphically resized within the image to set a more accurate size. Feature size strongly influences processing time (n2 ), i.e., a Feature Size of 100 is 100 times faster than a size of 10, while a Feature Size less than 15 usually does not yield good results. When setting the Feature Size, consider the following in regards to Processing time (Ptime): Note: The tool will actually see an area five times larger than the Feature Size setting. However, the level of detail will be much higher in the center of the feature, as opposed to the periphery. For the Blue Read Tool, the Feature Size is two-dimensional, Width x Height.
Color | Specifies the number of color channels to use when sampling the image. When set to 1, color images will be converted to greyscale. Treats the image as greyscale Two channels images (spectral images, gray+alpha) BGR image. BGR(A) image Note: If the image is RGB(A) it will be converted to grayscale. For computational efficiency (memory allocation, transfer, file save, color conversion,… ) always prefer the correct number of channels. The ViDi tools use the BGR channel order. If your application relies on color images, only use the minimal number of required color channels possible, and only send images that already have the correct number of channels to avoid conversion. This is because:
Number of Image Channels | Number of Training Channels | Description
--- | --- | ---
1 (greyscale) | 1 | The correct setting for a greyscale image.
1 | 2, 3, 4 | Most likely, this will result in a training error.
2 | 1 | The tool will use only the first channel.
2 | 2 | The tool will use the full pixel information.
2 | 3, 4 | This will result in a training error.
3 (BGR) | 1 | This will result in a BGR to greyscale conversion.
3 | 2 | The tool will only use the first two channels (i.e. B and G).
3 | 3 | The tool will use the full pixel information.
3 | 4 | Most likely, this will result in a training error.
4 (BGRA) | 1 | This will result in a BGRA to greyscale conversion.
4 | 2 | The tool will only use the first two channels (i.e. B and G).
4 | 3 | The tool will only use the first three channels (i.e. B, G and R).
4 | 4 | The tool will use the full pixel information.
- Border Type* | Specifies how pixels on the outside of the image are sampled. Tip: Adding an additional mask at the boundaries of the image highly reduces the false detection rate. Black: Fills the outside of the image with solid color.
  Black Fill
Replicate: Fills the outside of the image with the last pixel.
Masking Mode* | Specifies how a mask will be applied to the sampled image. A mask is used to limit areas of the image processed by the tool. Masks can be set after training, however, setting them prior to training will help the learning phase. Transparent: The mask will not be applied. Mask: The mask is used to ignore the areas which are masked. Overlay: The mask is added to the sampled image as an additional color channel.
Centered* | Used with the Red Analyze Tool, this parameter can be used when your inspection contains objects that have a circular symmetry in respect to the center of the view, such that the resulting learned model becomes simpler because the object can be virtually unrolled.