 |
|
|
| © Copyright 2007 Parallax69 Software International, All rights reserved.
|
|
|
Raster to Vector Conversion -- Vectorization
Vectorization is a process of transforming raster images to vector drawings. A raster image is formed from pixels, like the picture obtained from a scanner, or the screen image on a computer monitor. It has a finite amount of detail which is dependant upon the image size and resolution. The closer magnification of a raster image the courser it appears.
A vector document is stored as a collection of geometric objects, such as lines and arcs, which are drawn between specific coordinates. A closer vector document magnification reveals details more accurately and the line edges stay smooth. Vector drawings are used in CAD (Computer Aided Design) and GIS (Geographical Informations Systems) and other applications where accuracy is important.
Thus, a raster to vector conversion translates a raster image into the corresponding vector image.
Due to the inherent lack of precision in a raster image, output from raster to vector conversion can vary widely in determination of the number of vectors and the positioning of the coordinates. Eroiica employs well researched mathematical methods, and consequently produces very accurate vectors.
Eroiica supports a number of options for manipulating raster images. For some images using these options prior to vector extraction will result in more desirable vectors:
Conversion of Color to Grey Scale
Conversion of color to grey scale will convert any colours in the raster image to the corresponding grey intensity. Vectorization may produce poor results for images which were scanned in colour. Converting the color image to grey scale prior to vectorization may improve the resulting vector output. Furthermore, the vectorization methods may produce slightly different results due to their determination of which pixels are important and which are 'background'.
Negation
Negation changes all the colors in the image to their corresponding 'photo' negative colour. This is useful for a scan of a blueprint or other negative type original, where the lines are lighter in colour than the background. Also, a negative image can be useful for the simple Edge Detection method when using a black and white raster - if you negative the image prior to performing the simple edge detection then you will get the outer edges of objects rather than the inner edges.
Adjusting Brightness
Altering the brightness of a raster image can have a dramatic effect on the vectorization methods because it will change some pixels to background intensity, or vice versa.
Despeckling
Despeckling produces an image free of clusters of pixels which are surrounded by background intensity pixels up to the size specified. The despeckle function is useful for cleaning up a dirty scanned image where there are dark speckles which are not part of the desired image. Performing vectorization on a despeckled image produces more accurate vectors and smaller vector documents with fewer vector entities.
Stages of Vectorization
In order for Eroiica to extract vectors from a raster image it needs to determine which parts of the image constitute lines, and where those lines start and end. For example, the lines may be fairly obvious to a human observer, until the image is magnified, at which point it may be seen that the lines are several pixels wide, uneven along the edges and fade out into the background.
Eroiica provides four vector extraction methods, each utilising different mathematical algorithms and producing different results:
- Emphasize Curved Lines (Stentiford Method)
- Emphasize Straight Lines (Zhang/Suen Method)
- Inner Edge detection
- Canny Edge detection
The Stentiford and Zhang Suen methods produce lines at the centre of thick regions, whereas the Inner and Canny Edge methods produces lines at edges of thick regions.
The Stentiford method tends to produce lines that follow curves very well, resulting in vectors that most accurately reflect the original image.
The Zhang Suen method tends to be better at extracting straight lines from a raster, so may result in more desirable vectors from an original image which comprises mainly straight lines.
The Edge Detection methods look for edges of objects and are useful for images with solid regions whose outlines need to be vectorized. These methods work best for images with high contrast edges where the boundaries between dark objects and the lighter background are clearly defined.
The Inner Edge Detection is most practical for bi-level images, mostly scanned drawings, as opposed to the Canny method which produces best results vectorizing color images. The Inner Edge Detection method looks indiscriminately for inner edges of all objects and is useful for images with solid bi-level regions. On the other hand, the Canny edge detection method looks also for edges of objects; however, this method is most useful for images with solid color regions where the outlines of the largest regions in a particular area of the image are vectorized.
Depending on the nature of the raster image, edge vectorization can be further refined and fine-tuned by selecting either the Stentiford or Zhang/Suen principles to find objects' boundaries and greatly reduce the number of vector entities needed to vectorize the raster image. Unless Stentiford or Zhang/Suen principles are used, many small vector entities will be produced as the most pixels in the image will be vectorized and polylines will be broken into lines at every point that is not a straight line. The Canny method uses a lot of memory during processing so may not be appropriate for very large rasters, or if memory is low. Unlike the Canny method, Inner edge detection process uses no additional memory, is faster and most exact. However, this method produces the largest number of small entities and creates large output documents.
The Canny method employs more mathematics than the Inner Edge detection method as it attempts to find boundaries between poorly defined objects as well as hard edges. There are optional settings which can improve the results in finding boundaries between these poorly defined objects and hard edges:
- Determining color intensity of edge pixels
- Determining the low and high threshold of edge pixels
To locate edges of color regions as accurately as possible, additional edge analyses are performed. The first analysis calculates the color intensity of pixels at the found edge using Gaussian Standard Deviation. This value determines the spread of pixels over which an edge will be tested. The lower the value, the finer tones of changes in color are detected. The higher this value is, the more color smoothing is applied. For a black and white image, or an image with very obvious edges, a set value of 1 will produce good results. For an image with less crisp edges, a set value of 2 or 3 may give better results. For a photograph, or image with smooth changes in tone a set value of 4 or 5 will probably yield best results. The useful range of values is between 0.47 and 5.55. Values outside of this range tend not to produces useful results.
The second analysis determines the low and high threshold of edge pixels. These values are for the post-processing of the edge detection process. The main Canny process produces a large amount of possible edge pixels, each assigned a probability of usefulness. Two values, high and low, are used. The High value determines how high a pixel's probability must be for it be considered a part of an actual edge by the post processing. The Low value determines how low the neighbouring pixel's probability must be for it not be be considered part of the same edge. Therefore, setting High higher reduces the number of edges detected, leaving only the most obvious edges. Setting High lower increases the number of edges produced, but can result in huge numbers of undesirable 'edge' pixels. A value of 50 would be very high and leave only the most obvious edges, whereas a value of 5 allows most of the edges to remain.
Setting Low higher reduces the extent of the edges which are detected, possibly causing the edges to be more broken. Whereas, setting Low lower increases the extent of the edges, but may produces edge lines where edges are not required. This value does not need to be set higher than the High value. This value should be left fairly low (about 3) unless the edges extend further than required.
There is one further possibility: setting the High and Low value to zero and letting Eroiica examine the pixel probabilities over the entire image and calculate its own best values for High and Low. This will usually yield reasonable results, but often, the best results can be obtained by experimenting with the values because the best results are rather subjective to the viewer. The useful range of these values is between 0 and 255.
The generated vectors are displayed over the top of the raster image. The vectors will be drawn in red unless the Global Color option under the Options -> Draw menu is reset, in which case the vectors will be shown in the set colors.
|
|
|
|