Shooting condition setting system, shooting condition setting method, and program

By setting high-intensity lighting and adjusting exposure time, the impact of ambient light on workpiece photography was resolved, image errors and pixel saturation were reduced, and higher quality workpiece inspection was achieved.

CN116745696BActive Publication Date: 2026-07-10OMRON CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
OMRON CORP
Filing Date
2021-09-14
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

In existing technologies, the impact of ambient light on workpiece photography is not sufficiently reduced, resulting in large errors in image brightness and the pixel saturation problem is not effectively solved.

Method used

By setting the illumination intensity above a threshold and adjusting the exposure time of the imaging device, the pixel values ​​of a specified area of ​​the workpiece image are kept within a specified range, reducing the influence of ambient light. Furthermore, through the optimized design of multi-channel illumination and exposure time, pixel saturation is reduced.

Benefits of technology

The optimized design of lighting modes minimizes the impact of ambient light, improves image quality, reduces pixel saturation, and enables more accurate workpiece inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116745696B_ABST
    Figure CN116745696B_ABST
Patent Text Reader

Abstract

Provided is a photographing condition setting system that can sufficiently reduce the influence of ambient light in the optimal design of an illumination pattern when photographing an inspection object. The system includes a photographing device that photographs an image of a workpiece as an inspection object; an illumination device that includes a light source that irradiates light on the workpiece; and a photographing condition setting section that sets a condition for photographing the workpiece. When the photographing condition setting section performs photographing such that the luminosity of the light irradiated on the workpiece by the illumination device is a value that is equal to or greater than a threshold value, the photographing condition setting section sets an exposure time of the photographing device such that the pixel value of a specified region of the image of the workpiece is a value within a specified range.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a shooting condition setting system, shooting condition setting method, and procedure. Background Technology

[0002] Product visual inspection on the manufacturing floor is one of the areas where machine replacement of human labor has made the least progress, and it is a crucial technical issue that must be addressed with the prospect of a future reduction in the workforce through automation. In recent years, due to the development of artificial intelligence / machine learning technologies, represented by deep learning, the automation technology for inspection has been continuously improving by leaps and bounds.

[0003] However, in visual inspection and general machine vision, the most time-consuming process in building an inspection system is the design of the camera system, which includes the optimization of lighting patterns. Automation in this area has made little progress. When this optimization is performed manually, designing a camera system that can reliably detect defects such as scratches on workpieces (inspection objects) and accommodate individual deviations requires a significant amount of labor. In other words, to achieve the desired inspection performance, it is essential to repeatedly perform optimization and research / adjustment of the inspection algorithm by changing various workpieces and alternating between lighting-based manual adjustments, thus requiring a considerable amount of time.

[0004] When photographing workpieces for inspection, the light illuminating the workpiece includes not only the illumination light but also the ambient light corresponding to the shooting environment. However, since the influence of ambient light is not considered in the simulation used for optimizing the illumination pattern, an error arises between the brightness of the image inferred from the simulation and the actual brightness of the image due to the luminance of the ambient light.

[0005] One approach to this problem is to make the intensity of the illumination light sufficiently greater than that of the ambient light, thereby relatively reducing the influence of ambient light. However, if the intensity is increased, there is a risk of pixel saturation in the image.

[0006] Regarding pixel saturation, Patent Document 1 describes the following: In the case of pixels with saturated brightness values ​​in an image, multiple images are generated when the brightness of the illumination source is changed during the shooting process. For each pixel, the sum of the brightness values ​​is calculated and a composite image is generated.

[0007] Existing technical documents

[0008] Patent documents

[0009] Patent Document 1: Japanese Patent No. 6601264 Summary of the Invention

[0010] The technical problem that the invention aims to solve

[0011] However, in the existing method as described in Patent Document 1, in order to avoid pixel saturation, the luminance of the illumination light illuminating the workpiece is smaller than the maximum luminance that can be illuminated. Therefore, the relative influence of ambient light on the illumination light is not sufficiently reduced, and the error between the inferred brightness of the image and the actual brightness of the image cannot be sufficiently reduced.

[0012] The present invention was made in view of the above circumstances, and its object is to provide a shooting condition setting system that can sufficiently reduce the influence of ambient light in the optimal design of the lighting mode when shooting an inspection object.

[0013] Technical solutions for solving technical problems

[0014] The present invention adopts the following configuration to solve the above-mentioned technical problems.

[0015] An image capture condition setting system according to one aspect of the present invention includes: an image capture device for capturing an image of a workpiece as an inspection object; an illumination device including a light source for illuminating the workpiece; and an image capture condition setting unit for setting the image capture conditions when capturing the workpiece, wherein when the image capture is performed with the illumination intensity of the workpiece illuminating by the illumination device being at or above a threshold value, the image capture condition setting unit sets the exposure time of the image capture device so that the pixel values ​​of a specified area of ​​the image of the workpiece are values ​​within a specified range.

[0016] Based on the above configuration, when photographing the object to be inspected, the illumination light is significantly increased compared to the ambient light, thereby relatively reducing the influence of the ambient light.

[0017] Alternatively, when the shooting condition setting unit takes a picture with the illumination intensity of the workpiece illuminating it at its maximum value, it can set the exposure time of the shooting device so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. This maximizes the illumination light compared to ambient light when photographing an inspection object, thereby significantly reducing the influence of ambient light.

[0018] Alternatively, the lighting device may have multiple light sources with adjustable luminance for each, and the shooting condition setting unit may set the luminance of at least one of the multiple light sources to a value above a threshold. Thus, when using multi-channel lighting, it is possible to maintain the optimal luminance mode for each channel while reducing the influence of ambient light.

[0019] Alternatively, when the pixel value has a non-linear relationship with the exposure characteristics of the imaging device, the shooting condition setting unit can set the exposure time based on the calibration of the imaging device. Therefore, the exposure time can be set regardless of the characteristics of the imaging device, even when those characteristics are unknown.

[0020] Alternatively, the shooting condition setting unit may set the exposure time of the shooting device based on the difference between an image captured when the illuminance of the workpiece illuminated by the lighting device is at or above a threshold and an image captured when the illuminance of the workpiece illuminated by the lighting device is at its minimum, so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. This allows for precise setting of the exposure time based on the image when only light from the lighting device is applied.

[0021] Alternatively, the shooting condition setting unit can set the exposure time of the shooting device based on the difference between an image captured when the luminance of the workpiece illuminated by the lighting device is at or above a threshold value and an image captured when the luminance of the workpiece illuminated by the lighting device is at its minimum value under various ambient light conditions, so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. This allows for setting an exposure time that is robust to the ambient light conditions during shooting.

[0022] Alternatively, when the shooting condition setting unit performs an image capture where at least one of the set value of the luminance irradiated by the illumination device on the workpiece, the measured value of the actual irradiated luminance, and the luminance displayed on the display is at or above a predetermined threshold, the exposure time of the shooting device is set so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. Thus, the exposure time can be set based on any one of the set value, the measured value, or the value displayed on the display device, depending on the system configuration.

[0023] One aspect of the present invention relates to a method for setting shooting conditions, in which a computer determines the shooting conditions for an image of a workpiece to be inspected. In this method, the computer sets the luminance of an illumination device illuminating the workpiece to a value above a threshold; the computer then captures an image of the workpiece under the specified luminance conditions using an imaging device; based on the captured image of the workpiece, the computer sets the exposure time of the imaging device so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. With this configuration, when photographing an inspection object, the illumination light is sufficiently increased compared to the ambient light, thereby relatively reducing the influence of ambient light.

[0024] One aspect of the present invention relates to a procedure in which a computer determining the image-taking conditions for a workpiece to be inspected executes: setting the luminance of an illumination device illuminating the workpiece to a value above a threshold; capturing the workpiece under the luminance conditions using an imaging device; and, based on the captured image of the workpiece, setting the exposure time of the imaging device so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. With this configuration, when capturing an image of an inspection object, the illumination light is sufficiently increased compared to the ambient light, thereby relatively reducing the influence of ambient light.

[0025] Invention Effects

[0026] According to the present invention, a shooting condition setting system can be provided that can sufficiently reduce the influence of ambient light in the optimal design of the lighting mode when shooting an inspection object. Attached Figure Description

[0027] Figure 1 This is a diagram schematically illustrating an example of the configuration of an inspection system according to an embodiment of the present invention.

[0028] Figure 2 This is a top view schematically illustrating an example of the configuration of the light source used in the inspection system according to an embodiment of the present invention.

[0029] Figure 3 This is a schematic diagram illustrating the hardware configuration of the control device included in the inspection system according to an embodiment of the present invention.

[0030] Figure 4 This is a diagram schematically illustrating an example of the functional configuration of an inspection system according to an embodiment of the present invention.

[0031] Figure 5 This is a schematic diagram illustrating an image synthesis model based on the premise that linearity holds in a single-shot check using multi-channel illumination as described in this invention.

[0032] Figure 6 This is a graph showing the CRF function when the relationship between luminance and pixel value is linear and nonlinear, as described in this invention.

[0033] Figure 7 This is a flowchart illustrating the process from determining the lighting conditions of the inspection system involved in the embodiments of the present invention to inspecting the workpiece based on the determined lighting conditions.

[0034] Figure 8 This is a flowchart illustrating the process from determining the lighting conditions of the inspection system involved in the embodiments of the present invention to inspecting the workpiece based on the determined lighting conditions.

[0035] Figure 9This is a flowchart illustrating the process from determining the lighting conditions of the inspection system involved in the embodiments of the present invention to inspecting the workpiece based on the determined lighting conditions.

[0036] Figure 10 This is a flowchart illustrating the process from determining the lighting conditions of the inspection system involved in the embodiments of the present invention to inspecting the workpiece based on the determined lighting conditions. Detailed Implementation

[0037] Hereinafter, an embodiment of the present invention (hereinafter also referred to as "this embodiment") will be described with reference to the accompanying drawings. However, the embodiments described below are merely examples of the present invention in all respects. Undoubtedly, various modifications and variations can be made without departing from the scope of the present invention. That is, specific configurations corresponding to the embodiments may be appropriately adopted when implementing the present invention. It should be noted that the data appearing in this embodiment are described in natural language, but more specifically, they are specified by computer-recognizable virtual language, instructions, parameters, machine language, etc.

[0038] §1 Application Examples

[0039] use Figure 1 An example of a scenario in which the present invention is applied will be described. Figure 1 This is a schematic diagram illustrating an example of an inspection system (shooting condition setting system) 1 according to the present invention. Furthermore, Figure 2 This is a top view schematically illustrating an example of the configuration of the light source used in inspection system 1.

[0040] Inspection system 1 performs visual inspection of workpiece 4, for example, by performing image analysis processing on an input image obtained by photographing the workpiece 4 being transported on belt conveyor 2. Below, as a typical example of image analysis processing, the inspection of the surface of workpiece 4 for defects will be described as an application example, but it is not limited to this; for example, it can also be applied to specifying the type of defect, measuring the appearance shape, etc.

[0041] A camera 102, integrated with the light source LS, is disposed on the upper part of the belt conveyor 2. The camera 102's field of view 6 is configured to include a predetermined area encompassing the belt conveyor 2. Here, the light source LS can be exemplified by, for example, multi-channel illumination such as MDMC (Multi Direction Multi Color) illumination. More specifically, the illumination described in Japanese Patent Application 2018-031747 can be exemplified. The multi-channel illumination light source LS has multiple illumination channels LSi. More specifically, for example, such as... Figure 2As shown, the light source LS has a single circular illumination channel LSi when viewed from above, and 12 concentric fan-shaped illumination channels LSi arranged around it. In this case, the light source LS consists of a total of 13 illumination channels LSi, and when each illumination channel LSi emits tri-color light, the predetermined illumination emission pattern of single-color and single-channel light is 13 × 3 = 39 patterns. Furthermore, the data of the evaluation workpiece image generated by the camera 102 is sent to the control device 100. The camera 102 performs imaging periodically or event-wise.

[0042] The control device 100 causes the light source LS to emit light in multiple evaluation emission modes based on illumination command values ​​as discrete values, and captures multiple evaluation workpiece images related to at least one workpiece illuminated in the multiple evaluation emission modes. Furthermore, based on the multiple evaluation workpiece images, the control device 100 simulates the emission modes by changing parameters of continuous values, and calculates parameters representing the emission modes used to identify the state of the workpiece. Here, the parameters are weighting parameters used to superimpose the multiple evaluation workpiece images to generate a composite image. Then, the control device 100 converts the parameters into illumination command values ​​based on an illuminance LUT.

[0043] The control device 100 captures an inspection image of the workpiece 4, which is the object of inspection, using calculated lighting command values. Furthermore, the control device 100 may include a learner with a CNN (Convolutional Neural Network) engine for the appearance inspection of the workpiece 4. The CNN engine generates feature detection images for each type based on the inspection image. The state of the workpiece 4 (whether it has defects, the size of the defects, or the location of the defects, etc.) is identified based on the generated one or more feature detection images.

[0044] The control device 100 is connected to the PLC (Programmable Logic Controller) 10 and the database device 12 via the upper-level network 8. The calculation results and detection results in the control device 100 can also be sent to the PLC 10 and / or the database device 12. It should be noted that any device other than the PLC 10 and the database device 12 can be connected to the upper-level network 8. Furthermore, the control device 100 can also be connected to a display 104, which serves as an output unit for displaying the status and detection results during the processing, and to input units such as a keyboard 106 and a mouse 108, which serve as input units for receiving user operations.

[0045] In this disclosure, the inspection system 1 illuminates the workpiece (object to be inspected) with an inspection illumination pattern based on an illumination command value as a discrete value, and acquires an image of the workpiece by photographing it with an appropriate sensor. Then, the state of the workpiece (e.g., whether there are scratches or other defects) is identified by image processing of the image of the workpiece.

[0046] To determine the optimal illumination pattern for inspecting a workpiece, inspection system 1 pre-captures multiple evaluation workpiece images associated with at least one workpiece. Then, the inspection system generates a composite image by overlaying the multiple evaluation workpiece images, which are weighted using parameters with continuous values. The composite image is then evaluated using a predetermined evaluation function to calculate parameters representing the illumination pattern suitable for identifying the workpiece's state. Inspection system 1 converts the parameters into illumination command values ​​based on a table that associates illumination command values ​​with the parameters.

[0047] Furthermore, to improve the consistency accuracy between the image synthesis result and the image of the workpiece captured under actual inspection conditions, the inspection system 1 eliminates the influence of ambient light. Specifically, it controls the illumination of each channel LSi of the light source LS to match the optimized emission mode, and also controls the illumination of at least one channel LSi to reach its maximum value. However, while the influence of ambient light can be relatively suppressed when illumination is performed at maximum luminance, there is a possibility of local pixel saturation in the captured image. Therefore, the inspection system 1 adjusts the exposure time or gain of the camera 102 when the illumination luminance is at its maximum value, searching for the optimal exposure time that does not produce pixel saturation.

[0048] §2 Examples of Composition

[0049] (1. Hardware Components)

[0050] Next, use Figure 3 An example of the hardware configuration of the control device 100 included in the inspection system 1 according to one embodiment of the present disclosure will be described. Figure 3 This is a schematic diagram showing the hardware configuration of the control device 100.

[0051] As an example, the control device 100 can also be implemented using a general-purpose computer configured according to a common computer architecture. The control device 100 includes a processor 110, main memory 112, camera interface 114, input interface 116, display interface 118, communication interface 120, and storage device 130. These components are typically interconnected in a communicable manner via an internal bus 122.

[0052] The processor 110 performs the functions and processes described later by expanding and executing various programs stored in the storage device 130 in the main memory 112. The main memory 112 is composed of volatile memory and functions as the working memory required by the processor 110 to execute programs.

[0053] The camera interface 114 is connected to the camera 102 to acquire the evaluation workpiece image 138 and the inspection workpiece image 140 captured by the camera 102. The camera interface 114 can also instruct the camera 102 on recording timing, etc.

[0054] The input interface 116 is connected to input units such as keyboard 106 and mouse 108 to obtain instructions indicating user operations on the input units.

[0055] Display interface 118 outputs various processing results generated by the program executed by processor 110 to display 104.

[0056] The communication interface 120 is responsible for processing communication with the PLC 10 and database device 12 via the upper network 8.

[0057] Storage device 130 stores programs such as OS (Operating System) and inspection program 132 for enabling the computer to function as control device 100. Storage device 130 may also store lighting parameters 134, illuminance LUT 136, multiple evaluation workpiece images 138, and multiple inspection workpiece images 140. Lighting parameters 134 are parameters with continuous values ​​in a dimension equal to the number of evaluation workpiece images, and are weighted parameters used to overlay the multiple evaluation workpiece images 138 to generate a composite image. Illuminance LUT 136 is a table that establishes a relationship between lighting command values ​​and illuminance.

[0058] The inspection program 132 stored in the storage device 130 can also be installed in the control device 100 via an optical recording medium such as a DVD (Digital Versatile Disc) or a semiconductor recording medium such as a USB (Universal Serial Bus) memory. Alternatively, the inspection program 132 can be downloaded from a server device on a network.

[0059] In the case of implementing this using a general-purpose computer, a portion of the functions involved in this embodiment can also be implemented by processing the required software modules provided by the OS in a predetermined order and / or at scheduled times. That is, the inspection program 132 involved in this embodiment may not include all the software modules used to implement the functions involved in this embodiment, but instead provide the required functions by cooperating with the OS.

[0060] Furthermore, the inspection program 132 can also be provided as part of another program. In this case, the inspection program 132 itself does not include modules included in the other program that is combined as described above, but rather performs processing in cooperation with that other program. Thus, the inspection program 132 according to this embodiment can also be in the form of being integrated into another program.

[0061] It should be pointed out that, Figure 3 The illustration shows an example of using a general-purpose computer to implement the control device 100, but it is not limited to this. Specialized circuits (e.g., ASICs (Application Specific Integrated Circuits), FPGAs (Field-Programmable Gate Arrays), etc.) can also be used to implement all or part of its functions. Furthermore, a network-connected external device can also perform some of the processing.

[0062] As described above, from a hardware configuration perspective, inspection system 1 corresponds to an example of "inspection system 1" in this disclosure. Furthermore, workpiece 4 corresponds to an example of "workpiece" in this disclosure. Moreover, light source LS corresponds to an example of "light source" in this disclosure, and camera 102 corresponds to an example of "camera" in this disclosure.

[0063] (2. Functional Composition)

[0064] Next, use Figure 4 An example of the functional configuration of the inspection system 1 according to the embodiments of this disclosure will be described. Figure 4 This diagram schematically illustrates an example of the functional configuration of the inspection system 1 according to an embodiment of the present disclosure. The control device 100 of the inspection system 1 may include a camera unit 141, a calculation unit 142, a conversion unit 143, and a storage unit 144.

[0065] The camera unit 141, computing unit 142, and conversion unit 143 in the control device 100 can be implemented using a general-purpose processor, and are not limited in this disclosure. Alternatively, dedicated circuits (e.g., ASICs (Application Specific Integrated Circuits), FPGAs (Field-Programmable Gate Arrays), etc.) can be used to implement all or part of the functions of these components. Furthermore, a network-connected external device can also perform some of the processing.

[0066] The camera unit 141 causes the light source LS to emit light in multiple evaluation light emission modes based on illumination command values ​​as discrete values, and captures multiple evaluation workpiece images related to at least one workpiece illuminated in the multiple evaluation light emission modes via the camera 102. The camera unit 141 can also capture N evaluation workpiece images.

[0067] The calculation unit 142 simulates a light emission pattern by changing parameters of continuous values ​​based on multiple evaluation workpiece images, and calculates parameters representing the light emission pattern used to identify the state of the workpiece. The calculation unit 142 generates a composite image by overlaying multiple evaluation workpiece images weighted with parameters having a dimension equal to the number of evaluation workpiece images, and evaluates the composite image using a predetermined evaluation function, thereby calculating parameters representing the light emission pattern used to identify the state of the workpiece.

[0068] The conversion unit 143 converts the calculated parameters into lighting command values. The conversion unit 143 converts the parameters into lighting command values ​​based on an illuminance LUT that associates the lighting command values ​​with the parameters.

[0069] The storage unit 144 stores multiple evaluation workpiece images obtained by the imaging unit 141 during the lighting optimization stage, and stores inspection workpiece images obtained by the imaging unit 141 during the inspection stage. Furthermore, the storage unit 144 stores lighting parameters obtained by the calculation unit 142. Additionally, the storage unit 144 stores the illuminance LUT used by the conversion unit 143. The storage unit 144 is implemented by the aforementioned storage device 130, which stores the programs or data required for the operation of the inspection system 1. It should be noted that the control device 100 may not include the storage unit 144, or an external (device) storage device may be used instead of the storage unit 144.

[0070] As described above, from the perspective of functional modules, the control device 100, together with the light source LS and the camera 102, corresponds to an example of the "imaging unit" in this disclosure. Furthermore, the control device 100 functions as an example of the "computing unit" and "conversion unit" in this disclosure.

[0071] §3 Action Examples

[0072] In the following examples of actions, the meanings of the symbols used in the mathematical expressions are shown in Table 1. Bold lowercase letters represent vectors, and bold uppercase letters represent matrices (shown in non-bold form throughout the text). All other symbols are scalars. Furthermore, ∥∥ denotes the L2 norm relative to the vector, [X] i,j This represents the element in row i and column j of matrix X.

[0073] [Table 1]

[0074]

[0075] (Equivalence between multi-channel illumination-based shooting and inner product operations)

[0076] In inspection system 1, an imaging unit 141 using multi-channel illumination as the light source LS is used. Here, it is assumed that linearity (linearity between brightness and QL value) holds true on the sensor side of inspection system 1. That is, this means that linearity holds true in a system that includes signal processing such as color filter de-mosaicing, gamma correction, dark current offset correction, etc. To avoid nonlinearity caused by pixel saturation, image capture can also use HDR (High dynamic range) synthesis, etc. In this case, considering the case of imaging the workpiece 4 illuminated by K-channel illumination LSi, the luminous intensity of each channel illumination is recorded as a vector of the following formula (1).

[0077] [Mathematical Expression 1]

[0078] u = (u1, u2, ..., u) K ) T u k ≥0

[0079] At this time, such as u i =1, u j =0 (j≠i) This means that only the i-th illumination is lit at a predetermined intensity, while the other illuminations are turned off. The resulting images are arranged as column vectors, denoted as f. i At that time, an image g captured under any lighting condition u can be modeled by image synthesis as shown in the following equation (2).

[0080] [Mathematical Expression 2]

[0081]

[0082] Here, f′ is a multi-channel image (a large column vector) obtained by vertically arranging and summing K images defined by the following equation (3).

[0083] [Mathematical Expression 3]

[0084]

[0085] In addition, the definitions of each operator in equations (2) and (3) above are as follows.

[0086] [Mathematical Expression 4]

[0087] Kronecker's accumulation

[0088] e i : standard substrate

[0089] I: Identity matrix

[0090] Thus, the optimization of multi-channel illumination involves performing an inner product operation based on f′ of the original image to generate the feature vector g, which is the projection matrix u. T The optimal design equivalence of the linear projection direction u in ×I ("×" represents the Kronecker product) is equivalent.

[0091] (Acquisition of evaluation images based on a given emission pattern)

[0092] Below, we generally consider a scenario where K lights are installed. For a single workpiece, we change the lighting pattern to perform N-mode photography to determine the optimal lighting (teaching).

[0093] The illumination mode for the nth (1≤n≤N) photo is defined as follows (5):

[0094] [Mathematical Expression 5]

[0095] h n =(h 1,n h 2,n , ..., h K,n ) T h k,n ≥0

[0096] H = [h1, h2, ..., h N ]

[0097] By utilizing these emission patterns to photograph the workpiece, it is possible to reconstruct images of the workpiece illuminated under arbitrary emission patterns. This is equivalent to inferring the LT (Light Transport) matrix. Generally, to obtain all degrees of freedom of the LT matrix, it is desirable to use h... n The emission mode is determined in a linearly independent manner. In order to fully and effectively utilize all K degrees of freedom of illumination, at least N = K, in which case the rank of H, rank(H) = min(N, K), needs to be full rank.

[0098] On the other hand, when N < K, the degree of freedom of the number of illuminations cannot be fully utilized, but it is an effective method to shorten the workpiece imaging time. Various methods can be considered to achieve this; a representative method is the LT matrix inference method, which uses compressed sensing.

[0099] In addition, the case of N>K is also considered. This is an excess of unnecessary shots in the sense of making full and effective use of the degree of freedom of lighting, but it can be chosen to achieve other purposes such as SN ratio and dynamic range.

[0100] The images captured using these illumination patterns are arranged into column vectors, and the result is denoted as f. i The multi-channel image vector obtained by further arranging N images vertically and summing them is defined as follows (6): Here, e i R represents N The standard substrate.

[0101] [Mathematical Expression 6]

[0102]

[0103] The brightness u produced by each illumination channel and the captured image g at this time are represented as shown in equation (7).

[0104] [Mathematical Expression 7]

[0105] u=Hw,w=(w1,w2,…,w N ) T

[0106]

[0107] Here, w i The image synthesis weights (illumination parameters) are used. It should be noted that the command value of the luminous intensity is calculated based on the image synthesis weights, but is not the value itself. The image synthesis weights are usually allowed to take negative values, however, the luminous intensity of the illumination channel must be non-negative, therefore, the following condition (8) is added.

[0108] [Mathematical Expression 8]

[0109] Hw≥0

[0110] Here, the inequality assumption for vectors and matrices applies to all elements. When H = I, that is, when K (= N) images are taken with the illumination applied one by one, u and w are equivalent. Below, we will address the problem of finding the optimal illumination u in this case by determining the optimal image synthesis weight w.

[0111] (Evaluation Criteria for Lighting Optimization)

[0112] Here, after outlining the significance of lighting optimization and its evaluation criteria, the specific processing procedure will be explained with reference to the accompanying drawings. First, the purpose of lighting design in the visual inspection of workpieces is to correctly distinguish between acceptable (normal) and unacceptable (defective) products. Previously, this problem was solved manually by skilled personnel; however, to solve it systematically, it is necessary to pre-determine and limit the "judgment criteria" and the "degrees of freedom in lighting design control."

[0113] Here, given a predetermined discrimination algorithm as the judgment criterion and multi-channel lighting such as MDMC lighting as the control degrees of freedom, the lighting optimization problem is formalized as a "cross-entropy minimization problem" that ensures the classification of qualified / unqualified products aligns with the correct solution. It should be noted that when the decider in the workpiece label determination is a machine learning machine, lighting optimization and decider learning can be performed simultaneously, automatically tuning each other to maximize their performance.

[0114] However, a major problem when minimizing cross-entropy is the need for a large number of samples with labels attached to qualified / unqualified products. Especially when optimizing lighting with a large degree of freedom, it is difficult to uniquely determine the optimal lighting if only a small number of qualified / unqualified labels are used as a benchmark. This problem becomes a significant technical concern when an inspection system is launched without a large number of evaluation images of the workpieces (sample images).

[0115] Therefore, in order to solve this problem, this disclosure proposes a method for optimizing lighting based on the evaluation criteria (contrast, brightness, and similarity) of the image itself. In this case, the necessary conditions for optimal lighting design in the appearance inspection of workpieces, etc., can be roughly listed as follows.

[0116] [Required Condition 1] Features that are easy to see and easy to identify as conforming (labels) and non-conforming (labels) products (that is, defects are easy to see).

[0117] [Required Condition 2] It is not easy to see the deviation of qualified products (single item deviation).

[0118] However, the two necessary conditions are usually of opposite nature, thus achieving a balance between them in lighting design becomes a challenging technical problem in lighting optimization. Below, we employ an evaluation criterion that satisfies these conditions, solving the problem under the constraint that the luminous intensity of the lighting is positive. Therefore, the evaluation criterion is understood as a discriminant analysis, representing the evaluation criterion of the image in two-dimensional form. In this case, the problem can be solved using SDP (Semidefinite Programming).

[0119] Regardless of the evaluation criterion used, the evaluation function for lighting optimization can be expressed as the minimization of a function F that takes M images of workpieces as input, as shown in equation (9). The result obtained through this optimization is denoted as w. i Image composition weights (illumination parameters). This refers to the luminance of the i-th substrate emission mode, which is originally a discrete quantity because the illumination command value is discrete, but here it is continuously mitigated and treated as a continuous quantity.

[0120] [Mathematical Expression 9]

[0121]

[0122] Limited by: Hw≥0

[0123]

[0124] Figure 5 This is a schematic diagram illustrating an image synthesis model that assumes linearity in the single-shot check of multichannel illumination as described in this disclosure.

[0125] This optimization problem can be searched using a continuous quantity with fewer dimensions than u, but w, thus enabling efficient implementation. The optimal image synthesis weights w are described below. opt It is recorded as w.

[0126] (How to adjust exposure time)

[0127] Here, as examples of methods for adjusting exposure time, AEC (Auto Exposure Control) shooting and HDR (High Dynamic Range) shooting are explained. Both shooting methods involve using an exposure time t such that pixel saturation within the region of interest (ROI) is avoided when the workpiece is illuminated by the substrate's illumination mode. n Take photos. It should be noted that the exposure time t will be used. t The captured image is used as the base image.

[0128] In AEC shooting, the brightness (target pixel value y) of the image as the target is first determined. t The settings include capturing images at arbitrary exposure times and extracting the ROI (Region of Interest) from the image S. n Calculate the image S n The largest pixel value y among the included pixels m (Focus pixel value) is converted to target pixel value y. t Required exposure time t t Target pixel value y t The threshold y is set as the pixel underexposure threshold. min The threshold y that becomes pixel saturation max The values ​​between.

[0129] The camera's CRF (Camera Response Function) is used to calculate and convert the value to the target pixel value y. t Required exposure time t tIt should be noted that the CRF is assumed to be a known value. The CRF is a function that represents the relationship between luminance and pixel value. When using the CRF function f(i,t), the pixel value y is represented by the following general formula.

[0130] y = f(i,t) + d

[0131] Here, i represents illuminance, t represents exposure time, and d represents dark current offset.

[0132] Regarding the CRF function f(i,t), as a characteristic of the camera, when the light intensity is linear with respect to the exposure time, it can be expressed as f(i)*t, a*i*t (where a is a coefficient representing the weight), and when it is non-linear with respect to the exposure time, it can be expressed as f(i*t), i*f(t), f1(i)*f2(t).

[0133] Figure 6 The graph shows the CRF function f for linear and non-linear relationships between luminance I and pixel value y. CRF (i,t). Here, y m This indicates that you are interested in pixel values, y t Indicates the target pixel value, t m This indicates the exposure time (t) for the pixel value being monitored. t This indicates the exposure time used to obtain the target pixel value.

[0134] Next, the exposure time t was obtained. t The process is explained, and the exposure time t is... t This is used to obtain the target pixel value that we ultimately want to find. First, based on the pixel value of interest y... m The luminance I is calculated using the following formula. m .

[0135] I m =f -1 CRF (y m -d)

[0136] Next, based on the target pixel value y t The luminance I is calculated using the following formula. t .

[0137] I t =f -1 CRF (y t -d)

[0138] Next, calculate t. t =I t / I m .

[0139] t t It can be expressed by the following formula.

[0140] (Linear case)

[0141] (y t -d) / (y m -d)·t m

[0142] (The case of non-linearity)

[0143] f -1 CRF (y t -d)·t m / f -1 CRF (y m -d)

[0144] Here, we assume that d (the pixel value when the luminance is zero) is a fixed value for calculation. If the above assumption does not hold, correction processing is required.

[0145] In AEC shooting mode, images are repeatedly taken at arbitrary exposure times to obtain the maximum pixel value (the pixel value of interest). m Become the target pixel value y t Exposure time t t .

[0146] In HDR shooting, the image is first captured with the shortest exposure time, and the pixel value y of the pixel with the largest pixel value in the image is calculated based on CRF. m Become the target pixel value y t Exposure time t t Next, the same process is repeated for the remaining pixels, and for all pixels, the target pixel value y is calculated. t Exposure time t t .

[0147] (General formula for image composition with variable exposure time)

[0148] Next, the exposure time τ of the image to be synthesized and the exposure time τ of the captured base image are compared. n The image synthesis method under different conditions will be explained. The calculation formula for image synthesis in this case is shown in the following formula (10). The following formula is the synthesis formula for n (1≤n≤N) images captured in the substrate illumination mode, f n This represents the image captured in the nth substrate illumination mode. n The composite weights for each image are shown. τ represents any exposure time.n This represents the exposure time when photographing the workpiece in the nth substrate luminescence mode.

[0149] [Mathematical Expression 10]

[0150]

[0151] The difference from the case where the exposure time is constant is that the base image is converted to luminance relative to a unit exposure time to reproduce the image at any exposure time τ. It should be noted that here, it is assumed that the camera's CRF is linear. In the case of a non-linear CRF, correction processing is required.

[0152] (Photometric correction based on ambient light images)

[0153] One reason for the discrepancy between the brightness of the actual captured image and the brightness of the synthesized base image is the influence of ambient light. To reduce the influence of ambient light, in this embodiment, the luminance of the illumination is increased, thereby relatively reducing the influence of ambient light. Furthermore, based on the image of the workpiece captured in the state of off illumination (ambient light image), the luminance of the ambient light mixed into the base image is corrected, thereby further improving accuracy. The calculation formula for image synthesis incorporating luminance correction based on the ambient light image is shown in equation (11) below. n (1≤n≤N) represents the number of images captured in the base illumination mode, f n This represents the image captured in the nth substrate illumination mode. n The composite weights of the images are represented by τ, where τ represents any exposure time. n This represents the exposure time when photographing the workpiece in the nth substrate luminescence mode.

[0154] [Mathematical Expression 11]

[0155]

[0156] The idea behind photometric correction in Equation (11) is to reconstruct the image after converting the base image and ambient light image into a common photometric index. n iτ is the ambient light image converted to the exposure time of each base image, and iτ is the ambient light image converted to the exposure time of the composite image. They are based on the ambient light image z as a reference, as shown in equation (12) below. In the following equation, f z This is an image taken when all channels of illumination are at their minimum luminance. τ z This indicates the exposure time when shooting under ambient light.

[0157] [Mathematical Expression 12]

[0158]

[0159]

[0160] Next, use Figure 7 The flowchart describes the process from determining the lighting conditions (teaching stage) in the inspection system 1 of this embodiment to inspecting the workpiece according to the determined lighting conditions (inspection stage).

[0161] like Figure 7 As shown, firstly, during the teaching phase, for N lighting emission modes, system 1 is checked to ensure that it conforms to the maximum luminosity vector T satisfying each mode. max Illumination is applied to M workpieces using light intensity, and N×M images are captured for evaluation. n,m (S101). At this time, the inspection system 1 examines each image f n,m The exposure time τ within the ROI does not produce pixel saturation. n,m To take photos. Here, f n,m The exposure times are respectively expressed as τ n,m .

[0162] Next, the inspection system 1 performs the determination of lighting conditions (S102). The inspection system 1 receives the evaluation formula F for lighting optimization from the user, and uses the evaluation formula F to evaluate N×M captured images f. n,m and each image f n,m Exposure time τ n,m An evaluation is conducted to determine the optimal lighting condition vector T and exposure time τ.

[0163] Next, in the inspection phase, the inspection system 1 captures an inspection image of the workpiece being inspected (S103). The inspection system 1 illuminates the workpiece using the illumination condition vector T and exposure time τ calculated in the teaching phase, and captures an inspection image g.

[0164] Then, the inspection system 1 inputs the captured inspection image into the inspection decision maker (e.g., a decision maker using CNN), and outputs the decision result based on the inspection parameter P (S104).

[0165] It should be noted that in cases of camera CRF nonlinearity, such as Figure 8 As shown in the flowchart, at the beginning of the teaching phase, camera calibration is performed (S100), followed by the capture of images for evaluation.

[0166] In addition, Figure 9In the flowchart shown, during the teaching phase, the influence of ambient light is further eliminated with excellent accuracy by calculating the difference between the image taken under the condition of maximizing the illumination intensity and the image taken under the condition of minimizing the illumination intensity (ambient light image).

[0167] Specifically, in step S101, N×M evaluation images were captured at maximum light intensity. n,m Next, shooting is performed under ambient light only (S201). Specifically, at the minimum luminance vector T min Under conditions such as (e.g., in an off state), capture ambient light images f of each workpiece. z Regarding exposure time, aim for an exposure time τ that will not cause pixel saturation. z To proceed.

[0168] Next, the image f captured at the maximum intensity obtained in step S101 is generated. n,m Compared with the ambient light image f obtained in step S201 z The difference image f' n,m (S202).

[0169] Next, the inspection system 1 determines the lighting conditions (S203). The inspection system 1 receives an evaluation formula F for lighting optimization from the user, and uses the evaluation formula F to evaluate the N×M difference images f' obtained in step S202. n,m An evaluation is conducted to determine the optimal lighting condition vector T and exposure time τ.

[0170] (Optimization of lighting conditions and inspection parameters based on multiple ambient light images)

[0171] exist Figure 9 In the flowchart shown, ambient light images were captured while keeping the ambient light conditions constant, but... Figure 10 In the flowchart shown, a scenario is envisioned where ambient light conditions change (e.g., changes in sunlight conditions over time), and an image of the ambient light is captured.

[0172] Specifically, firstly, in step S101, images f are captured for evaluation at maximum light intensity for M workpieces. n,m Next, for each workpiece, at the minimum photometric vector T min Under the conditions of different ambient light conditions, i ambient light images f were captured. i,d (S301). Regarding the exposure time of the ambient light image, the exposure time τ should be such that each image will not produce pixel saturation. i,d To proceed.

[0173] Next, the image f captured at the maximum intensity obtained in step S101 is generated. n,m Compared with the ambient light image f obtained in step S301 i,d The difference image f' i,n,m (S302). Generate i differential images for each workpiece.

[0174] Next, the inspection system 1 determines at least one of the lighting conditions and inspection parameters (S303). The inspection system 1 receives an evaluation formula F for lighting optimization and an inspection algorithm A as inputs, and uses the evaluation formula F and the inspection algorithm A to process the i×N×M difference images f' obtained in step S302. i,n,m An evaluation was conducted to determine the optimal lighting condition vector T and exposure time τ, and to check the parameter P.

[0175] In this way, for the same workpiece, multiple ambient light images with different ambient light conditions are used to determine the lighting conditions, thereby enabling the calculation of lighting conditions that are robust to changes in ambient light. Furthermore, by utilizing multiple ambient light images, inspection parameters that are robust to changes in ambient light can also be searched.

[0176] It should be noted that in the above example, the lighting conditions and inspection parameters were directly obtained using multiple ambient light images. However, it is also possible to generate multiple ambient light images through numerical calculations based on an ambient light model (e.g., a model where the image vector x follows a multidimensional normal distribution N(μ,Σ)) to obtain lighting conditions and inspection parameters that are robust to ambient light. Here, μ=E[x] is a vector representing the average value of each pixel value in multiple ambient light images, and Σ=E[(x-μ)(x-μ)]. T ] is the variance-covariance matrix among the pixels of multiple ambient light images.

[0177] In summary, according to this embodiment, when photographing a workpiece, the luminance of the illumination light is set to the maximum, and the camera exposure is adjusted to avoid pixel saturation. Therefore, by maximizing the illumination light, the influence of ambient light can be relatively sufficiently reduced.

[0178] Furthermore, even with nonlinear CRF characteristics in the camera, the exposure time required to achieve maximum illumination is determined based on camera calibration. Therefore, exposure time adjustment is possible even when the CRF is unknown, regardless of camera characteristics.

[0179] Furthermore, when optimizing the exposure time, the difference between the image captured with maximum illumination and the image captured with minimum illumination is used. This allows for precise exposure adjustment based on the image captured only when illuminated by the minimum illumination.

[0180] Furthermore, when optimizing exposure time, the difference between an image captured with maximum illumination and an image captured with minimum illumination under various ambient light conditions is used. This allows for robust exposure adjustments based on the ambient light conditions at the time of shooting.

[0181] It should be noted that in the above embodiments, the camera's exposure or gain is adjusted by making the light from the illumination the maximum intensity. However, if the intensity is strong enough to be stronger than the ambient light, it is not necessarily limited to the maximum intensity, and light with an intensity of a certain value or higher can also be used.

[0182] The embodiments of the present invention have been described in detail above, but the description so far is merely illustrative in all respects. Undoubtedly, various modifications and variations can be made without departing from the scope of the present invention. It should be noted that some or all of the above embodiments may also be described as follows, but are not limited to the following content.

[0183] (Note 1)

[0184] A shooting condition setting system (1) includes:

[0185] The imaging device (102) captures an image of the workpiece (4) to be inspected;

[0186] The lighting device (LS) includes a light source for illuminating the workpiece (4); and a shooting condition setting unit (100) for setting the shooting conditions when shooting the workpiece (4).

[0187] When the shooting condition setting unit (100) takes a picture by making the light intensity of the workpiece (4) illuminated by the lighting device (LS) at a value above a threshold, the exposure time of the shooting device (102) is set so that the pixel value of a specified area of ​​the image of the workpiece (4) is a value within a specified range.

[0188] (Note 2)

[0189] According to the shooting condition setting system (1) described in Note 1, wherein,

[0190] When the shooting condition setting unit (100) takes a picture by illuminating the workpiece (4) with the illumination device (LS) at the maximum value, it sets the exposure time of the shooting device (102) so that the pixel value of a specified area of ​​the image of the workpiece (4) is a value within a specified range.

[0191] (Note 3)

[0192] According to the shooting condition setting system (1) described in Note 1 or 2, wherein,

[0193] The lighting device (LS) has multiple light sources, each capable of adjusting its own luminous intensity.

[0194] The shooting condition setting unit (100) sets the luminance of at least one of the plurality of light sources to a value above a threshold.

[0195] (Note 4)

[0196] According to any one of Notes 1 to 3, the shooting condition setting system (1) wherein,

[0197] When the pixel value has a non-linear relationship with the exposure characteristics of the shooting device, the shooting condition setting unit sets the exposure time based on the calibration of the shooting device.

[0198] (Note 5)

[0199] According to any one of Notes 1 to 4, the shooting condition setting system (1) wherein,

[0200] The shooting condition setting unit (100) sets the exposure time of the shooting device (102) based on the difference between the image captured when the light intensity of the workpiece (4) illuminated by the lighting device (LS) is above a threshold value and the image captured when the light intensity of the workpiece (4) illuminated by the lighting device (LS) is at the minimum value, so that the pixel value of a specified area of ​​the image of the workpiece (4) is a value within a specified range.

[0201] (Note 6)

[0202] According to any one of Notes 1 to 4, the shooting condition setting system (1) wherein,

[0203] The shooting condition setting unit (100) sets the exposure time of the shooting device (102) based on the difference between an image captured when the luminance of the workpiece (4) illuminated by the lighting device (LS) is above a threshold value and an image captured when the luminance of the workpiece (4) illuminated by the lighting device (LS) is at the minimum value under different ambient light conditions, so that the pixel value of a specified area of ​​the image of the workpiece (4) is a value within a specified range.

[0204] (Note 7)

[0205] According to any one of notes 1 to 6, the shooting condition setting system (1) wherein,

[0206] When the shooting condition setting unit (100) takes a picture with at least one of the set value of the light intensity of the workpiece (4) illuminated by the lighting device (LS), the measured value of the actual light intensity, and the light intensity displayed on the display being a value above a predetermined threshold, the exposure time of the shooting device (102) is set so that the pixel value of a specified area of ​​the image of the workpiece is a value within a specified range.

[0207] (Note 8)

[0208] A method for setting shooting conditions involves determining the shooting conditions for an image of a workpiece (4) to be inspected using a computer (1). In this method,

[0209] The computer (1) sets the luminance of the illumination device (LS) that irradiates the workpiece (4) to a value above a threshold.

[0210] The computer (1) photographs the workpiece (4) under the light conditions using the imaging device (102);

[0211] The computer (1) sets the exposure time of the shooting device (102) based on the captured image of the workpiece (4) so ​​that the pixel value of a specified area of ​​the image of the workpiece (4) is a value within a specified range.

[0212] (Note 9)

[0213] A program that enables a computer (1) to execute images of a workpiece (4) to be inspected:

[0214] The luminance of the illumination device (LS) that irradiates the workpiece (4) is set to a value above the threshold.

[0215] The workpiece (4) is photographed by the imaging device (102) under the specified light intensity conditions; and

[0216] Based on the captured image of the workpiece (4), the exposure time of the capturing device (102) is set so that the pixel values ​​of a specified area of ​​the image of the workpiece (4) are within a specified range.

[0217] Explanation of reference numerals in the attached figures

[0218] 1…Inspection system, 2…Belt conveyor, 4…Workpiece, 6…Camera field of view, 8…Upper network, 10…PLC, 12…Database device, 100…Control device, 102…Camera, 104…Display, 106…Keyboard, 108…Mouse, 110…Processor, 112…Main memory, 114…Camera interface, 116…Input interface, 118…Display interface, 120…Communication interface, 122…Internal bus, 130…Storage device, 132…Inspection program, 134…Lighting parameters, 136…Illumination LUT, 138…Workpiece image for evaluation, 140…Workpiece image for inspection, 141…Camera unit, 142…Calculation unit, 143…Conversion unit, 144…Storage unit, LS…Light source, LSi…Channel illumination.

Claims

1. A shooting condition setting system, comprising: An imaging device for capturing images of the workpiece to be inspected; The lighting device includes a light source for illuminating the workpiece; and The shooting condition setting unit sets the shooting conditions when shooting the workpiece. When the shooting condition setting unit takes a picture by making the light intensity of the workpiece illuminated by the lighting device at a value above a threshold, it sets the exposure time of the shooting device so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. The shooting condition setting unit sets the exposure time of the shooting device based on the difference between an image captured when the luminance of the workpiece illuminated by the lighting device is above a threshold value and an image captured when the luminance of the workpiece illuminated by the lighting device is at the minimum value, so that the pixel values ​​of a specified area of ​​the image of the workpiece are values ​​within a specified range.

2. A shooting condition setting system, comprising: An imaging device for capturing images of the workpiece to be inspected; The lighting device includes a light source for illuminating the workpiece; and The shooting condition setting unit sets the shooting conditions when shooting the workpiece. When the shooting condition setting unit takes a picture by making the light intensity of the workpiece illuminated by the lighting device at a value above a threshold, it sets the exposure time of the shooting device so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range. The shooting condition setting unit sets the exposure time of the shooting device based on the difference between an image captured when the luminance of the workpiece illuminated by the lighting device is above a threshold value and an image captured when the luminance of the workpiece illuminated by the lighting device is at the minimum value under various ambient light conditions, so that the pixel values ​​of a specified area of ​​the image of the workpiece are values ​​within a specified range.

3. The shooting condition setting system according to claim 1 or 2, wherein, When the shooting condition setting unit takes a picture by maximizing the light intensity of the illumination device on the workpiece, it sets the exposure time of the shooting device so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range.

4. The shooting condition setting system according to claim 1 or 2, wherein, The lighting device has multiple light sources, each with adjustable light intensity. The shooting condition setting unit sets the luminance of at least one of the plurality of light sources to a value above a threshold.

5. The shooting condition setting system according to claim 1 or 2, wherein, When the pixel value has a non-linear relationship with the exposure characteristics of the shooting device, the shooting condition setting unit sets the exposure time based on the calibration of the shooting device.

6. The shooting condition setting system according to claim 1 or 2, wherein, When the shooting condition setting unit takes a picture with at least one of the set value of the light intensity irradiated by the lighting device on the workpiece, the measured value of the actual irradiated light intensity, and the light intensity displayed on the display being a value above a predetermined threshold, the exposure time of the shooting device is set so that the pixel value of a specified area of ​​the image of the workpiece is a value within a specified range.

7. A method for setting shooting conditions, wherein a computer determines the shooting conditions for an image of a workpiece to be inspected, wherein in the shooting condition setting method, The computer sets the luminance of the illumination device that illuminates the workpiece to a value above a threshold. The computer takes a picture of the workpiece under the specified light conditions using an imaging device; Based on the captured image of the workpiece, the computer sets the exposure time of the imaging device so that the pixel values ​​of a specified area of ​​the workpiece image are within a specified range. The computer sets the exposure time of the imaging device based on the difference between an image captured when the luminance of the workpiece illuminated by the lighting device is above a threshold value and an image captured when the luminance of the workpiece illuminated by the lighting device is at a minimum value, so that the pixel values ​​of a specified area of ​​the image of the workpiece are within a specified range.

8. A method for setting shooting conditions, wherein a computer determines the shooting conditions for an image of a workpiece to be inspected, wherein in the method for setting shooting conditions, The computer sets the luminance of the illumination device that illuminates the workpiece to a value above a threshold. The computer takes a picture of the workpiece under the specified light conditions using an imaging device; Based on the captured image of the workpiece, the computer sets the exposure time of the imaging device so that the pixel values ​​of a specified area of ​​the workpiece image are within a specified range. The computer sets the exposure time of the imaging device based on the difference between an image captured when the luminance of the workpiece illuminated by the lighting device is above a threshold value and an image captured when the luminance of the workpiece illuminated by the lighting device is at the minimum value under various ambient light conditions, so that the pixel values ​​of a specified area of ​​the image of the workpiece are values ​​within a specified range.

9. A computer-readable storage medium storing a program that causes a computer to execute conditions for determining the image-taking conditions of a workpiece to be inspected: The luminance of the illumination device that irradiates the workpiece is set to a value above a threshold. The workpiece is photographed by an imaging device under the specified light intensity conditions; and Based on the captured image of the workpiece, the exposure time of the imaging device is set so that the pixel values ​​of a specified area of ​​the workpiece image are within a specified range. The exposure time of the imaging device is set based on the difference between an image captured when the luminance of the workpiece illuminated by the illumination device is above a threshold value and an image captured when the luminance of the workpiece illuminated by the illumination device is at its minimum value, so that the pixel values ​​of a specified area of ​​the image of the workpiece are values ​​within a specified range.

10. A computer-readable storage medium storing a program that causes a computer determining the conditions for capturing an image of a workpiece as an object of inspection to execute: The luminance of the illumination device that irradiates the workpiece is set to a value above a threshold. The workpiece is photographed by an imaging device under the specified light intensity conditions; and Based on the captured image of the workpiece, the exposure time of the imaging device is set so that the pixel values ​​of a specified area of ​​the workpiece image are within a specified range. Based on the difference between an image captured when the luminance of the workpiece illuminated by the lighting device is above a threshold value and an image captured when the luminance of the workpiece illuminated by the lighting device is at its minimum value under various ambient light conditions, the exposure time of the imaging device is set so that the pixel values ​​of a specified area of ​​the image of the workpiece are values ​​within a specified range.