# Sampling Tool Parameters

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

Note:

- The Detail, Border Type, Masking Mode and Centered parameters are only available when Expert Mode is enabled. This is enabled via the Help menu.
- The Detail parameter is only available with the Blue Locate Tool.
- 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.
Detail | Specifies how much focus the Blue Locate tool should place on the area within the feature graphic, versus the area surrounding the feature label. The available settings are values 1 through 4. When this parameter is enabled and set to 4, the tool will focus attention on learning more about the area inside the labeled feature size graphic, and place limited emphasis on the context region surrounding the graphic. When this parameter is enabled and set to 1, the tool will focus attention on both the context and the area inside the labeled feature size graphic, though less emphasis will be placed on the detail inside the labeled feature size graphic. Settings 2 and 3 place varying degrees of emphasis between the two extremes of 1 and 4. Note: For more information about the way the tool samples images based on feature size, see the Feature Size topic.
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.