PRINT

Optimization of Multi-Channel Lighting by Lighting Simulation for Visual Inspection

NARUSE Yosuke Ph.D.
Technology Research Center
Technology And Intellectual Property H.Q.
Specialty: Image Processing
Affiliated Academic Society: IPSJ
OHNISHI Yasuhiro
Technology Research Center
Technology And Intellectual Property H.Q.
Specialty: Image Processing
KURITA Masashi
Technology Research Center
Technology And Intellectual Property H.Q.
Specialty: Image Processing
HASEGAWA Yuki
Technology Research Center
Technology And Intellectual Property H.Q.
Specialty: Image Processing
Affiliated Academic Society: JSPE

In an imaging system with multi-CH lighting, this paper addresses the issue of optimizing the lighting conditions and the imaging conditions of the camera so that they are suitable for visual inspections. The proposed method establishes a technique for accurately simulating an image of a workpiece (subject to be inspected) under arbitrary lighting conditions by image synthesis and by correcting the hardware characteristics of ambient light, sensor noise, dark current offset, and the quantization of light intensity. By this technique, the number of photographs required for optimization was reduced to the logarithmic order of the number of patterns to be evaluated, and the search for the optimal solution could be completed in 1-2 seconds (for 39 CHs) from all lighting patterns. In addition, the proposed method works universally with multi-CH lighting devices in an arbitrary configuration, while the conventional technique requires modification of the optimization algorithm depending on the configuration of the lighting device. The proposed lighting simulation is a fundamental technology for automating the teaching process and making it off-site.

1. Introduction

1.1 Background

Visual inspection of products in the manufacturing industry is one of the operations where the replacement of labor by automated machines has not advanced but is the most important challenge of automatization, considering the decreasing working population in the future. In recent years, automatization technology for inspections has advanced significantly owing to the progress of the technologies, such as artificial intelligence, machine learning, and typically deep learning. However, the time consuming operation required in constructing the inspection system for visual inspections and machine vision is generally the design of the imaging system involving optimization of the lighting conditions, and automatization of this operation is not much advanced. When this operation is difficult and is made manually by persons, the steps of manual adjustment of the lighting equipment changing the inspected workpieces one by one so that visual detection of any possible defect of the workpiece that will vary individually can be made without fail, and the step of examination and verification of the inspection algorithm must be repeated, which requires significant person-hours to achieve the desired detection capability.

The difficulty involved in the optimization of lighting conditions is that no expedient method is available to seek the appropriate lighting conditions other than to repeat imaging by changing large numbers of workpieces in the imaging setup, when it is unknown what images can be taken under what lighting conditions. When such restrictions of hardware are imposed, the sufficient number of trials required to obtain the optimum result cannot be made, and the optimum solution cannot be obtained within the allocated person-hours.

The multi-CH lighting optimization technique based on the lighting simulation technique is proposed in this paper to solve this issue. The lighting simulation here means the simulation of the entire imaging system, including the lighting system whose light distribution can be controlled in order to output the presumed image for the given lighting condition and camera setting, in other words, the problem in normal direction. When such a simulation is possible, seeking the most appropriate lighting condition for the inspection becomes possible for evaluating the images taken. The outcomes that such a lighting simulation technique can bring will be as follows.

  • (1) The optimization problem involving the imaging system hardware is changed as the numerical computation problem by the PC, and optimization of the lighting suitable for the algorithm and of the algorithm suitable for the lighting condition can be solved simultaneously by the existing numerical optimization technique.
  • (2) Because optimization is made directly for a large number of workpieces/variations in transfer actually imaged, a larger number of samples can be looked over, and more appropriate settings can be determined compared with the optimization made manually by persons.
  • (3) Optimization of the lighting condition and the inspection algorithm can be made off-site by the PC after initial imaging on-site, and the process does not occupy the resources, such as the inspection device and sample workpieces, in the optimization process.
  • (4) When a new variation mode of the workpiece appears and it becomes necessary to reconfigure the inspection process, troublesome verification work involving new imaging using a large number of workpieces already taken can be avoided.

Various lighting systems are considered as the equipment with light distribution control feature, which are classified to multi-CH light and the movable light. The multi-CH light allows individual intensity adjustment of lights but the number of channels becomes too large when the angular resolution is increased; however, its durability is high because no movable parts are used. It allows lighting from the lighting angle where identification of the defect becomes easy and reduction of the texture inappropriate for inspection by simultaneous lighting from different angles. The movable light is a type in which light distribution is changed by moving position of the lights and includes the type where the position of the light is changed manually. The mechanical system to move the lights becomes necessary when the distribution of light needs to be parametrically controlled automatically as a mathematical optimization problem.

The multi-CH lighting is discussed in this paper. The reason is that an accurate lighting simulation can be made by superposition synthesis using simple addition and subtraction of images. Because an accurate lighting simulation is difficult for movable lighting, priority is not given to the study, and it is not discussed in this paper. While the lighting simulation technique discussed in this paper can be applied to any multi-CH lighting independent of the specific system, the lighting systems FL-MD180MC (Fig. 1) and FL-MD90MC having 39CH (13 azimuth angles and 3 colors) for the FH series are used in the experiment.

Fig. 1 Example of multi-CH lighting (FL-MD180MC)
Fig. 1 Example of multi-CH lighting (FL-MD180MC)

1.2 Related Studies

The method to select the lighting pattern with the highest evaluation index by discriminant analysis actually repeating imaging in various lighting patterns1) is reported as the available technique for this problem. Discriminant analysis is also used for the evaluation index in this paper, but the proposed technique is superior in the following two points.

The first point is the time required for optimization. Let K be the number of lighting channels, T be the number of quantization levels of luminous intensity, and E be the possible number of exposure levels, then the number of lighting conditions becomes E * T K , which increases exponentially with respect to number of channels, and when the number of channels is large, it takes enormous time to take and examine images under all imaging conditions. By the examination in this paper considering such a problem, the number of imaging events can be reduced to multiples of K by the proposed technique. In the conventional technique, the proposal is to solve the problem of too large a number of imaging events by efficient searches using the coarse-to-fine search algorithm1), but it requires the design of the search algorithm empirically every time based on the configuration information of the lighting-CH. The proposed technique in this paper allows the design of the optimization algorithm to be independent of the specific configuration of the lighting-CH and the construction of the algorithm that can be applied generally to any multi-CH lighting system.

Another difference is that it is easy to construct an evaluation function. Because the statistical dispersion of the workpiece is handled generally in a visual inspection, optimization using the evaluation function for multiple samples is required rather than using a single workpiece. Optimization of lighting by any evaluation function using all images of the samples simultaneously becomes possible in the proposed technique. In addition, when the problem setting of the lighting design is a multi-objective optimization problem that requires optimization balancing multiple requirements of the inspection and where a single objective function cannot be defined in advance, the solution must be renewed by interactions modifying the objective function, but by the proposed technique, another imaging event is not required even when the objective function is changed, and a quick response and excellent usability can be realized.

Proxy Modeling2), where behavior of the imaging system is approximated by machine learning, is also examined as optimization of the imaging system using the imaging simulator as in this paper.

1.3 Notation

Bold lowercase letters indicate vectors and bold uppercase letters indicate matrices. Others are scalar quantities. ||竏處| indicates the l2 norm of the vector and シサXシスi,j indicates the element of matrix X in row i and column j.

2. Lighting Simulation by Image Synthesis

It is important that the accurate imaging system simulator be constructed in the optimization of the lighting and imaging systems with control of the degrees of freedom. In this paper, high accuracy of estimation correcting the actual characteristics of the device is realized focusing on the fact that the imaging simulator can be realized by simple image synthesis (superposition of images) in the case of multi-CH lighting.

2.1 Acquisition of Workpiece Evaluation Image by Basis Illumination Pattern

It is assumed that the linearity of the sensor of the imaging system (linearity between intensity and pixel value) exists for the lighting simulation by superposition of images. This means that the system is sufficiently linear, including the signal processing, such as demosaicing of the color filter array, zero pixel value when the intensity is zero by correction of the dark current offset and with the image processing, including HDR (high dynamic range) synthesis, to eliminate nonlinearity due to pixel value saturation. The image taken in such a manner is called the intensity image. Consider the situation where an image of the workpiece illuminated by multi-CH lighting with number of channels K is taken for the inspection, and the relative intensity of the respective channel (intensity that is constant factors of intensity) should be expressed as the following relative intensity vector.

マ= (マ1,マ2,...マK)T, マ>0
シ1シ

Consider the situation where the optimum lighting condition マ for inspection is determined by taking images of single workpieces changing the lighting illumination pattern for N times in teaching. Let the relative intensity vector of the n (1 竕、 n 竕、 N )-th image be defined as follows.

hn=(h1,h2,n,...hK,n)T, hi,n竕ァ0 H=シサh1,h2...,hNシス
シ2シ

By taking images of the workpiece under such illumination patterns, it becomes possible to reconstruct the image of the workpiece illuminated by any illumination pattern. This process is equal to the estimation of the LT (Light Transport) matrix3). It is generally desired to determine the illumination pattern as a rank of the matrix H = min (N, K ), in other words, linearly independent to obtain all the degrees of freedom of the LT matrix. At least N should be equal to K to fully utilize number of degrees of freedom of lighting K, and H should be of full rank.

When N < K, the degree of freedom by the number of lights cannot be fully utilized, but the time required for imaging of the workpieces can be reduced. Such a situation occurs in the problem setting where control of the degree of freedom K is large. Typical example is the LT matrix estimation method3) using compressed sensing.

The case where N > K can be also considered and it is more than required in the sense of fully utilization of the degree of freedom, and the number of images taken will become useless, but such a case can be used for the purpose of improving the S/N ratio and the dynamic range4).

Let the intensity image taken in the illumination pattern hn be called the basis image. Using the matrix F = [f1, f2, ..., fN] with the column vectors of the basis images fi placed side by side for the number of columns N, the relative intensity vector マ at the time of inspection and the intensity image g at that time can be expressed as follows.

マ=Hx, x=(x1,x2...,xN)T
シ3シ
g=n i=1xifi=fx
シ4シ

Where xi is a vector indicating the mixing ratio of the respective illumination patterns. The intensity vector of each lighting channel (level of the intensity gradation quantized) is calculated from the above value, but it is not the above value itself. The above value may be a negative value, but because the illumination pattern of lighting must be positive, the following condition applies.

Hx竕・0
シ5シ

Consider that the signs of inequality for the vector and matrix are the signs of inequality for all of their elements. When H=I, in other words, images of quantity K (= N ) are taken with the light turned on one by one, マ and x are equivalent. From the following subsection, the problem of obtaining the optimum lighting マ by obtaining the optimum weighting x in image synthesis is discussed.

2.2 Evaluation Formula of Sensor Model and Image Synthesis

The model used to convert the image vector f'c taken with exposure time to the image vector マ with exposure timeマ is expressed as the linear model with the offset as shown in the following Equation (6) when pixel saturation is not considered.

g'c=マ'/マ (f'c-dc)+dc'
シ6シ

In this case, c (1 竕、 c 竕、 C) is the color index of the color filter of the camera and dc is the dark current offset to be obtained in advance by calibration. When the sensor follows such a model, the lighting simulation by image synthesis under multi-CH lighting is expressed by the following equation.

g'c=n n=! wn,c(f'n,c-dn,c)+dc'
シ7シ

In this case, f'n,c is the column vector of the basis images taken. Because the basis images are taken by AEC (automatic exposure control) or by HDR, respectively, images are taken by different exposures or gains for the respective indices of the basis n (1 竕、 n 竕、 N ). f'c is a synthesized image vector taken with exposure time マ. wn,c is the weighting in image synthesis, and the best weighting is uniquely determined by the intensity level for the lighting channel and the exposure setting.

3. Determination of Optimum Lighting Condition for Inspection

3.1 Evaluation Criteria Cross Entropy vs. S/N

The purpose of lighting design in visual inspections is to allow correct discrimination between quality products and defective products. When the predefined discrimination algorithm is given as the discrimination criteria, the optimization problem of lighting is formulated as the problem of minimizing cross entropy to make discrimination results between the quality and defective products in agreement with the correct answer. When the discriminator is the machine learning device, learning of the optimization of lighting and by the discriminator may be made simultaneously to enable the highest performance of both functions.

However the problem encountered in minimizing cross entropy is that a large number of samples are required that are labeled as quality or defective products. This is a big issue in the start-up period when a large number of samples cannot be obtained. In particular, when optimization of the lighting system with a high degree of freedom is undertaken, the criteria for discriminating the small number of quality/defective product labels will result under any optimum lighting condition (the condition cannot be determined uniquely).

To solve this problem, maximization of the S/N ratio in the sense of dissociating the foreground designated by the user from the background is employed in this paper. This is a method to optimize the lighting using the evaluation criteria for images (contrast, brightness, and proximity) as the basis. When considered as above, the following two requirements mainly apply in the lighting design used for visual inspections.

  • (1) To make a feature that allows easy discrimination between the quality and defective products possible (i.e., to make the defect easily visible)
  • (2) To make dispersion between the quality products difficult to discriminate

As the above requirements are conflicting requirements in many cases, the design of the lighting system balancing these requirements is the challenge in optimization.

3.2 Acceleration of Evaluation Function in Quadratic Form

As discussed in Subsection 2.2, the basis images are taken with different exposure times to measure the gradation accurately. For that reason, weighting in image synthesis w is defined involving differences in exposure level, which is not the relative intensity of the lighting channel to be obtained. Vector x indicating the intensity ratio of the lighting channel to be obtained is expressed as follows with マ0 as the reference exposure level arbitrary determined and マi (1 竕、 i 竕、 N ) as the exposure level of the respective basis images.

x=D-1w, D-diagシサマ0/マ1,マ0/マ2...,マ0/マНシス'
シ8シ

The approach to restrict the evaluation function to a quadratic expression is used to accelerate the evaluation of the image evaluation criteria in this paper. The synthesized images is expressed as g = Fx from Equation (4). In this case, F is a matrix of the basis images with the reference exposure level defined below.

F=シサf1,f2...,fNシス=シサマ0/マ1(f'1-d1,c),マ0/マ2(f'2-d2,c),...,マ0/マn(f'N-dN,c)シス
シ9シ

As contrast can be expressed as ||BFx||2 with Toeplitz matrix B as the high-pass filter, brightness can be expressed as ||BFx||2 with B as the mean operation of pixel value, and agreement of the image can be expressed as ||F1x-F2x||2 using the above; all these can be expressed in quadratic form like xTQx+cTxwith the matrix Q as the Nテ湧 positive-semidefinite matrix. Similarly, the dispersion of images and error in projection to the linear subspace also have a quadratic form. ||Fx-g~||2 is when agreement is sought with the image g~ designated in advance as another evaluation function, ||BFx-y||2 is to make the image to the designated brightness and color y with B as the mean pixel value, and ||BF(x0+x)||2 is to optimize the rest of the lighting pattern while maintaining the specified part of the lighting pattern unchanged, and all of these have the quadratic expression xTQx+cTx.

As such, the evaluation function allowing accelerated evaluation independent of the number of pixels of the images can be realized by expressing the coefficients of the quadratic expression. Note that these expressions become invalid when pixel saturation occurs. Accordingly, optimization should be made within the range where pixel saturation will not occur, and when saturation is involved, optimization should be made by direct calculation of the l2 norms after clipping of the images by saturation without simplification using a matrix.

3.3 Lighting Design by Fisher窶冱 Linear Discrimination

Fisher窶冱 linear discrimination is the method to obtain the projection vector that minimizes dispersion within the class and maximizes dispersion between classes. The effectiveness of this method is limited compared with the method incorporating non-linear computation because the computation to generate the feature vector is simply the inner product. Because optimization of the lighting condition discussed in this paper is simply a computation of the inner product and the linear projection in the mathematical sense when imaging by the multi-CH lighting is regarded as the computation, the use of Fisher窶冱 linear discrimination to obtain the optimum linear projection is appropriate. The problem to compute the multi-CH light illumination pattern that realizes Fisher窶冱 linear discrimination is formulated as explained below where dispersion within the class and dispersion between classes are defined focusing on closeness (similarity) of the images by the l2 distance of the images.

The problem to discriminate the workpieces generally into categories of V is considered, for example, when the workpieces are discriminated into two categories: quality products and defective products, V = 2. The index of the category v should be 1 竕、 v 竕、 V. Consider that there are P (竕・ 1) groups for comparison between the region of interest (ROI) of images. The criteria for optimization of lighting are defined by the magnitude of dispersion of the group of images belonging to the same group. Let the index of the group for comparison in ROI be 1 竕、 p 竕、 P. Consider that the set of images Sp(v) where ROI is extracted from the images of workpiece is given for combinations of v and p according to the instructions of the user.

Consider that the images of the workpiece used for teaching F=Sp(v) are taken with the individual light of multi-CH lighting turned on according to the specified (for evaluation) illumination pattern hn . The expected value of the distance within the class (dispersion of the quality products) Dwithin and the expected value of the distance between classes (easiness of identifying a defect) Dbetween are defined as l2 distance by the following equations.

Dwithin=Ev,pVar(S(v)p,M(v)p)
シ10シ
Dbetween=EPVar({M(v)P}v,EvM(v)p)
シ11シ

Var (S, M ) is the dispersion calculated from the set and the mean M of multi-CH images S and defined as follows. This can be expressed as the quadratic form of the lighting vector x and the coefficient matrix in this case is expressed as Q.

Var(S,M)=Ef=z||Fx-Mx||2=EF=S||(xTテ悠)vec(F-M)||2=tr<xTテ悠)R(xテ悠)=xTQx
シ12シ

Where 竓 is the Kronecker product and vecA=シサaT1,aT2窶ヲaTNシス2, and the matrices R and Q are expressed as follows.

R-Ef=S vec(F-M)シサvec(F-M)シスT=EF=Si,jeieTjテ(fi-mi)<fj-mj)T
シ13シ
シサQシスi,j=EF-S(fi-mi)T(fi-mi)
シ14シ

Where fi and mi are the i-th column vector of the matrix F and M . When the coefficient matrices of Dwithin and Dbetween in quadratic form are Qwin and Qbwn respectively, the following evaluation formula is maximized in Fisher窶冱 linear discrimination to maximize the dispersion between classes and to minimize the dispersion within the class at the same time. The equation means that the S/N ratio is maximized to show how much the foreground is separated from the background. As far as expressed by the quadratic form, any evaluation formula in Subsection 3.2 can be used. The x that maximizes this equation is the weighting to be obtained in image synthesis, in other words, the optimum lighting condition.

maximize xTQbwnx/xTQwinx, subject to:||x||2=1
シ15シ

The meaning to restrict the norm of x is that the intensity cannot be decided by the evaluation function only (intensity cannot be decided as the evaluation value does not change by constant multiplication of x). The optimum projection direction in Fisher窶冱 linear discrimination can be obtained as the eigenvector corresponding to the maximum eigenvalue in the generalized eigenvalue problem by the Lagrange multiplier method. In the case of the optimization of lighting, the possible negative values of the eigenvector are a problem. While the intensity vector is established in the direction of the eigenvector, the problem is that the negative intensity of the lighting cannot be realized. There are two major approaches to solve this problem.

The first approach is to solve the optimization problem for the lighting intensity vector with the non-negativity condition. This paper shows that the numerical optimization can be applied for the limited cases.

The second approach is to realize pseudo-negative lighting intensity by dividing the lighting intensity into two sets, one for positive and the other for negative intensity, taking the images for both sets with the absolute value used for the negative intensity, and obtaining the differences between these images by image processing. The equivalent results can be obtained for the results of images taken directly with the eigenvector where the original positive and negative intensity coexist in this approach but taking images after at least twice changing the lighting condition is required. The multi-shot imaging inspection is not discussed in this paper.

3.3.1 Solution by Semidefinite Programming Method

It is explained here that the optimum lighting solution in the optimization problem of Fisher窶冱 linear discrimination expressed by the following equation can be obtained quickly with the non-negativity condition by the numerical optimizer, when the number of pairs of the foreground and the background defining the S/N ratio to be maximized is one.

maximize:xTQbwnx/xTQwinx, subject to:||x||2=1, Hx竕ァ0
シ16シ

In this case, Hx竕・ 0 means that all the elements of the vector Hx are non-negative. This problem can be transformed as follows without losing generality.

maximize:xTQwinx,subject to:xTQbwnx=1,Hx竕ァ0
シ17シ

This problem is known as Nonconvex-QCQP (Quadratic Constrained Quadratic Programming) problem that is generally NP-hard, but in this case, semidefinite relaxation5) can be applied, and the solution can be obtained by SDP (Semidefinite Programming). Specifically, xxT is replaced assuming that it is the positive-semidefinite matrix X and is transformed into the following optimization problem.

maximize:シ弭T,Qwinシ曦,subject to:シ弭,Qbwnシ曦=1,HXHT竕ァ0,X竕ァ0,XT-X
シ18シ

In this case, シ廣,Bシ曦シ掖r AB
				T means the Frobenius inner product of the matrix, HXHT竕・ 0 means that all the elements of the matrix are non-negative, X 竕ス 0 means that the matrix X is positive-semidefinite, and XT = X means that the matrix X is symmetric. Optimum solution X of this problem can be obtained quickly using the SDP solver. It is known that the rank of the solution X becomes 1 in almost all cases because of the number of constraints in SDP5), and as it can be approximated as X = xxT, the relative intensity vector as the optimum solution can be obtained by obtaining the eigenvector マ corresponding to the maximum eigenvalue using eigenvalue decomposition of HXHT=HxxTHT=ママT. Because マ 竕・ 0 is guaranteed when HXHT竕・ 0 according to the Perron-Frobenius theorem, all the optimum solutions can be used as the non-negative light setting.

3.3.2 Solution by Multi-objective Optimization

The solution by the SDP explained above can only handle the problem of maximizing the S/N ratio for a pair of a single foreground and background, and the optimization problem containing a quadratic expression that involves the primary term, such as optimization of the brightness, cannot be handled. When multiple S/N ratios for the number of pairs of foregrounds and backgrounds need to be maximized at the same time or when the brightness and contrast are brought close to the desired values, the multi-objective optimization problem must be solved where multiple objective functions are maximized with a balanced approach. To handle such a problem, the weighted sum method6) is used in this paper, where the weighted sum of the individual objective functions is maximized while realizing the appropriate balance between the objective functions adjusting the weighting factor by a large number of trials. Sequential Least Squares Programming (SLSQP) is used for optimization.

4. Evaluation Experiment

4.1 System Configuration

The system configuration used in the evaluation experiment is based on the OMRON image processing system FH series. The multi-CH lighting systems used are the FL-MD180MC and FL-MD90MC, and the cameras used are the FH-SCX12, FH-SMX12, FH-SCX05, and FH-SMX05. The imaging setup is located in a dark room in order to avoid entry of ambient light when basis images are taken. Imaging algorithms by AEC and HDR, dark current offset correction, and calibration function for correction of intensity level - brightness are incorporated as the processing units implemented in FH. Other optimization algorithms and the UI functions run on the PC connected to FH via LAN.

4.2 UI

The teaching UI of the lighting optimization created is shown in Fig. 2. Images of the workpiece are taken after the base level luminescence pattern and imaging method, such as AEC and HDR, are selected in 竭. The image of the workpiece taken is selected in 竭。, and the evaluation criteria and weighting of the multi-objective optimization are input in 竭「. In the entry of the evaluation criteria, multiple workpieces can be referenced at the same time. When optimization is executed, the list of solutions is shown in 竭」, and the solution can be compared and examined confirming the evaluation values of the objective functions in 竭「. When the solution is selected, the intensity level is displayed in 竭、. Depending on the setting of the problem, one axis of brightness is not determined, and the scales can be adjusted in 竭・. When the imaging condition is determined, comparison of the workpiece images displayed in 竭ァ can be made switching the simulation image and actual image in 竭ヲ.

Fig. 2 UI of the lighting optimization demonstration system created
Fig. 2 UI of the lighting optimization demonstration system created

4.3 Installed Software and Execution Time

Python is installed for numerical calculations. Numpy is used for calculation of the matrix, and as computation of the inner product Equation (14) is most time consuming, preprocessing like multi-threading and image shrinkage is applied. For minimization of Equation (18) by SDP, installation of CvxOpt7) is used. The average time required for optimization when N = 39 is 1 to 2 seconds. SLSQP installed in SciPy8) is used for multi-objective optimization. To avoid locally optimized solutions, optimizations are repeated a number of times assigning the initial values N times, and the best solution is selected. The time required is about one second for optimization with the initial value assigned for N times.

4.4 Measures for Entry of Ambient Light

When ambient light other than the light from the lighting equipment enters the image sensor, a difference between the actual image taken and the simulated image will result.

In order to relatively minimize the effect of the ambient light in basis image taking, the technique to always take images with the maximum intensity of lighting and to avoid saturation of the sensor adjusting exposure level of the camera is introduced (AEC imaging).

As another measure for ambient light, the correction process is established where the image under the ambient light is taken with all the lighting devices turned off while the basis image of the workpiece is taken because the presence of ambient light is equal to the situation where one lighting device of the multi-CH lighting stays on. It is confirmed that correction of ambient lighting is possible to the level acceptable in an indoor environment. For verification of the simulation performance in a condition unaffected by ambient light, the result of images of the workpiece taken in the dark room is discussed in this paper.

4.5 Comparison of Images Actually Taken and by Simulation

Fig. 3 shows comparison between the image synthesis simulation results and the actual images for variety of workpieces and illumination pattern.

Fig. 3 Comparison of images actually taken and by simulation
Fig. 3 Comparison of images actually taken and by simulation

Although it is difficult to identify the difference when both images are closely placed, there is a shift of about ツア0.1 in brightness and a color phase shift (shift of brightness by color and by channel). The shift of brightness is caused by the characteristics of the power supply, and the color phase shift is caused by the shift in the estimation of the dark current offset amplified by exposure conversion in AEC imaging. Although improvement by correction is considered possible, it is not considered for the application of optimization of the lighting because the performance at present is satisfactory.

(X) in the figure shows that the ratio of pixel values of the simulation image is within the range of 3 of the shot noise of 20 actual images when the shift in brightness is corrected ideally, and similarly, (Y) shows the ratio of pixel values when the color phase shift is ideally corrected. It is shown that an estimation is possible in most cases within the range of shot noise when these are corrected. The reason why the ratios of (X) and (Y) are low for the workpiece (C) is the effect of the noise in dark areas because of the wide brightness dynamic range.

Another noteworthy disagreement is a certain difference in the degree of white blotting near saturation as shown in the Fig. 4. When the pixel saturates, gradation information is lost due to nonlinear characteristics. Accordingly, when interpolation by demosaicing is applied between the saturated pixels, it will create disagreement between the actual image and the image synthesis. Such phenomenon will appear as disagreement in the degree of white blot near saturation region but it cannot be corrected because it is a theoretical phenomenon.

Fig. 4	Disagreement of contrast in near saturation region in image synthesis simulation
Fig. 4 Disagreement of contrast in near saturation region in image synthesis simulation

4.6 Optimization Assigning S/N Ratio

Define the S/N ratio of the foreground and background by Equations (10), (11), and (15), and let Dwithin be defined as the dispersion of multiple backgrounds and Dbetween as the distance between the defect and the background. Introduce the parameter ホア that indicates the degree of image background removal so that optimization becomes possible with different S/N ratios assigned, and it is re-defined as Dwithin = xT [ホアQwin + (1窶ホア) I ]マ. Fig. 5 shows the results of optimization using SDP with the values of ホア assigned in 10 levels to the metal workpiece with hairline finish. It is shown that the S/N ratio ( Dbetween / Dwithin ) changes according to the degree of image background removal. ホア=0 when contrast is highest in both foreground and background but ホア=1.0 when S/N ratio (ratio of intensity between the foreground and background) is highest, where discriminability between the foreground and background is improved.

Fig. 5 Emphasizing results of defect on the hairline-finished metal surface when the degree of image background removal is changed (simulation vs. actual image)
Fig. 5 Emphasizing results of defect on the hairline-finished metal surface when the degree of image background removal is changed (simulation vs. actual image)

The reason why the lighting color changes when ホア=1.0 is that more favorable color is selected to make the background flat in the sense of the l2 distance involving the color channel of the image.

The contrast of the hairline finish of this workpiece is mostly determined by the intensity ratio balance of the coaxial light (center) and ring light (circumference). When the contrast is increased, only the coaxial light tends to be selected, and when the contrast is decreased, both the coaxial light and ring light are used. When value ホア increases, the lighting pattern becomes complicated, but it is possible to find a simpler lighting pattern with similar performance to these. The reason is that matrix F is near the rank deficient state and the lighting pattern bringing the same performance is not uniquely determined. This is the so-called overtraining condition, and to avoid such condition, the number of workpiece samples should be increased, the number of constraints of the pixel value (brightness) should be increased, or the appropriate basis illumination pattern H should be selected. In the lighting pattern with ホア=1.0, the hairline finish becomes visible when the workpiece is turned by 90ツー, but the lighting pattern robust against turning of the workpiece can be obtained optimizing the base level luminescence pattern with the rotational symmetrical one.

4.7 Optimization Involving the Pixel Value (Brightness)

Fig. 6 shows the example where optimization is made to maximize contrast by multi-objective optimization specifying the pixel value (brightness). As the coaxial light provides the highest contrast in the case of a hairline finished metal surface, only the coaxial light is selected in the left column where constraints in exposure is lowest. The constraints of the exposure time gradually increase towards the right and intensity of illumination decreases accordingly when only the coaxial light is used, which will make the specified pixel value unattainable. Accordingly, optimization is made to maximize brightness by illuminating multiple lights at the same time, and as a result, it is confirmed that contrast is sacrificed. This means that the lighting is optimized to maximize the contrast within the range where the specified brightness is produced. This is the advantage of this technique to obtain optimum lighting by image synthesis overlooking the tradeoff between the exposure level and contrast only by numerical computation in multi-objective optimization.

Fig. 6 Results of maximizing contrast assigning exposure constraints while the mean pixel value maintained constant
Fig. 6 Results of maximizing contrast assigning exposure constraints while the mean pixel value maintained constant

5. Conclusions

The lighting simulation technique using image synthesis for the optimization problem of the multi-CH lighting system for visual inspections is proposed in this paper. It is demonstrated that this technique enables accurate lighting simulation reducing the number of required images taken for optimization exponentially to the logarithmic order of the number of evaluation patterns. The proposed technique is the basic technique that realizes automatized and off-site teaching operations that include the inspection parameter setting.

The authors considered expanding this technique to the simultaneous optimization, including multi-shot imaging inspection and a subsequent inspection, improving usability in multi-objective optimization, and handling of dispersion outside of the sample range by optimization of lighting using simulations of workpiece dispersion.

References

1シ
S. Hayashi, 窶廡ast and automatic lighting parameters determination technology for visual inspection,窶 (in Japanese), OMRON TECHNICS, vol. 52, no. 1, pp. 30-34, 2020.
2シ
E. Tseng, F. Yu, Y. Yang, F. Mannan, K. S. Arnaud, D. Nowrouzezahrai, J. F. Lalonde, and F. Heide, 窶廩yperparameter optimization in blackbox image processing using differentiable proxies,窶 ACM Trans. Graphics (TOG), vol. 38, no. 4, 2019, Art. no. 27.
3シ
N. Chiba and K. Hashimoto, 窶彜parse estimation of light transport matrix under saturated condition,窶 in The 29th British Machine Vision Conf. (BMVC2018), 2018.
4シ
Y. Y. Schechner, S. K. Nayar, and P. N. Belhumeur, 窶廴ultiplexing for optimal lighting,窶 IEEE Trans. Pattern Anal. Mach. Intell., vol. 29, no. 8, pp. 1339-1354, 2007.
5シ
Z. Luo, W. Ma, A. M. So, Y. Ye, and S. Zhang, 窶彜emidefinite relaxation of quadratic optimization problems,窶 in IEEE Signal Proc. Mag., 2010, vol. 27, no. 3, pp. 20-34.
6シ
K. Miettinen, Nonlinear Multi-objective Optimization. Boston, MA: Springer, 1999, p.78-84.
7シ
M. S. Andersen, J. Dahl, Z. Liu, and L. Vandenberghe, 窶廬nterior-point methods for large-scale cone programming,窶 in Optimization for Machine Learning, S. Sra, S. Nowozin, and S. J. Wright Eds. Cambridge, MA, USA: MIT Press, 2012, p. 55-83.
8シ
E. Jones, T. Oliphant, P. Peterson et al., SciPy: Open source scientific tools for Python. 2001. http://www.scipy.org/ (accessed Feb. 1, 2020)シ

The names of products in the text may be the trademarks of each company.