Image Processing, Geoinformatics and Information Security DETERMINATION OF THE BILATERAL FILTER'S PARAMETERS FOR THE ANALYSIS OF SURFACE GEOMETRY DEVIATIONS V.A. Pechenin, M.A. Bolotov, E.R. Stepanova Samara National Research University, Samara, Russia Abstract. This paper considers a method of determination of the bilateral fil- ter's parameters while processing geometric measurements. The proposed method is formulated as an optimization problem that takes into account the fol- lowing parameters of the excess after filtration: its compliance with the Gaussi- an distribution, the availability of correlation. The paper describes approvement of the method to determine the optimal parameters of the bilateral filter when filtering the form of deviations of the measured points of a flat surface ma- chined by grinding. Considered method of determination of the bilateral filter's parameters is implemented in the software package MATLAB and it can be used in the processing of geometric information obtained from measurements. Keywords: method, form deviation, bilateral filter, Pearson’s chi-square test, autocorrelation coefficient, variance. Citation: Pechenin VA, Bolotov MA, Stepanova ER. Determination of the bilateral filter's parameters for the analysis of surface geometry deviations. CEUR Workshop Proceedings, 2016; 1638: 386-392. DOI: 10.18287/1613- 0073-2016-1638-386-392 Introduction The precision of determining the geometric parameters of measurement object de- pends on the accuracy of the measurement of parts by coordinate measuring machine (CMM). The problem of precision is particularly acute when measuring parts have complex geometric shapes. Measured information consists of a set of points in space. During processing of the measured data it is often necessary to remove noise repre- senting the inaccuracy of measuring instrument [1,2]. For modern contact CMM such error is 0.7-2 µm but when measuring complex curved surfaces or if condition is non- compliance with normal conditions this measurement error can be greater. When measuring surfaces with laser and optical means (e.g., T-SCAN-CS and 6 COMET company Steinbichler Optotechnik GmbH) the magnitude of errors increase to 10-50 µm. The problems associated with noise reduction occur in image processing [3-5]. There are extensive research and a variety of developed noise reduction algorithms specifically for image processing tasks, they can be used for noise reduction in the processing of the measured data [6,7]. Information Technology and Nanotechnology (ITNT-2016) 386 Image Processing, Geoinformatics and Information Security Pechenin VA. et al… For this study the coordinates of points on a flat surface treated by grinding were measured by the coordinate measuring machine DEA Global Performance 07.10.07. Deviations from the nominal geometry are calculated at the measured points. Filtra- tion of calculated deviations at surface points is performed. The aim of the research is to determine the filter parameters suitable for processing of measured deviations. 1 Calculation of form deviations Measurement was carried out on a flat surface at 9792 points (153grid points along the x direction and 64 points in the direction y, figure 1). Fig. 1. Measurement of a part; 1,2, 3 are flat surfaces The coordinate system is defined as follows: 1 plane defines the axis OZ; at the inter- section of the planes 1, 2 and 3 the coordinate system center is calculated; at the inter- section of the planes 2 and 1 the axis OY is calculated. Two coordinate systems: roughing and finishing are performed for the most accurate positioning. The algorithm of positioning is the same in both cases but the planes of roughing system were measured manually by 4 points on each plane. Finish position- ing was performed in automatic mode by 9 points for each plane. Then in the software (PC-DMIS) of CMM the form deviations at given points was calculated representing a deviation of the measured points from the points on the nominal surface. The calculated deviations can be characterized by the equation: I (u )  dF (u )   r . (u ) , (1) where dF (u ) is the actual form deviation at the point;  r (u ) is the passport value of measurement error, the random component of devia- tion. Information Technology and Nanotechnology (ITNT-2016) 387 Image Processing, Geoinformatics and Information Security Pechenin VA. et al… 2 Utilized filter For the separation of the error on the systematic and random (noise) errors the bilat- eral filter was used. The bilateral filter was introduced for the first time in [8]. This filtering technique is used mainly in tasks of image processing [9,10] and it is appli- cable to noise reduction of measured deviations. During work of the bilateral filter the value of deviation at the point is calculated (as for digital images it is the intensity of the pixel) as a weighted medium intensity of the neighboring values of deviations in a neighborhood of radius r . Weight of neighbor- ing deviations is changed in accordance with values of the distances between points (spatial weight) and a value of deviations (the intensity of pixels for images) at points that is the order filter. The widest application has bilateral filter based on the Gaussian function. Taking into account that random errors of measurement generally obey a normal law of distribution [11] Gaussian bilateral filter was used in the work. The bilateral filter I (u ) for a set of deviations (an image) at the point is defined by the following equation:  Wc ( p  u )  Ws ( I (u )  I ( p) )  I ( p) ˆI (u )  pN (u ) , (2)  Wc ( p  u )  Ws ( I (u )  I ( p) ) pN (u ) where N (u ) is the neighborhood of the point u ; Wc is a domain filter (Gaussian filter) with parameter  c ( Wc ( x)  e  x /(2c ) );; 2 2 Ws is a rank filter (weighted similarity function) with parameter  s ( Ws ( x)  e  x /(2s ) ). 2 2 In practice (as in our study) the neighborhood N (u ) consists of a set of points q i  which satisfies the inequality: u  qi  r , (3) where r  2   c The excess of filtering is calculated at each point respectively by the equation:  r (u )  I (u )  Iˆ(u ). (4) 3 Noise analysis To determine the threshold values of the filter parameters on the basis of pre-position that the filtered component should be of random nature the linear autocorrelation coefficients are calculated: Information Technology and Nanotechnology (ITNT-2016) 388 Image Processing, Geoinformatics and Information Security Pechenin VA. et al… N y N x n    r (i, j )   r (i  n, j ) j 1 i 1  x ( n)  , (5) N y N x n N y N x n    r 2 (i, j )     r 2 (i  n, j ) j 1 i 1 j 1 i 1 where  x (n) are the linear autocorrelation coefficient in the x direction; n is a lag of autocorrelation; in the x direction n  1,..., N x  1 . Similarly the linear coefficient in the y direction is described there is n  1,..., N y  1 . The null hypothesis lies in the fact that the value of the random component of the deviation at each i-th point does not correlate to other values, so  x (i )  0 . To estimate compliance of nature of the calculated excess  r of the filtering with random errors of measurement the test for compliance with the normal law by the Pearson’s chi-square test (criterion  2 ) was used. According to the null hypothesis (Н0) the distribution of the array of filtered-off deviations follows the law of normal distribution and according to the alternative hypothesis that does not correspond to the normal law. 4 Results The search problem of the optimal filter parameters { с ,  s } is formulated as follows:  r   min, (6) with the set of constraints:   2  r    2 ,   critical (7) Var r   Var ,  critical where  r  is the linear autocorrelation coefficient calculated by the equation 5;  2  r  is the Pearson’s chi-square test calculated in base of the excess  r of the filtering; 2 is the critical value of the Pearson’s chi-square test for a given belief line of critical importance  ; Var r  is the variance calculated in base of the excess  r of the filtering; Var is the critical value of the variance, so the passport uncertainty of measuring critical instrument is taken in place of it. The solution was carried out by the method of uniform search. To determine the random error component the filter with parameters  c  1;5 and  s  0.1;3 was used. Figure 2 shows the results of the filtering of the measured form Information Technology and Nanotechnology (ITNT-2016) 389 Image Processing, Geoinformatics and Information Security Pechenin VA. et al… deviations at the surface points. In Case F1 parameters  c  1 and  s  1 are used; in F2 parameters  c  3 and  s  0,1 are used; in F3 -  c  5 and  s  3 are used. Fig. 2. The results of application of the filter to calculated deviations; a); b) the data after filtra- tion, c) the noise as a result of filtering It could be noticed from the results in Figure 1that in the case F3 the surface after the filtration is smoother, but the magnitude of the random component of the error signif- icantly exceeds the passport uncertainty of used CMM; it means that we filtered off the useful signal together with the noise. In any case an additional analysis of the results is required in order to make a conclusion about the quality of the filter. According to this criterion only filter with parameters  c  3 and  s  0,1 is suited. Autocorrelation coefficients  x and  y (eq. 4) were also calculated. Table 1 shows the values of the criterion  2 , as well as the expectations (  ), minimum and maxi- mum values of autocorrelation coefficients for the series of experiments. The values of the autocorrelation coefficients indicate a very weak correlation of the deviations. To estimate the significance of the correlation the Student’s t-test was used. Despite the fact that the resulting noise (according to criterion  2 ) is strictly subjected to a normal distribution only in the case F2 it was noticed visually in histo- grams that distribution in the remaining cases are close to normal. Therefore the re- sults of the Student’s t-test are applicable to considered noise values [12]. t-test for the coefficients  (  may be  x or  y ) is calculated by the equation: t (M  2)  M  2   / 1   2 , (8) where M is the number of points used for calculation of  . Information Technology and Nanotechnology (ITNT-2016) 390 Image Processing, Geoinformatics and Information Security Pechenin VA. et al… Table 1. Results of the analysis of the filtered-off noise c s 2 x y  Min Max  Min Max 1 0,1 H1 -0,001 -0,013 0,037 0,001 -0,024 0,020 1 1 H1 -0,001 -0,018 0,052 0,001 -0,032 0,029 1 3 H1 -0,001 -0,018 0,052 0,001 -0,032 0,029 3 0,1 H0 0,002 -0,013 0,105 0,003 -0,013 0,051 3 1 H1 0,003 -0,017 0,133 0,004 -0,017 0,065 3 3 H1 0,003 -0,017 0,133 0,004 -0,017 0,065 5 0,1 H1 0,004 -0,014 0,120 0,007 -0,011 0,069 5 1 H1 0,005 -0,018 0,154 0,010 -0,014 0,090 5 3 H1 0,005 -0,018 0,154 0,010 -0,014 0,091 Figure 3 shows how the criteria changes with a lag of n in directions x and y in cases F1, F2 and F3. A critical value of criterion for sufficiently large M at a significance level of 0.05 is 1.96 (the horizontal line in the figure). Fig. 3. The t-test for autocorrelation coefficients For these samples it may be concluded that increase of parameters  c and  s in- creases the probability that the null hypothesis of absence of correlation is incorrect. 5 Conclusion As a result the filtration of noise in the measurement of form deviation of the preci- sion surface is performed. The form deviation becomes available in the stage of the measurement of surface with CMM DEA Global Performance 07.10.07. For the filter- ing operation the bilateral filter with different parameters  c and  s were utilized. The obtained results, as well as their analysis by the criterion  2 and the autocorrela- Information Technology and Nanotechnology (ITNT-2016) 391 Image Processing, Geoinformatics and Information Security Pechenin VA. et al… tion function show that use of the bilateral filter allows high-quality noise filtering and obtaining more reliable data on measured deviations with the parameters  c  3 and  s  0,1 . Acknowledgements This work was financially supported by the Ministry of Education and Science of the Russian Federation within the framework of the Federal Target Program "Research and development on priority directions of scientific-technological complex of Russia for 2014-2020 years". The unique identifier of ASRED is RFMEFI57815X0131. References 1. Soifer VA, Kupriyanov AV. Analysis and recognition of the nanoscale images: conven- tional approach and novel problem statement. Computer Optics, 2011; 35(2): 136-144. [in Russian] 2. Myasnikov VV, Popov SB, Sergeyev VV, Soifer VA. Computer Image Processing. Part I: Basic concepts and theory. Edited by Soifer VA. VDM Verlag, 2009. 3. Kazanskiy NL, Khonina SN, Skidanov RV, Morozov AA, Kharitonov SI, Volotovskiy SG. Formation of images using multilevel diffractive lens. Computer Optics, 2014; 38(3): 425- 434. [in Russian]. 4. Borodin SA, Volkov AV, Kazanskiy NL. Device for analyzing nanoroughness and con- tamination on a substrate from the dynamic state of a liquid drop deposited on its surface. Journal of Optical Technology, 2009; 76(7): 408-412. 5. Kopenkov VN, Sergeev VV, Timbai EI. Regression restoration methods as applied to solve the problem of multidimensional indirect measurements. Pattern Recognition and Image Analysis, 2011; 21(3): 501-504. 6. Fleishman S, Drori I, Cohen-Or D. Bilateral mesh denoising. ACM Transactions on Graphics, 2003; 22(3): 950–953. 7. Abdul-Rahman HS, Scott PJ, Jiang XJ. Freeform surface filtering using the lifting wavelet. Precision Engineering, 2013; 37(1): 187-202. 8. Tomasi C, Manduchi R. Bilateral filtering for gray and color images. In ICCV, 1998; 839- 846. 9. Eisemann E, Durand F. Flash photography enhancement via intrinsic relighting. In ACM SIGGRAPH, 2004; 23(1): 673-678. 10. Durand F, Dorsey J. Fast bilateral filtering for the display of high-dynamic-range images. ACM Transactions on Graphics, 2002; 21(3): 257-266. 11. Sprauel JM, Linares JM, Bachmann J, Bourdet P. Uncertainties in CMM measurements, Control of ISO specifications. CIRP Annals - Manufacturing Technology, 2003; 52(1): 423-426. 12. Sun X, Langbein FC, Rosin PL, Martin RR. Noise analysis and synthesis for 3D laser depth scanners. Graphical Models, 2009; 71(2): 34-48. Information Technology and Nanotechnology (ITNT-2016) 392