Categories
Raster to Vector Guides

What Tolerances Can You Expect From Raster to Vector Conversion?

It has become a pretty common television trope for investigators to ask their tech experts to “enhance” a blurry photo for a better look at the suspect. Realistically, anyone who has worked with image editing software can tell you how impossible that task is, especially with low-quality raster images.

The same can be said for taking low-quality raster scans and converting them into vector images using dedicated raster-to-vector conversion software. Simply put, the lower the quality of the images, the more likely it is to have inaccuracies in the output vector file.

Of course, state of the art conversion programs such as Scan2CAD can handle any type of image to some extent. Certain settings can even be tweaked to accommodate less-than-ideal raster images and make them as suitable for conversion as they can be.

But when exactly do we consider a raster image too low-quality to be suitable for conversion? And what kind of tolerances should we expect from raster images of different resolutions?

A quick test

We did a quick test to quantify the results somewhat. We drafted up a 1” x 1” square (25.4 mm x 25.4 mm) on our CAD program and plotted that out onto smooth, high-quality paper with our laser printer. After making sure the print had no issues with it, we then took the hard copy of the 1” x 1” square and scanned it at different DPI settings – namely 200 DPI, 400 DPI, and 600 DPI. We then ran the scanned copies through our raster-to-vector conversion program and imported the resulting vector files into CAD. With the square finally going full circle, we compared the initial dimensions – exactly 1” for all sides – to the resulting vector dimensions of our printed, scanned, and converted squares.

Here are the results:

200 DPI 400 DPI 600 DPI
Horizontal dimensions 0.9900000″

– 1% discrepancy

0.9912500″

– 0.00875% discrepancy

0.9908333″

– 0.0091667% discrepancy

Vertical dimensions 1.0000000″

0% discrepancy

0.9987484″

– 0.0012516% discrepancy

0.9981235″

– 0.0018765% discrepancy

The vertical dimension at 200 DPI was our most accurate result at exactly 1” with 0% discrepancy. On the other hand, our least accurate vectorized output was the horizontal dimension of our 200 DPI scan at 0.99″ with a -1% discrepancy. With this small test, we’ve found the results to have errors between 0” and 0.01” with an average of – 0.99482586” variation.

Now we say this is a small test because you’re going to need a lot more data samples and more varied settings to have a clearer idea of the exact tolerances of raster to vector conversion programs. But for the purposes of this article, it would be safe to say that tolerances up to thousandths of an inch are infeasible and tolerances of hundredths of an inch are right at the threshold of satisfactory results.

Additionally, the test and results above are done in ideal conditions. That is, we knew the exact original measurements of the square, the drawing was as simple as it gets, and there was very little room for error as it was. Standard scanned drawings are much higher-quality and are oftentimes larger than just 1” by 1”. Not to mention, a lot of technical documents have plenty of intersecting and overlapping lines and complex, graphics-heavy diagrams and plans. The more balls in play, the higher the chance for error along the way.

Potential issues to keep an eye out for

Hardware limitations

Making sure your scanner settings and setup is important. However, it’s even more important to make sure that the original print was executed properly. Any skewed image proportions and stretched out dimensions, or clipped parts of the drawing performed by the printer will have a significant effect on the vectorized output.

The quality of any scanned hard copies

When scanning a hard copy of a technical plan or image, make sure to check for any stretching or shrinking of the copy while it was in storage. This is especially true for hard copies that are either dated, not stored properly, or have undergone moisture damage. Other common defects that would affect vectorization quality are any fold marks, coffee and water stains, and rips or tears.

Shades and shadows

Although definitely still an issue for scanned drawings, shadows are a more common issue when trying to vectorize photos of physical objects, templates, or drawings taken by cameras. Any shadows touching dark objects or boundaries in the document will be interpreted by conversion software as part of those objects and boundaries.

When taking a photograph for conversion purposes, try to keep the object on a background with a contrasting color (e.g. white paper on a black table) so that any shadows on the background will be easier to distinguish from the elements on the paper. Also, make sure the lighting is set up appropriately such that there are minimal shadows.

Perspective distortion

As with shadows, this is a more common issue for any camera photos. If the plane of the camera is not perfectly perpendicular to the object or if the object is too large compared to the field of vision of the camera, there will be some amount of perspective distortion. That is, any part of the object further away from the camera will appear smaller than the parts nearer the camera. Obviously, this poses a problem for dimension accuracy. The best remedy to this is to use telescopic lenses and take photos from further away.

Scanner calibration

Scanners made for larger formats will have problems with accuracy when not calibrated regularly. Additionally, different types of paper and different default scanner settings will result in varying scan speeds that might create small errors along with the document’s scan. As such, it is important to use the appropriate scanner for your document size and type and that calibration is done frequently.

Document placement

An easily fixable but nonetheless common issue is the alignment of a scanned document and how level it is. It gets easier to be more haphazard in scanning documents when taking care of bulks of them, but always try to be cautious when placing the document on the scanner.

Threshold settings

When converting images from raster to vector, the first step for most document types would be to turn the image black and white. During that process, you can adjust what is called the threshold setting. This setting determines how dark a pixel has to be before it is turned black. That is, a gray pixel will be more likely to be converted into black rather than white if the threshold setting is high.

Thresholding is extremely important since it determines your raster lines and boundaries and which parts of the image to turn black. Take into consideration the following images:

a scan of a spanner
a) A scan of a spanner Source: Own image
a zoomed-in view of the head of a spanner. The edges are slightly pixelated and blurry.
b) A zoomed-in view of the head of a spanner. The edges are slightly pixelated and blurry.
the black and white version of the image with a threshold of 100
c) The black and white version of the image with a threshold of 100. The vectorized version of the image is overlaid on top. Notice the “holes” where the threshold setting made the pixels turn white.
The black and white version of the image with a threshold of 250
The black and white version of the image with a threshold of 250. The vectorized version of the image is overlaid on top. Notice that the “holes” are now filled up and the boundaries of the spanner silhouette go out farther.

Scan resolution

As indicated in our earlier test, the DPI setting of your scan is important in making sure the output is accurate. The smaller the DPI, the larger the effects of any little discrepancy. So as much as possible, you would want to go with higher DPI settings.

Conclusion

Do note that even though our test results showed that toleranced can be within a hundredth of an inch, this margin of error might not be acceptable for highly precise technical drawings. However, with careful calibration and a little bit of post-editing CAD-work, raster to vector conversion can be a big time-saver when it comes to vectorizing any raster copies of drawings.