THE TECHNIQUE OF HOMOTOPIC SKELETONIZATION OF BIT-MAPPED DRAWINGS OF PARTS OF SEA TRANSPORT

Context. Skeletonization is used in image processing of technical drawings, including drawings of sea transport parts, since the object’s skeleton reflects its topological structure. Сomparative analysis of the best methods of parallel topological skeletonization of the area objects, using spatial masks, showed that they give iterative distortions to the topology of primitives and their compositions. Therefore, the task of developing a technique for homotopic skeletonization of bit-mapped drawings of sea transport parts is relevant. Objective. To develope technique of improvement of topological equivalence of the skeletons to the сontour of sea transport parts, by means of gradual correction of typical skeleton’s distortions. Method. Сorrection of skeleton’s iterative distortions by modified spatial masks of the basic method of skeletonization and the reconstruction of the resulting skeleton by masks to restore its homotopy to the original, on the basis of developed reconstruction rules. Execution of the proposed technique was carried out on example of the basic method R.Y. Wu & W.H. Tsai. Results. The proposed technique is implemented as a program application that allows to perform quality skeletonization of images of drawings of sea transport parts. Conclusions. The shown examples of results of skeletonization of drawings of parts confirm efficiency of the proposed technique. The technique can be adapted to the methods of topological skeletonization of area objects, based upon application of spatial masks.


NOMENCLATURE
ACCURACY -measure of quality assessment, the proportion of points for which the right decision was obtained; INTRODUCTION Skeletonization is widely used in solving many tasks of image processing when creating electronic archives of drawings of sea transport parts. The advantage of the skeletons of objects is that they store information about the topological structure and simplify algorithms for processing drawings. Thus, skeletonization improves the efficiency of the processing of electronic archives of drawings, making the task discussed in the article relevant.
The main drawbacks of the existing methods of skeletonization are the distortions of the geometric primitives of the contour and their conjugations, as well as the connectivity of the contour. Therefore, the study goal is to develop a method for topological skeletonization of drawings that ensures the homotopy of the resulting skeleton to the original contour by correcting typical distortions.
A substantial increase of skeleton's structural correspondence to the part's mask is reached by gradual application of the developed set of methods: -at the first stage at iterative thinning of a part a correction of iterative distortions of skeleton with modified masks of the basic method of skeletonization is performed; -at the second stage, after the entire skeleton has been obtained, reconstruction of the skeleton is performed with restoration homotopic masks, on the basis of the developed instructions for reconstruction of distorted zones of intersections of geometrical primitives.
Correction of the skeleton is supposed to be performed with the aid of the designed masks, in accordance with the following principle: -the aperture of a "simple" dot, removed by a basic method is compared to the nuclei of the developed set of correcting and restoring masks with a possibility of their turning by angles, divisible by 90 ; -in case of coincidence of the dot's aperture with the nucleus of any mask the skeleton is corrected, in accordance with the developed instructions for adoptions of solutions, specific for each type of skeleton's distortions.

PROBLEM STATEMENT
The original binary image is understood as some rectangular binary matrix of dimension W× H. The element of this matrix takes the value 0 if the corresponding point of the image is painted white. Otherwise, the matrix element takes the value 1. The original image can contain contours of arbitrary thickness. It is necessary to define the rule for converting a part of the elements of the original matrix with a value of 1 to 0 so that the thickness of all contours becomes 1. In this case, it is necessary to save the topology of the original object and prevent distortion of the object form on the resulting image.
The analysis of merits and flaws of each group of methods showed that methods of parallel iterative topological thinning Rutovitz, Pavlidis, Wu&Tsai et al.), ensuring skeletons of better quality seemed to be most promising in the zone under investigation.
These methods are based on placing spatial masks on the local neighborhood of the points of bit-mapped image with the objective of extracting "simple" dots, extraction of which does not infringe structural similarity and integrity of the skeleton of part's mask [10]. The methods belonging to this group differ in their sets of masks, the criteria of images points affiliation with the skeleton and ways of dots testing on correspondence with such criteria.
Still, from the point of view of the analyzed objects zone, the existing methods possess, in spite of their merits [1, 9,  -distortion of topology of right angles of the skeleton at iterative parallel thinning of part's mask; -in violation of skeleton's connectivity at the process of thinning of part's mask; -in violation of skeleton's topology in the points of intersection of geometrical primitives of the mask; -in sensibility of skeleton's topology to local properties of the mask (thickness, for instance).

MATERIALS AND METHODS
Among the methods of topological skeletonization of objects, when spatial masks are used, Wu R. Y. & Tsai W. H. [18] method, ensuring the best result is of special interest.
The masks, applied in Wu R. Y. & Tsai W. H. method are represented in Table 1.
It is characteristic that these masks contain unused positions with the unidentified beforehand values, hence, allowing variability. The elements of masks nuclei with alternative colors are marked with "?" sign, whilst unused nuclei elements are marked with " " sign.
Application of these positions for reconstruction of distorted skeletons allows ensuring their structural correspondence to part's mask, required in the object's zone. Now, let us consider the proposed methods of restoring homotopic character of the skeleton, generated by the principle method on the example of the method of Wu&Tsai.
Consider the method of correcting distortions of the topology of skeleton's right angles method. The first type of skeleton's distortions is described by iterative violation of the topology of skeleton's right angles (Fig. 1).
To explain the essence of the problem of appearance of such a distortion we shall introduce the required definitions:  In the principle method of thinning the convex angles, masks, using 4-connection «manhattan's» metric are applied, in which distances from the vertex of the convex angle of the mask to the background 1 In accordance with the principle idea of the method, the vertex of the convex angle is considered to be a "simple" point and is removed by { } k a Z masks with one pass. However, vertexes of concave angles in "manhattan's" metric are not boundary points. So, the vertexes of concave angles can't be removed with one pass only with application of { } k a Z , masks, it leading to distortion of angles topology (see Fig. 1), owing to possible application of different set of masks during two consecutive iterations, it, finally causing violation ion homotopic character of the mask's skeleton.
In the proposed method the problem of vertexes' treatment is solved by application of 8-connectoin «chess's» metric both for convex and concave angles.
As the distance from vertexes of both convex ) angles to the background is equal , these vertexes can be removed in one  Elements of the nuclei of basic masks, unused for the basic method with alternative colors and ignored ones are used there. Here, a candidate to the vortex of the concave angle is marked with "*" symbol. As the vortex of the concave angle has just two neighboring adjacent points, the mask point may be considered to be the vortex of the concave angle if it is twice marked to be it  (Fig. 3).
The points, marked in Fig. 3a, will be removed with the masks { } В A Z (indices of masks removing these points are shown in Fig. 3), this is to lead to violation of connectivity of the skeleton (see Fig. 3b). To solve this problem a correcting mask { } L Z (Fig. 4)  Consider the methods of correcting violations of the skeleton's topology in the points of intersection of geometrical primitives. The third type of violations lies in violation of homotopic character of the skeleton in points of primitive's intersection, as the character of the analyzed object's zone requires affiliation of these points (e.g. vortexes of the skeleton's right angles) with the mask (Fig. 5).
The methods of topological skeletonization are sensitive to local properties of the mask, changing after each iteration of its thinning. Thus, for a thickness of the primitive in several points even during the first iteration with { } A Z mask a "forepart" artifact turns up, increasing its dimensions from iteration after iteration, greatly distorting the skeleton (Fig. 6).
Elimination of these drawbacks requires regeneration of the resulting skeleton by correction of the artifacts, In the Table 3 the following designations are assumed: -the background; -the contour; -makes no difference whether contour or background; 2 -the background, it becomes a contour in case of coincidence with the mask; 3 -the contour, but it becomes a background in case of coincidence with the mask; 4 -makes no difference whether contour or background, however it becomes background in case of coincidence with the mask; 5 -makes no difference whether contour or background, however it becomes background in case of coincidence with the mask;  (Fig. 7), corresponding to topological orientation of the primitives in the images' aperture; -the zone of points (with codes 2…5) of the aperture 5 × 5, changed by the mask must be surrounded with neighboring background points, or with unchanged contour's points, it allowing to avoid violations of skeleton's connectivity at its modification with masks.

EXPERIMENTS
The proposed algorithm is implemented in the C ++ Builder Seattle environment. The developed software product allows to perform skeletonization of the image by the developed technique and visualize the result. In order to obtain an objective quantitative and qualitative assessment of the effectiveness of the proposed skeletonization technique, the developed software product implements the standard well-known methods of topological skeletonization.
To quantify the result, it is possible to compare the result of skeletonization with an ideal skeleton and calculate the main evaluation criteria. The program is equipped with a flexible system of settings for each method.
The raster images of sea transport drawings used for testing are represented by a random sample of 40 color grayscale images, with a color depth of 24 bits, of different sizes. Each set of methods was tested with the help of the projected software on the test set of images of parts drawings; Each image served as the basis for 5 experiments in different modes, the results of which were averaged.
Each set of methods was tested with the help of the projected software on the test set of images of parts drawings; Each image served as the basis for 5 experiments in different modes, the results of which were averaged. To quantify the results shown by the analyzed methods, the commonly used metrics: MSE, PSNR, UIQI, SSIM, PRECISION, RECALL, F-MEASURE, ACCURACY. Comparative analysis of processing time of raster images of drawings of parts was not carried out. This is explained by: the prevalent value of quality processing in front of the miserly time spent on it.

RESULTS
An example of mask's skeletonization of a part of a "Nut" type ( Fig. 9a) is shown in Fig. 8 and 9 with performed according to the basic method, with heavy distortion of the skeleton (Fig 9b) and with application of improved method, where these distortions have been removed (Fig. 9c).
The averaged results of a comparative study of the developed set of methods for improving the skeletons of contours of parts in raster binary images of marine transport drawings are given in Table 4.

DISCUSSION
Existing methods of iterative topological skeletonization [5,[13][14][15][16]23], as a rule, generate skeletons with raster distortions of topology ( Fig. 10-12): -erosion of the contour primitive with its even thickness (Fig. 10); due to the symmetry of the masks used; -loss of contour points, neighbors of which in the "manhattan's" metric belong to the contour, and in the chess -to the background (Fig. 11); arises because of the 4connectivity of the masks used; -violation of the topology of the right angles of the contour (Fig. 12); arise from the conceptual incompleteness of iteratively-applied masks, which should have a theoretically sufficient minimum size of 5 × 5 [8].    A typical remedy for distortions of resulting skeletons is iteratively reducing the use of fixed sets of masks. But without taking into features the details of the parts drawings, bound to them the variability of skeletonization masks and sets of restoring masks it is impossible to remove distortions of the skeleton topology (Fig. 11). In this study the required variability is provided by the developed technique for restoring the homotopy of skeletons, which allows to modify the applied masks and to adapt their set to typical distortions of the skeleton of specific part. The technique assumes the use of decision rules for removing, adding and replacing skeleton's points to the contour and background with masks with size 5 × 5 so as to satisfy the requirement for the skeleton to preserve the topology of the contour of the part (see the section "Materials and methods").
A substantial reduction in skeleton's distortions is reached by two-staged correction of the skeleton of the part's mask: -at the first mask during iterative thinning of the part's mask iterative distortions of the skeleton are corrected; -at the second stage, after the entire skeleton has been formed, reconstruction of distorted zones of intersections of geometrical primitives of the skeleton is done.
Exclusion from the applicable set of a reduction mask eliminates false triggering of the technique (Fig. 13).
Unfortunately, false triggering of masks is unavoidable due to non-ideal raster rendering of binarized primitives of the contour due to errors of the Brezenham's algorithms, used in rasterizing second-order curves [10]. CONCLUSIONS Proceeding from the features of the subject area, it is established that the purpose of the task of thinning out the area contour of the workpiece is the homotopic transformation of the binary contour of the part into a skeleton. A general criterion for the quality of skeletonization is the Hamming distance between the resulting and reference skeletons of the part contour, and measures of this distance are generally accepted unified quality indicators: MSE, PSNR, UIQI, SSIM, Recall, Precision, F-measure, Accuracy. The main limitation of the problem is the absence of distortions of the skeleton, which violate its topological similarity to the contour of the part in terms of the number of geometric primitives, their mask and connectivity.
The scientific novelty of the proposed technique is that for the first time a set of methods for eliminating structural bitmap fragment of the contour result of false triggering of mask №8 The analysis of testing of the developed methods of two-staged improvement of the skeleton of masks of sea transport parts confirmed a substantial improvement of the quality of the produced skeletons with preservation of their topological similarity to the original masks in the number of geometrical primitives, their masks and connectivity.
The proposed methods of iterative topological skeletonization of drawings of sea transport parts can be used for skeletonization of diagrams of road junctions, engineering drawings, functions graphs and the like.