Scan2CAD includes two types of thresholding – simple and adaptive. You can use these to:
When you scan a drawing in monochrome your scanner or scanning software has to make a decision about which parts of the drawing to set to black in the raster image and which to set to white. Thresholding is a method for making this decision.
About simple thresholding
Every color has a numeric value. In a simple threshold you choose a single color value, the threshold. All colors with color values lower than the threshold are set to black and all colors with color values higher than the threshold are set to white.
The aim is to set a threshold that does the best possible job of separating the foreground (the drawing) from the background. After thresholding, the lines on the drawing should be as solid as possible and the background should contain as little dirt as possible.
If you set a threshold that is too low the lines on the drawing may break up or disappear altogether.
If you set a threshold that is too high, text characters may “bleed” so that white spaces within them or between them become filled, speckles and dirt may appear in the background or the image may become completely black.
Simple thresholding works well on images where the darkness of the drawing and the darkness of the background are consistent across the image.
It works less well on images where the darkness of the drawing and the darkness of the background vary across the image, because there is less likely to be a single value that neatly divides the image into foreground and background. A threshold that sets darker parts of the background to white is also likely to set faint parts of the drawing to white (a below). A threshold that sets faint parts of the drawing to black is also likely to set darker parts of the background to black (b below).
About adaptive thresholding
If you have an image where the darkness of the drawing and the darkness of the background vary you will probably need to use adaptive thresholding.
Adaptive thresholding works on the same principle as simple thresholding but instead of using one threshold value over the whole image, the image is divided up into local areas and a different threshold value is used in each local area. The threshold is calculated automatically using the color values in the local area.
In an adaptive threshold you choose two values, the Window and the Background. The Window affects the size of the local areas that the image will be divided into. The Background is a constant that is subtracted from the threshold in each local area. The higher the Background, the more color values in each local area will be set to white.
See Adaptive Threshold for the best way to select Window and Background values when doing an adaptive threshold.
Have questions on this topic? Talk to us