380 FOAM-RUBBER SAMPLE VOLUME MEASURING S. Yu. Yakovlev1, I. V. Safonov1 1Moscow Engineering Physics Institute (State University), Kashirskoe sh. 31, Moscow, 115408, Russia, {Yakovlev.Serge; Ilia.Safonov}@gmail.com For industrial quality control of foam-rubber material, it is required to measure volume of the sample. A new approach is proposed to measure sample volume by images of sample faces. Faces images are got via flatbed scanner. The faces images are processed and the sample is approximated by hexahedron. Then the sample volume is calculated analytically. Also we proposed an iterative approach based on splitting geometrical model of the sample into several smaller hexahedrons. The test results have shown that results of volume measurements obtained by proposed approach coincide well with ones obtained by the standard method. However, repeatability and reproducibility of measurements is better for proposed algorithm, and it is faster. Introduction Many modern industries use image processing systems to control workflows and quality of materials. Chemical industries producing porous material such as elastic foam-rubber exploit a quality control system [1], where a flatbed scanner is used to capture images. One of key parameters influencing on foam-rubber quality and cost is so-called apparent density, i.e. a ratio of a porous sample mass to its volume. To measure the apparent density, test samples in the form close to parallelepiped are cut out the produced material [2]. Electronic balance is used to measure the sample mass with high precision. However, it is hard to estimate the sample volume precisely enough by traditional means, because the material is elastic, and it is impossible to cut an ideal parallelepiped, using existing and inexpensive tools. With cutting, foam-rubber is subject to resiliences, sample faces are not ideal and not orthogonal to each other (Fig. 1). Measurement of porous material sample linear sizes is a conventional method to calculate its volume. Such measurements are carried out by a ruler or a thickness gage [3]. Then the volume is calculated by multiplying linear sizes. Since a sample is not an ideal parallelepiped and because of human factor, repeatability and reproducibility of measurements are not so good and the measurement error can reach 5% that is unacceptable in many cases. Fig. 1. Foam-rubber sample faces images We propose a novel algorithm to measure a sample volume, using its faces images, which are obtained by uncovered CCD flatbed scanner. Six sample faces are scanned in a fixed order, which allows identifying uniquely face vertices and edges with recovering a 3D model of the sample. Sample volume evaluation by its faces images There are two stages in the proposed volume measurement algorithm: 381 Faces images processing and vertices and edges identification in the faces; Recovering a 3D model of the sample. 2.1. Face Processing After a face image was captured, one carries out its binarization with a threshold calculated automatically by the Otsu criterion [4]. It results in one wide area object being the face image and a lot of small objects representing noise in the task framework. These small objects are easily rejected by their areas. There may be holes in the projection binary image, which are to be filled. Morphological close operation [5] allows to smooth the object contours (Fig. 2). In the scope of the paper, face projection means its binary image unless otherwise indicated. There are four sides of every sample face projection, which correspond to the sample edges. Further, “edge” term means the sample edge unless otherwise indicated. At the next algorithm stage, a face projection is approximated by a tetragon. For that, we detect the projection contour and then classify the contour points according to their belonging to one of face projection edges. The contour is detected by the Inner Boundary Tracing algorithm [6]. The detection results in a sequence of object pixels located on the contour. The sequence of two-dimensional coordinates of pixels located on the object contour is considered as a sequence of perimeter points (Fig. 3): P pti , i 1, N , where pt i is a couple of the i-th perimeter point coordinates and N is the number of perimeter points. Classification of perimeter points means their division into four disjoint subsequences, each of them representing one edge. For that, we detect corner points of the face. Then the sequence of points located between two corner points describes the corresponding edge. Let us define the corner point term. Let pti P , i 1, N . We introduce function angle ( pti ) calculating the angle included between vectors pti ptk and ptm pti , where pt k P and pt m P . Index k min j , j [1, i ) , where and pti ptk Lang . Index m max j , where pt m pt i Lang . Here Lang is the parameter that is specified as much as possible acceptable length of considered vector (Fig. 4). Face projection corners are fuzzy: they are chamfered and rounded. So, we assume that the projection point pt ang is a corner point if the following condition holds: angle ( ptang ) min angle ( pti ) . Here pt i lies inside the circle which center corresponds to physical location of the corner on the face projection, and the radius is chosen such that the circle does not intersect the circles around other corners of the face projection. j (i, N ] , and ptk Lang pti Lang ptm Fig. 4. Determination of angle in point pti We propose the following algorithm to find corner points. Perimeter points are analyzed step by step with the pre-defined step S Lang . Index l of the next point is l min j , j (i, N ] , determined as Fig. 3. Face contour detection ptl pti S , where pt i and ptl are the current and the next points, respectively. Points are analyzed until the angle value becomes less a pre-defined threshold. 382 Then the corner point is localized. The found corner point is put into the set of found corner points, and the next corner point is looked for. After all corner points were found, the perimeter is divided into four subsequences corresponding to edges. To avoid errors caused by inaccurate localization of corner points, some of points (corresponding to about 2% of edge length) at the beginning and at the end of every subsequences are dropped. After face projection perimeter points classification, the found subsequences are approximated by straight lines, using the Total Least Squares (TLS) method [7]. After the approximation, we find the tetragon vertices, which describe the face projection. Further, the built geometric model of the face projection is used to compute face parameters: lengths of edges and angles included between edges. F G E H B C A D Fig. 6. Geometric model of the investigated sample of porous material Each of the pyramids is described by three edges exiting from the same vertex and angles included between them. Inner pyramid parameters are calculated by the known parameters of faces. Every pyramid volume is computed analytically. The sample volume is the sum of these pyramids volumes. 3D model recovery Iterative approach After approximation of face projections by tetragons, lengths of the corresponding edges of adjacent faces may differ. The difference is explained by errors introduced by scanning, binarization and approximation. Therefore, correction of edge lengths should be one of the algorithm steps. Correction of edge lengths is carried out for every couple of corresponding edges. Arithmetic mean value of their lengths is taken as a new length. Then geometric models of adjacent faces are processed separately. After the correction of edge lengths, parameters of projection geometric models are re-calculated. Thus, at this stage, we have six face projections approximated by tetragons, which define the sample. For every face projection model, we have calculated lengths of edges and angles included between them. An irregular hexahedron is a 3D model of the considered solid. To compute the hexahedron volume, every face model is divided on the diagonal into two parts, so that we obtain four outer pyramids ABDE, CBDG, EGHD, EFGB and one inner pyramid DEGB (Fig. 6). The algorithm described above approximates the sample by an irregular hexahedron. This approach allows taking into account that faces are not perpendicular to each other. However, faces are not ideal planes. Sample model is partitioned to decrease the volume computation error. Ever part volume is computed separately, and the sample volume is resulted from the sum of the part volumes. With the sample model partition, every edge of every face projection geometric model is divided into two parts. For that, the middle of ever edge is found. The subsequence of perimeter points representing the edge is divided into two parts too. As the edge partition result, a face projection is divided into four parts. Then each of them is approximated by a tetragon, according with the algorithm described above. Since every face projection is partitioned, the hexahedron is divided into eight parts, each of them being hexahedron too. Reaching a prescribed accuracy, exceeding a prescribed maximum of iterations, and/or decreasing a face edge length below a prescribed length threshold serve as the iterative algorithm stop criteria. The last criterion is connected with physical features of 383 an investigated object: minimal edge length depends on the sample pore dimension. difference is calculated by the formula: Results average volume calculated in conventional way and V a is the volume calculated in the proposed automatic way. One can see that volume measurement results obtained in the automatic way almost coincide with the results obtained in the conventional way: the relative error does not exceed 1.5%. Test series for five samples were carried out to investigate the measurement process convergence. Within every series, a sample volume was measured 30 times by the considered system. For comparison, similar sample measurement series were carried out in the conventional way. Fig. 8 shows the histogram of relative error of the measurements. The proposed automatic way of measuring the volume of the same sample provides the relative error not exceeding 0.5%. Testing of the proposed algorithm was carried out in industrial laboratory conditions, with the system consisting of the flatbed scanner HP Scanjet 3670 and PC Pentium 4 (3,2 GHz, 1GB RAM). As tested objects, we used samples, which form is close to parallelepiped and which dimensions are (1003, 1003, 503) mm. Faces of samples are scanned in grayscale mode with spatial resolution 300 dpi. 30 objects were used with the algorithm testing. Every object volume was preliminarily measured by three specialists in conventional way (using a thickness gage). Then the data were assumed to be lost, and every object volume was measured by the considered system. D 2 Vm Va /(Vm Va ) , where V m is the Conclusion 0,016 0,014 0,012 0,010 D 0,008 0,006 0,004 0,002 0,000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 Sample # Fig. 7. Normalized difference between sample volume values obtained in automatic and conventional ways 0,03 0,025 0,02 Conventional D 0,015 Proposed 0,01 0,005 0 1 2 3 4 5 Sam ple # Fig. 8. Histogram of relative error vs. measurement series number Fig. 7 shows the normalized difference between sample volume values obtained in automatic and conventional ways versus the measured sample number. The normalized The paper goal is to describe proposed algorithm to measure the volume of a porous material sample, which form is close to parallelepiped. The algorithm is integrated into the existing system for elastic foam-rubber quality control, where samples images are captured by a flatbed scanner. In the proposed algorithm, 6 sample faces are scanned and processed preliminarily to find their vertices and edges. Then, the sample is approximated by a hexahedron, which volume is calculated analytically. Also we proposed an iterative approach based on splitting geometrical model of the sample into several smaller hexahedrons. The algorithm trials carried out in industrial laboratory conditions show that measurement results obtained in the proposed automatic way almost coincide with the results obtained in the conventional way being an industry standard. However, the proposed method provides better repeatability and reproducibility of measurement system. Taking into account that the software implementing the proposed algorithm allows processing 4 samples 384 concurrently, the measurement rate increases by a factor of more than 5. Possibility of retrospective analysis and documentation of measurement results are additional advantages of the proposed and implemented approach. Quality control system using the proposed algorithm is deployed and exploited successfully in several chemical enterprises. References 1. I. V. Safonov, G. N. Mavrin, K. A. Kryzhanovsky. Segmentation of convex cells with partially undefined boundaries. Pattern recognition and image analysis, vol.16, No.1, 2006, pp.46-49. 2. ISO 845 : 1977. Cellular plastics and rubbers Determination of apparent density. 3. ISO 1923 : 1981. Cellular Plastics and Rubbers Determination of Linear Dimensions. 4. K. Ch. Lin. On improvement of the computation speed of Otsu’s image thresholding. Journal of Electronic Imaging 14(2), Apr–Jun 2005. 5. L. G. Shapiro, G. C. Stockman. Computer Vision. Prentice Hall, 2001. 6. M. Sonka, V. Hlavac and R. Boyle. Image Processing, Analysis, and Machine Vision. An Imprint of Brooks and Cole Publishing, 1998. 7. V. Vezhnevets, A. Degtiareva. Line fitting or methods of approximation of points set by line. Graphics and multimedia online, 2003. (In Russian)