WO2013111373A1 - 画像検査方法および画像検査装置 - Google Patents

画像検査方法および画像検査装置 Download PDF

Info

Publication number
WO2013111373A1
WO2013111373A1 PCT/JP2012/073686 JP2012073686W WO2013111373A1 WO 2013111373 A1 WO2013111373 A1 WO 2013111373A1 JP 2012073686 W JP2012073686 W JP 2012073686W WO 2013111373 A1 WO2013111373 A1 WO 2013111373A1
Authority
WO
WIPO (PCT)
Prior art keywords
inspection
image
inspection area
area
definition information
Prior art date
Application number
PCT/JP2012/073686
Other languages
English (en)
French (fr)
Inventor
湊善久
柳川由紀子
Original Assignee
オムロン株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by オムロン株式会社 filed Critical オムロン株式会社
Priority to US14/370,601 priority Critical patent/US9619877B2/en
Priority to CN201280067331.6A priority patent/CN104053984A/zh
Priority to EP12866952.0A priority patent/EP2808674A4/en
Publication of WO2013111373A1 publication Critical patent/WO2013111373A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • G01N21/88Investigating the presence of flaws or contamination
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • G06T7/001Industrial image inspection using an image reference approach
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/143Segmentation; Edge detection involving probabilistic approaches, e.g. Markov random field [MRF] modelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/174Segmentation; Edge detection involving the use of two or more images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/24Indexing scheme for image data processing or generation, in general involving graphical user interfaces [GUIs]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20076Probabilistic image processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20092Interactive image processing based on input by user
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30164Workpiece; Machine component

Definitions

  • the present invention relates to an image inspection apparatus that performs an appearance inspection using an image.
  • image inspection devices that perform visual inspections using images are widely used.
  • the basic configuration is to image the inspection object with an image sensor (camera), extract the part that will be the inspection area from the obtained image, By analyzing / evaluating the characteristics of the image in the inspection area, the target inspection (for example, good / bad determination, sorting, information acquisition, etc.) is performed.
  • the inspection object has individual differences or is not positioned, the setting of the inspection area becomes more difficult. For example, assuming the inspection of vegetables transported on a belt conveyor, there is no one with the same shape, and accurate positioning is not possible, so the position and orientation of the inspection area in the image depends on the inspection object It will be different. Therefore, if a high-precision inspection is to be performed, it is necessary to set an inspection region for each inspection object every time or to correct a preset inspection region each time, and automatic inspection cannot be performed.
  • the inspection area is set to be sufficiently narrow compared to the inspection object, it is difficult to be affected by individual differences and fluctuations in position and orientation, so it is possible to perform automatic inspection using the same inspection area, but that method In this case, since a part that is out of the inspection area comes out, there is a risk of inspection leakage.
  • an inspection region extraction method using binarization or color gamut extraction is known. That is, this is a method of extracting a pixel group corresponding to a preset luminance range or color gamut from an image and using the pixel group as an inspection region.
  • This method is effective when the brightness or color contrast of the part (foreground) to be extracted as the inspection area and the other part (background) is high, and it can cope with the above-mentioned complicated shape and simplify the setting work.
  • the following problems still remain.
  • the foreground part you want to extract as the inspection area is shaded by the influence of lighting, etc.
  • the foreground part is composed of various brightness or colors, or there are colors close to the foreground part in the background, binary It is difficult to accurately extract only the foreground part by conversion or color gamut extraction.
  • the inspection content has become more sophisticated and subdivided. For example, if you want to perform surface inspection only on one cutting surface of molded parts, or only one part on a printed circuit board on which many parts are mounted. In many cases, there is almost no color difference between the background and the foreground.
  • binarization and color gamut extraction are performed for each pixel of the image, it is easily affected by noise and lighting fluctuations. As a result, there is a problem that the inspection accuracy is lowered due to selection of pixels.
  • Patent Document 1 as a method for setting an inspection area, a method for setting the position and size of an inspection area from CAD data of a component to be inspected, and an inspection is performed by taking a difference between two images before and after component mounting. A method for recognizing a power region is disclosed. If these methods are used, it is possible to automatically set the inspection area, but these methods are limited in applicable objects and lack generality.
  • the present invention has been made in view of the above circumstances, and the object of the present invention is simple and high even if the object is a complicated shape or a special shape, or the foreground and background colors are misleading.
  • An object of the present invention is to provide a technique that makes it possible to set an inspection area with high accuracy.
  • a further object of the present invention is to automatically set the inspection area adaptively even when there are individual differences in the inspection object or when the position / orientation of the inspection object is indeterminate, enabling high-precision inspection. It is to provide technology to do.
  • parameters used as constraint conditions in the optimum solution search process are given to the image inspection apparatus as inspection region definition information.
  • the image inspection apparatus uses the inspection area definition information as a constraint condition to obtain an optimal solution for the inspection area from the inspection object image, thereby individually checking each inspection object. The position and shape of the inspection area are determined.
  • the present invention relates to an image inspection method executed by an image inspection apparatus, an acquisition step of acquiring an inspection object image obtained by imaging an inspection object, and inspection area definition information stored in advance.
  • an inspection processing step for inspecting the inspection object by analyzing the inspection area image, and the inspection area definition information is a parameter used as a constraint condition in the optimal solution search process
  • an optimal solution search process for obtaining an optimal solution of the inspection region from the inspection object image using the parameter as a constraint condition is performed.
  • Ukoto by, characterized in that the position and shape of the individual inspection area for each inspection object of is determined.
  • an accurate inspection area can be automatically set even for an inspection object having a complicated shape or a special shape.
  • the inspection area can be automatically set.
  • an accurate inspection area can be set in accordance with the inspection object, it is possible to perform a highly accurate inspection as compared with the conventional case.
  • the optimal solution search process is a plurality of candidate areas that are candidate solutions of an inspection area based on color or luminance information of each pixel in the inspection object image and edge information included in the inspection object image.
  • a pixel separation that is a degree of color or luminance separation between the inside and outside of each candidate area, and an edge overlap that is a degree of overlap between the outline of each candidate area and an edge in the inspection object image It is preferable that the process is to obtain an optimal solution for the inspection region from the plurality of candidate regions by evaluating both the degrees.
  • edge information is also used to comprehensively evaluate both the pixel separation of color or luminance between the inside and outside of the inspection area and the edge overlap of the outline of the inspection area. Compared to the conventional methods such as binarization and color gamut extraction, the region extraction accuracy can be improved.
  • the inspection area definition information preferably includes, as one of parameters, a balance parameter for adjusting a weight when evaluating the pixel separation degree and the edge overlap degree.
  • a balance parameter for adjusting a weight when evaluating the pixel separation degree and the edge overlap degree.
  • a value obtained by evaluating the foreground likelihood of the color or brightness of each pixel inside the candidate area with respect to the representative color or representative brightness of the foreground, or each outside the candidate area with respect to the representative color or representative brightness of the background It is preferable to use a value obtained by evaluating the background of pixel color or brightness, or a value obtained by combining both values as the pixel separation degree.
  • the extraction accuracy of the inspection area can be increased. Note that when calculating a value that evaluates the foreground likelihood, all the pixels inside the candidate region may be used, or only some of the pixels may be used. Similarly, when calculating a value that evaluates the likelihood of background, all the pixels outside the candidate region may be used, or only some of the pixels may be used.
  • the inspection area definition information preferably includes, as one of the parameters, foreground and / or background representative color information or representative luminance information.
  • any parameters other than those described above may be given as long as they can affect the search for the optimum solution in the inspection region.
  • information indicating the characteristics of the inspection area shape, size, position in the image, texture, topology, adjacent elements, inclusion elements, etc. are given as parameters.
  • characteristics of the inspection area And the inspection area solution search may be performed so that the degree of similarity between the parameters and the characteristics given by these parameters is also high. In this way, by using various characteristics of the inspection region as constraint conditions, the extraction accuracy of the inspection region can be further improved.
  • the inspection area definition information setting step includes a step of acquiring a sample image obtained by photographing a sample of the inspection object, a step of receiving a parameter input from the user, and a step of receiving a parameter input from the user. Performing the optimal solution search process on the sample image while updating the constraint condition based on the input parameter, and driving in a parameter capable of obtaining a desired inspection region in the sample image; And storing a parameter used when a desired inspection area can be obtained in the sample image in the storage device as inspection area definition information.
  • the present invention can also be regarded as an image inspection apparatus having at least one of the above-described means, or as an inspection area setting apparatus for an image inspection apparatus having at least one of the above-described means related to inspection area setting. You can also.
  • the present invention can also be understood as an image inspection method or an inspection region setting method for executing at least one of the above processes, a program for causing a computer to execute such a method, or a storage medium storing the program.
  • the inspection region can be automatically set automatically and high-precision inspection can be performed.
  • the figure which shows the structure of an image inspection apparatus typically.
  • the flowchart which shows the flow of an inspection process.
  • inspection processing. 6 is a flowchart showing a flow of processing for setting an inspection region using a setting tool 103;
  • Embodiments described below relate to an image inspection apparatus that performs an appearance inspection using an image, and an inspection area setting apparatus that supports an operation of creating inspection area definition information to be given to the image inspection apparatus.
  • This image inspection apparatus is suitably used for applications in which a large number of articles are continuously or automatically inspected in an FA production line or the like.
  • the type of article to be inspected does not matter, but in the image inspection apparatus of the present embodiment, the inspection area is adaptively determined for each inspection object using the original image captured by the image sensor, and inspection is performed.
  • the present invention can be particularly preferably applied to a case where the position / shape of the inspection area in the original image varies for each inspection object.
  • the inspection area setting device of the present embodiment can be suitably applied to any inspection.
  • the inspection region setting device is mounted in the form of one function (setting tool) of the image inspection device, but the image inspection device and the inspection region setting device may be configured separately.
  • FIG. 1 schematically shows the configuration of the image inspection apparatus.
  • the image inspection apparatus 1 is a system that performs an appearance inspection of an inspection object 2 that is transported on a transport path.
  • the image inspection apparatus 1 includes hardware such as an apparatus main body 10, an image sensor 11, a display device 12, a storage device 13, and an input device 14.
  • the image sensor 11 is a device for taking a color or monochrome still image or moving image into the apparatus main body 10, and for example, a digital camera can be suitably used. However, when a special image (such as an X-ray image or a thermo image) other than a visible light image is used for inspection, a sensor that matches the image may be used.
  • the display device 12 is a device for displaying an image captured by the image sensor 11, an inspection result, a GUI screen related to inspection processing and setting processing, and for example, a liquid crystal display can be used.
  • the storage device 13 is a device that stores various setting information (inspection area definition information, inspection logic, etc.), inspection results, and the like that the image inspection apparatus 1 refers to in the inspection processing.
  • various setting information inspection area definition information, inspection logic, etc.
  • inspection results and the like that the image inspection apparatus 1 refers to in the inspection processing.
  • an HDD, SSD, flash memory, network storage Etc. are available.
  • the input device 14 is a device that is operated by a user to input an instruction to the device main body 10.
  • a mouse, a keyboard, a touch panel, a dedicated console, or the like can be used.
  • the apparatus main body 10 can be configured as a computer including a CPU (Central Processing Unit), a main storage (RAM), and an auxiliary storage (ROM, HDD, SSD, etc.) as hardware.
  • An inspection processing unit 101, an inspection region extraction unit 102, and a setting tool 103 are provided.
  • the inspection processing unit 101 and the inspection area extraction unit 102 are functions related to the inspection processing, and the setting tool 103 is a function that supports setting work by the user of setting information necessary for the inspection processing. These functions are realized by loading a computer program stored in the auxiliary storage device or the storage device 13 into the main storage device and executing it by the CPU. Note that FIG.
  • the apparatus main body 10 may be configured by a computer such as a personal computer or a slate type terminal, or may be configured by a dedicated chip or an on-board computer.
  • FIG. 2 is a flowchart showing a flow of the inspection process
  • FIG. 3 is a diagram for explaining an inspection region extraction process in the inspection process.
  • the flow of the inspection process will be described by taking as an example inspection (detection of scratches and color unevenness) of the panel surface of the casing component of the mobile phone.
  • step S20 the inspection object 2 is photographed by the image sensor 11, and the image data is taken into the apparatus main body 10.
  • the captured image (original image; inspection object image) is displayed on the display device 12 as necessary.
  • the upper part of FIG. 3 shows an example of the original image.
  • a case part 2 to be inspected is shown in the center of the original image, and a part of the case part adjacent to the conveyance path is shown on the left and right sides thereof.
  • the inspection area extraction unit 102 reads necessary setting information from the storage device 13.
  • the setting information includes at least inspection area definition information and inspection logic.
  • the inspection area definition information is information that defines some parameters used as constraint conditions in the subsequent inspection area search process. Examples of parameters given as inspection area definition information will be described later.
  • the inspection logic is information that defines the content of the inspection process, and includes, for example, the type of feature amount used for inspection, the determination method, the parameter used in feature amount extraction and determination processing, the threshold value, and the like.
  • the inspection region extraction unit 102 separates the original image into a foreground and a background (segmentation) using the inspection region definition information (parameter) read in step S21, and selects the foreground portion as the inspection region.
  • the edge information included in the original image is also used, and a plurality of candidate areas that are candidate solutions of the inspection area are between the foreground and the background (that is, The degree of color separation (called the pixel separation) between the inside and outside of the candidate area, and the degree of overlap between the foreground and background borders (that is, the outline of the candidate area) and the edges in the original image (This is called edge overlap) is comprehensively evaluated to search for an optimal solution that increases both pixel separation and edge overlap.
  • an optimal inspection region is determined individually according to individual differences and postures of the inspection object 2. Details of the optimum solution search process will be described later.
  • step S23 the inspection region extraction unit 102 extracts a portion of the inspection region from the original image according to the inspection region obtained in step S22.
  • the middle part of FIG. 3 shows a state in which the inspection area (indicated by cross hatching) 30 obtained in step S22 is superimposed on the original image. It can be seen that the inspection region 30 just overlaps the panel surface of the casing component 2.
  • the lower part of FIG. 3 shows a state in which an image of the portion of the inspection region 30 (inspection region image 31) is extracted from the original image.
  • the inspection area image 31 the conveyance path and adjacent components that have been shown around the casing component 2 are deleted. Further, the hinge part 20 and the button part 21 that are excluded from the target parts for the surface inspection are also deleted.
  • the inspection area image 31 obtained in this way is delivered to the inspection processing unit 101.
  • step S24 the inspection processing unit 101 extracts a necessary feature amount from the inspection region image 31 according to the inspection logic.
  • the color of each pixel of the inspection region image 31 and its average value are extracted as the feature amount for inspecting the surface for scratches and color unevenness.
  • step S25 the inspection processing unit 101 determines the presence or absence of scratches or uneven color according to the inspection logic. For example, when a pixel group in which the color difference with respect to the average value obtained in step S24 exceeds a threshold value, the pixel group can be determined as a flaw or color unevenness.
  • step S26 the inspection processing unit 101 displays the inspection result on the display device 12 or records it in the storage device 13. Thus, the inspection process for one inspection object 2 is completed.
  • the processing of steps S20 to S26 in FIG. 2 is repeated in synchronization with the timing at which the inspection object 2 is conveyed within the angle of view of the image sensor 11.
  • the inspection area image 31 includes a background portion or an extra portion (in the example of FIG. 3, the hinge portion 20 or the button portion 21), the pixel may become noise and reduce the inspection accuracy. This is because if the inspection area image 31 is smaller than the range to be inspected, there is a risk of inspection leakage. Therefore, in the image inspection apparatus 1 according to the present embodiment, a setting tool 103 for easily creating inspection area definition information for cutting out an accurate inspection area image is prepared.
  • FIG. 4 is a flowchart showing a flow of processing for setting inspection region definition information using the setting tool 103
  • FIG. 5 is a diagram showing an example of an inspection region setting screen.
  • the setting screen shown in FIG. In this setting screen, an image window 50, an image capture button 51, a foreground designation button 52, a background designation button 53, a priority adjustment slider 54, and a confirmation button 55 are provided. Operations such as button selection and slider movement can be performed using the input device 14. Note that this setting screen is merely an example, and any UI may be used as long as parameter input and inspection area confirmation described below can be performed.
  • the setting tool 103 captures a sample of the inspection object by the image sensor 11 (step S40).
  • a sample a non-defective inspection object (a housing part in the above example) is used, and it is preferable to perform imaging in the same state (relative position between the image sensor 11 and the sample, illumination, etc.) as in the actual inspection process. .
  • the obtained sample image data is taken into the apparatus main body 10.
  • the setting tool 103 may read sample image data from the auxiliary storage device or the storage device 13. .
  • the sample image acquired in step S40 is displayed in the image window 50 of the setting screen as shown in FIG. 5 (step S41).
  • step S42 the user inputs foreground and background representative colors (representative brightness in the case of a monochrome image).
  • the foreground refers to a portion to be extracted as an inspection region
  • the background refers to a portion other than the inspection region.
  • the user presses the foreground designation button 52 on the setting screen to enter the foreground designation mode, and then designates a portion to be the foreground on the sample image displayed in the image window 50. Since the designation here is for the purpose of picking up a representative color of the foreground, in the example of FIG. 5, a part of pixels or a group of pixels on the panel surface of the casing component may be appropriately selected.
  • the foreground includes a pattern, a shadow, or a greatly different portion of color
  • the background designation button 53 is pressed to switch to the background designation mode. Note that it is not essential to input the foreground and background representative colors. Only one of the foreground and the background may be input, or when the representative color is known or when the representative color can be automatically calculated from the color distribution of the sample image, step S42 may be omitted. .
  • the setting tool 103 separates (samples) the sample image into the foreground and the background based on the foreground / background representative colors specified in step S42, and selects the foreground portion as an inspection region.
  • the edge information included in the sample image is also used, and a plurality of candidate areas that are candidate solutions of the inspection area are between the foreground and the background (that is, The degree of color separation (pixel separation) between the inside and outside of the candidate area, and the degree of overlap between the foreground and background boundary (that is, the outline of the candidate area) and the edge in the sample image (edge overlapping degree) ) are comprehensively evaluated to search for an optimal solution that increases both pixel separation and edge overlap.
  • the optimum solution search process here uses the same algorithm as the optimum solution search process used in the determination of the inspection area in the inspection process (step S22).
  • step S44 the inspection area calculated in step S43 is displayed on the image window 50 of the setting screen.
  • the user can confirm whether or not a desired area is selected as the inspection area by looking at the inspection area displayed on the setting screen. At this time, it is preferable to overlay and display the inspection area on the sample image, because comparison between the inspection object and the inspection area becomes easy.
  • the setting tool 103 waits for input from the user (step S45).
  • the setting tool 103 When the confirm button 55 is pressed, the setting tool 103 generates inspection area definition information for the current parameter and stores it in the storage device 13 (step S46).
  • the inspection area definition information stored in the storage device 13 is used in the inspection process.
  • parameters such as the foreground representative color, the background representative color, and the priority (balance parameter) between the color information and the edge information are described in the inspection area definition information.
  • color information such as pixel values and color histograms may be used as parameters as they are, or information processed from such color information (color information is modeled). Information) can also be used as a parameter.
  • the histogram may be expressed as a Gaussian mixture model or modeled using kernel density estimation as the parameter.
  • the parameters given as the inspection area definition information are not limited to the foreground representative color, the background representative color, and the priority between the color information and the edge information. Various parameters may be given.
  • the user can adjust the parameters by operating the foreground designation button 52, the background designation button 53, and the priority adjustment slider 54. (Step S47). If the representative color of the foreground or the background is designated again, the evaluation of the pixel separation degree described above is affected. Further, when the priority between the color information and the edge information is changed by the priority adjustment slider 54, the balance (weight) at the time of evaluating the pixel separation degree and the edge overlap degree can be changed.
  • the setting tool 103 When receiving the input (change) of the parameter from the user, the setting tool 103 recalculates the optimal solution for the inspection area using the new parameter as a constraint condition, and displays the inspection area after the recalculation on the screen (step S47). ⁇ S43, S44). With such a function, it is possible to repeat the calculation of the inspection area until a desired result is obtained while appropriately adjusting the parameters.
  • FIG. 6 shows an example of the process of driving parameters.
  • the inspection area 30 obtained by the first calculation is shown in the upper part.
  • the hinge part 20 and the button part 21 of the housing part are also included in the inspection area 30, but here the hinge part 20 and the button are used for the purpose of inspecting the panel surface for scratches and color unevenness.
  • the part 21 is to be excluded from the examination area (see FIG. 3). Therefore, first, the user presses the background designation button 53 to switch to the background designation mode, and additionally designates the color of the button portion 21 in the sample image as the representative color of the background. As a result, the button portion 21 is removed from the inspection region 30 as in the image example shown in the middle.
  • the hinge portion 20 is dealt with by adjusting the balance parameter because the color difference from the panel surface is small. That is, paying attention to the edge generated at the step between the hinge portion 20 and the panel surface, the priority adjustment slider 54 increases the priority of the edge information. As a result, as in the image example shown in the lower part, the contour of the inspection region 30 is set at the edge between the hinge portion 20 and the part surface, and the desired inspection region 30 is formed.
  • the optimal solution search process in the inspection process (step S22 in FIG. 2) and the optimal solution search process in the inspection area setting process (step S43 in FIG. 4) are based on the same algorithm. Hereinafter, a specific calculation method will be described.
  • the optimal solution search process of the present embodiment by comprehensively evaluating both the degree of pixel separation between the foreground and the background and the degree of edge overlap at the boundary between the foreground and the background, Find the optimal solution from the candidate solutions.
  • This calculation can be regarded as an optimization problem that minimizes (or maximizes) an objective function including a function that evaluates pixel separation based on color information and a function that evaluates edge overlap based on edge information.
  • a method for solving the inspection region optimization problem using the graph cut algorithm will be described. Since the graph cut algorithm is a known technique (see Non-Patent Document 1), the description of the basic concept of the graph cut algorithm is omitted in this specification, and the following description focuses on the parts specific to this embodiment. Do.
  • an energy function is defined as the following equation as an objective function, and a solution L that minimizes the energy E when I is given is obtained.
  • I is a sample image
  • L is a label (that is, an inspection region) indicating whether it is foreground or background.
  • i and j are pixel indexes
  • is a pixel group in the image I
  • N is an adjacent pixel pair group in the image I.
  • li and lj are designated labels for pixels i and j, respectively. It is assumed that a label “1” is given for the foreground and “0” is given for the background.
  • the first term on the right side is called a data term and gives a constraint condition for the target pixel i.
  • the second term on the right-hand side is called a smoothing term and gives a constraint on the pixels i and j adjacent to each other.
  • is a balance parameter that determines the weight (balance) of the data term and the smoothing term.
  • the data term is defined by a function that evaluates pixel separation based on the color information described above.
  • the evaluation function U of the data term may be defined by the following formula.
  • the probability density function in the foreground likelihood the one estimated from the foreground representative color (for example, the color distribution of the foreground representative color approximated by a Gaussian mixture model) is used.
  • the probability density function in the background likelihood uses a value estimated from the background representative color (for example, a color distribution of the background representative color approximated by a Gaussian mixture model). That is, the data term represents the sum of the foreground likelihood of each foreground pixel and the background likelihood of each background pixel. The closer the foreground pixel color is to the foreground representative color, the closer the background pixel color is to the background representative color. The energy decreases, and conversely, the energy increases as the foreground pixel color moves away from the foreground representative color, and as the background pixel color moves away from the background representative color.
  • the smoothing term is defined by a function that evaluates the degree of edge overlap based on the edge information described above.
  • the evaluation function V of the smoothing term can be defined by the following equation.
  • Ii and Ij are pixel values (color or luminance) of the pixels i and j, respectively, and ⁇ is a coefficient.
  • ⁇ Ii ⁇ Ij ⁇ 2 represents a difference (distance) of pixel values in a predetermined color space, that is, the height of contrast between pixels.
  • the energy increases when the contrast of the pixels i and j is low, and the energy decreases when the contrast is high.
  • the portion where the contrast of adjacent pixels is high is a portion where the color or brightness in the image is greatly changed, that is, an edge portion in the image. That is, in the above formula, the energy decreases as the boundary between the foreground and the background (pixel pairs having different labels) overlaps the edge in the image.
  • the energy function described above has a global minimum solution when a certain mathematical condition (submodularity) is satisfied. Similarly, a global minimum solution can be obtained with constraints by adding terms satisfying submodularity. Note that a known search algorithm may be used for an efficient solution of the global minimum solution, and a detailed description thereof is omitted here.
  • “foreground representative color” and “background representative color” affect the value of the data item.
  • the “priority of color information and edge information” corresponds to the balance parameter ⁇ . That is, if the user increases the priority of color information, the value of parameter ⁇ is decreased to increase the weight of the data term, and if the user increases the priority of edge information, the value of parameter ⁇ is increased and smoothed. The term weight is increased. Note that the value of the parameter ⁇ can be automatically determined by a computer (setting tool 103).
  • the setting tool 103 calculates the difference between the foreground representative color and the background representative color, and when the difference is large, the value of the parameter ⁇ is decreased and the weight of the data term is increased. This is because if the difference between the foreground and background colors is clear, it can be estimated that the reliability of the data term is high. Conversely, when the difference between the foreground representative color and the background representative color is small, the value of the parameter ⁇ is increased and the weight of the smoothing term is increased. This is because when the difference between the foreground and background colors is not clear, the region division based on the edge information tends to give better results than the color information.
  • the initial value of the balance parameter ⁇ is automatically determined by the above method, and the balance parameter ⁇ (priority of color information and edge information) is adjusted by the user using the initial value as a starting point. This is because it can be expected that the higher the validity of the initial value, the more the number of trials and errors of the user can be reduced, and the workload for parameter adjustment can be reduced.
  • the sum of the foreground likelihood (foreground likelihood) of the foreground pixel and the background likelihood (background likelihood) of the background pixel is used as a data term.
  • a product of foreground-likeness and background-likeness, a weighted sum, a weighted product, a nonlinear function sum, a nonlinear function product, or the like may be used.
  • a monotonically increasing function may be used as the nonlinear function.
  • only the foreground or background evaluation can be used as the pixel separation degree.
  • Equation (2) a function that satisfies U (li
  • Equation (4) is a function that evaluates only the foreground quality.
  • foreground-likeness calculation may use all foreground pixels (that is, all pixels inside the candidate area) or only some foreground pixels.
  • all background pixels that is, all pixels outside the candidate area
  • only some of the background pixels may be used in calculating the background likelihood.
  • the calculation time can be shortened by excluding the pixels for which the label is determined from the calculation, or by using only the pixels within a predetermined distance from the outline of the candidate area for the calculation.
  • the function for evaluating the foreground quality or the background quality is not limited to the expression (2).
  • a likelihood ratio that is a ratio between the foreground likelihood and the background likelihood can be used as in the following equation.
  • the histogram of the pixel group designated as the foreground representative color by the user is directly used (without estimating the probability density function), and the foreground likelihood is evaluated based on the similarity of the color of each pixel to the foreground representative color histogram, or vice versa.
  • the background likelihood may be evaluated based on the degree of color difference of each pixel with respect to the foreground representative color histogram.
  • the background likelihood is evaluated based on the similarity to the histogram (background representative color histogram) of the pixel group designated as the background representative color by the user, or the foreground likelihood is evaluated based on the difference from the background representative color histogram. May be.
  • the similarity or dissimilarity between the foreground histogram obtained from the foreground pixel group of the candidate area and the background histogram obtained from the background pixel group, and the foreground representative color histogram or background representative color histogram is determined by a predetermined function or distance. You may calculate using a parameter
  • the three parameters of the foreground representative color, the background representative color, and the priority of the color information and the edge information have been described. Any parameter can be used.
  • industrial products are mainly used for visual inspection, there are cases in which the shape, texture, topology, elements adjacent to the inspection area, elements included in the inspection area, etc. are characteristic. Many.
  • the inspection object is set so that it fits within the angle of view when the image sensor is installed, the size of the portion serving as the inspection region and the position in the image can be predicted to some extent.
  • the user input such information representing the characteristics of the inspection region as a parameter, and add a constraint condition in the objective function that evaluates the degree of similarity between the feature given by the parameter and the feature of the inspection region.
  • a constraint condition in the objective function that evaluates the degree of similarity between the feature given by the parameter and the feature of the inspection region.
  • the shape information that represents the characteristics related to the shape of the inspection area is often the basic shape of the inspection area (circular, quadrilateral, triangular, star shape, etc.) and the characteristics of the outline (linear outline, round outline, jaggedness) Certainly can be used.
  • a UI for inputting shape information a list of basic shape templates and outline features may be displayed in a list, and the user may select a corresponding one from the list.
  • a basic shape template is designated, for example, the following expression may be inserted as a constraint condition.
  • li is a designated label of pixel i
  • ti is a label of a point corresponding to pixel i on the template.
  • T () represents affine transformation.
  • the above expression represents an operation of performing template matching on the candidate region while enlarging / reducing, rotating, and deforming the designated template, and calculating the minimum score. That is, by adding this constraint condition, the energy of the region having a shape close to the basic shape designated by the user is reduced, and the optimum solution is preferentially selected.
  • the jaggedness or smoothness is designated as the contour feature
  • the following expression may be inserted as a constraint condition.
  • S is a point on the contour of the foreground area
  • is a gradient angle of the contour
  • ⁇ / ⁇ S represents a change amount of the gradient angle along the contour of the foreground region
  • C is a constant indicating the jaggedness (smoothness) specified by the user, and the greater the jaggedness, the larger C, and the smoother, the smaller C.
  • the above equation is a function for evaluating whether or not the total value of the change amount of the gradient angle of the contour of the foreground region (representing the jaggedness of the contour) is close to the value C (representing the specified jaggedness). That is, by adding this constraint condition, a region having a contour feature close to the jaggedness specified by the user is preferentially selected as the optimum solution.
  • the size information representing the characteristics related to the size of the inspection region the area of the inspection region, the length and width, and the like can be used.
  • the following expression may be inserted as a constraint condition.
  • C is the area (number of pixels) of the foreground region designated by the user. Since the foreground label is 1 and the background label is 0, ⁇ li represents the total number of foreground pixels, that is, the area of the foreground region. Therefore, the above expression is a function for evaluating whether the area of the foreground region is close to the designated area C.
  • a region having a size close to the user-specified area is preferentially selected as the optimum solution.
  • the barycentric coordinates of the inspection region As the position information representing the feature related to the position of the inspection region in the image, the barycentric coordinates of the inspection region, the existence range of the inspection region (upper, lower, right, left, center,%) Can be used.
  • the barycentric coordinates are input as the position information, for example, the following expression may be inserted as a constraint condition.
  • w is the barycentric coordinate of the foreground area
  • C is the barycentric coordinate specified by the user.
  • the above expression is a function for evaluating whether or not the barycentric coordinates of the foreground region are close to the designated coordinates C.
  • a region having a center of gravity at a position close to user-specified coordinates is preferentially selected as the optimum solution.
  • texture information representing the characteristics related to the texture of the inspection region information representing the pattern, color shading, unevenness, material, etc. in the inspection region can be used.
  • various texture templates may be displayed in a list and the user may select a corresponding one from the list.
  • the following expression may be inserted as a constraint condition.
  • I is a sample image
  • E is a texture template designated by the user.
  • h 1 1 () represents a color histogram of the foreground pixels
  • f () is a function indicating the similarity of the histograms.
  • the above expression is a function for evaluating whether the color histogram of the foreground area in the sample image is similar to the color histogram of the designated texture.
  • the inspection area obtained from the sample image is not used for the inspection process as it is, but the parameters (constraint conditions) used in the process of obtaining the optimum solution of the inspection area from the sample image are subjected to the image inspection.
  • the device 1 is given.
  • the image inspection apparatus 1 reads the parameters from the storage device and executes the optimum solution search process using the parameters, thereby determining the position and shape of the inspection region individually for each inspection object. Yes. Therefore, it is possible to automatically set an accurate inspection area even for inspection objects with complex shapes or special shapes, and when the inspection object has individual differences or the position and orientation of the inspection object are indefinite.
  • an adaptively accurate inspection area can be automatically set. Furthermore, in this embodiment, since edge information is used in addition to color / luminance information and an algorithm that comprehensively evaluates both pixel separation and edge overlap is employed, binarization and color gamut extraction are performed. Compared with the conventional method, the extraction accuracy of the region can be improved. Therefore, according to the image inspection apparatus 1 of the present embodiment, the range that can be handled as an inspection object is widened, and it is possible to perform inspection with higher accuracy than in the past.
  • the setting tool 103 can allow the user to arbitrarily select which of the priority of the color information and the edge information is given priority on the setting screen. For example, in the case of an image with many pseudo contours, such as a pattern included in the foreground or background, it is likely that better results will be obtained if color and brightness information is prioritized over edge information. In the case of images with similar colors, it is more likely that better results will be obtained if priority is given to edge information. It is very difficult to reach a correct answer completely automatically for such an image where it is difficult to separate the foreground and the background.
  • the above-described embodiments show specific examples of the present invention, and are not intended to limit the scope of the present invention to these specific examples.
  • the color information of the image is used.
  • luminance information may be used instead of the color information.
  • the graph cut algorithm is used for optimization, but other methods such as a level set algorithm can also be used.
  • the inspection area can be calculated with high accuracy by using the color information (luminance information) and the edge information. Also in this case, it is preferable that the priority of color information (luminance information) and edge information can be changed by the user.
  • SYMBOLS 1 Image inspection apparatus 2: Inspection object (housing

Abstract

 本発明では、最適解探索処理において拘束条件として用いられるパラメタを検査領域定義情報として画像検査装置に与える。そして、検査対象物の検査を行う際は、画像検査装置がこの検査領域定義情報を拘束条件として用いて検査対象物画像の中から検査領域の最適解を求めることにより、検査対象物ごとに個別に検査領域の位置及び形状を決定する。

Description

画像検査方法および画像検査装置
 本発明は、画像による外観検査を行う画像検査装置に関する。
 生産ラインにおける検査の自動化・省力化のために、画像による外観検査を行う画像検査装置が広く利用されている。外観検査の種類や手法には様々なものが存在するが、基本的な構成は、画像センサ(カメラ)で検査対象物を撮影し、得られた画像から検査領域となる部分を抽出し、その検査領域の部分の画像の特徴を解析・評価することで、目的の検査(例えば、良/不良の判定、仕分け、情報取得など)を行うというものである。
 この種の画像検査装置においては、検査処理を開始する前に、検査領域の設定などの準備作業を行う必要がある。一般的な装置では、検査領域を設定するための専用のツールが用意されており、ユーザはそのツールを使用して検査対象物や検査目的などに応じた適切な検査領域を自ら設定できるようになっている。しかしながら、従来のツールは、円・四角形などの単純図形又はその組み合わせで検査領域を定義する機能しか持ってない。したがって、検査対象物の形状が複雑もしくは特殊な場合には、検査対象物の輪郭に検査領域を正確に合わせることができないことがある。また単純図形の組み合わせで検査対象物の輪郭を表現できる場合であっても、組み合わせる図形の数が多くなると検査領域の設定に多大な時間と作業負担を要してしまう。近年では、多品種少量生産での効率向上のために段取り時間をできるだけ短縮したいというニーズが強く、検査領域の設定に手間がかかるのは望ましくない。しかしその一方で、製品形状の複雑化や検査内容の高度化・細分化に対応するため、また検査の精度や信頼性の向上のために、検査の対象とすべき部分のみに検査領域を正確に設定したいというニーズも強い。
 また、検査対象物が個体差をもつ場合や位置決めされていない場合には、検査領域の設定はさらに難しくなる。例えば、ベルトコンベア上を搬送される野菜の検査を想定した場合、一つとして同じ形状のものはなく、また正確な位置決めもできないので、画像内での検査領域の位置や向きは検査対象物ごとに違ってくる。そのため、高精度な検査を行おうとすると、検査対象物ごとに毎回検査領域を設定するか、あるいは予め設定した検査領域を毎回修正する必要があり、自動検査ができない。検査対象物に比べて検査領域を十分狭く設定すれば、個体差や位置・向きの変動の影響を受け難くなるので、同じ検査領域を使って自動検査を行うことも可能ではあるが、その方法では検査領域から外れる部分が出てきてしまうため、検査の漏れを生じるおそれがある。
 検査領域を自動で設定する手法としては、従来、二値化や色域抽出による検査領域抽出手法が知られている。つまり、画像の中から予め設定された輝度範囲もしくは色域に該当するピクセル群を抽出し、そのピクセル群を検査領域とする手法である。この手法は、検査領域として抽出したい部分(前景)とそれ以外の部分(背景)の輝度もしくは色のコントラストが高い場合には有効であり、上述した複雑な形状への対応、設定作業の簡単化といった課題はある程度解決されるが、依然として下記のような課題が残る。
 検査領域として抽出したい前景部分に照明などの影響による陰影があったり、前景部分が様々な輝度もしくは色で構成されていたり、背景の中に前景部分に近い色が存在していたりすると、二値化や色域抽出では前景部分のみを正確に抽出することは困難である。最近では、検査内容の高度化や細分化が進み、例えば成型加工部品における1つの切削面だけを対象とした表面検査を行いたいとか、多数の部品が実装されたプリント基板上の1つの部品だけを検査したいなど、背景と前景の色差がほとんど無いケースも現に多い。また、二値化や色域抽出は、画像のピクセル毎に行われるので、ノイズや照明変動の影響を受けやすく、抽出した検査領域の中にピクセルの抜けがあったり、逆に背景部分から飛び地のようにピクセルが選択されてしまったりして、検査精度を低下させるという問題もある。
 特許文献1には、検査領域の設定方法として、検査対象部品のCADデータから検査領域の位置や大きさを設定する方法、部品実装前と後の2枚の画像の差分をとることで検査すべき領域を認識する方法などが開示されている。これらの方法を使えば検査領域を自動で設定することが可能であるが、これらの方法は適用できる対象が限られてしまい、汎用性に欠ける。
特開2006-58284号公報
Y. Boykov and M.-P. Jolly: "Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D images", ICCV2001, 01, p. 105 (2001).
 本発明は上記実情に鑑みてなされたものであり、その目的とするところは、複雑な形状や特殊な形状の対象の場合や、前景と背景の色が紛らわしい場合であっても、簡単かつ高精度に検査領域を設定することを可能にする技術を提供することにある。本発明のさらなる目的は、検査対象物に個体差がある場合や検査対象物の位置・向きが不定の場合であっても、適応的に検査領域を自動設定し、高精度な検査を可能にする技術を提供することにある。
 上記目的を達成するために、本発明では、最適解探索処理において拘束条件として用いられるパラメタを検査領域定義情報として画像検査装置に与える。そして、検査対象物の検査を行う際は、画像検査装置がこの検査領域定義情報を拘束条件として用いて検査対象物画像の中から検査領域の最適解を求めることにより、検査対象物ごとに個別に検査領域の位置及び形状を決定する。
 具体的には、本発明は、画像検査装置が実行する画像検査方法であって、検査対象物を撮影して得られた検査対象物画像を取得する取得ステップと、検査領域定義情報を予め記憶している記憶装置から、前記検査領域定義情報を読み込む設定読込ステップと、前記検査領域定義情報に基づいて、前記検査対象物画像から検査領域とする部分を検査領域画像として抽出する検査領域抽出ステップと、前記検査領域画像を解析することにより前記検査対象物の検査を行う検査処理ステップと、を有しており、前記検査領域定義情報は、最適解探索処理において拘束条件として用いられるパラメタであり、前記検査領域抽出ステップでは、前記パラメタを拘束条件として用いて検査対象物画像の中から検査領域の最適解を求める最適解探索処理を行うことによって、各々の検査対象物に対して個別に検査領域の位置及び形状が決定されることを特徴とする。
 この構成によれば、最適解探索処理によって検査対象物ごとに検査領域の位置及び形状を求めるので、複雑な形状や特殊な形状をもつ検査対象物に対しても正確な検査領域を自動設定できる。しかも、検査対象物に個体差がある場合や検査対象物の位置・向きが不定の場合であっても、適応的に検査領域を自動設定できる。そして、検査対象物にあわせて正確な検査領域を設定できるようにしたことで、従来に比べて高精度な検査を行うことが可能となる。
 前記最適解探索処理は、前記検査対象物画像における各ピクセルの色又は輝度の情報、及び、前記検査対象物画像に含まれるエッジの情報に基づいて、検査領域の候補解である複数の候補領域について、各候補領域の内側と外側の間での色又は輝度の分離の度合いであるピクセル分離度と、各候補領域の輪郭と前記検査対象物画像中のエッジとの重なりの度合いであるエッジ重なり度の両方を評価することにより、前記複数の候補領域の中から検査領域の最適解を求める処理であることが好ましい。
 色・輝度の情報に加えてエッジの情報も用い、検査領域の内側と外側の間での色又は輝度のピクセル分離度と検査領域の輪郭のエッジ重なり度の両方を総合的に評価することで、二値化や色域抽出といった従来手法に比べて、領域の抽出精度を向上することができる。
 前記検査領域定義情報は、パラメタの一つとして、前記ピクセル分離度と前記エッジ重なり度を評価する際の重みを調整するためのバランスパラメタを含んでいることが好ましい。検査対象物の種類や撮像環境によって、色や輝度による分離がしやすいケースとエッジ情報による分離がしやすいケースとがある。したがって、上記のようなバランスパラメタを用いることで様々なケースへの適応が容易となり、検査領域の抽出精度、ひいては検査精度の向上を図ることができる。
 前記最適解探索処理では、前景の代表色又は代表輝度に対する候補領域の内側の各ピクセルの色又は輝度の前景らしさを評価した値、或いは、背景の代表色又は代表輝度に対する候補領域の外側の各ピクセルの色又は輝度の背景らしさを評価した値、或いは、その両方の値を総合した値を前記ピクセル分離度として用いることが好ましい。
 この構成によれば、検査領域内のピクセルの前景らしさが高く、且つ、検査領域外のピクセルの背景らしさが高いほど、ピクセル分離度が高いという評価となる。このように前景や背景の代表となる色・輝度を定め、それらを基準として検査領域の探索を行うことにより、検査領域の抽出精度を高めることができる。なお、前景らしさを評価した値を計算する際には、候補領域の内側の全ピクセルを用いてもよいし、一部のピクセルだけを用いてもよい。同様に、背景らしさを評価した値を計算する際には、候補領域の外側の全ピクセルを用いてもよいし、一部のピクセルだけを用いてもよい。
 前記検査領域定義情報は、パラメタの一つとして、前景若しくは背景若しくはその両方の代表色又は代表輝度の情報を含んでいることが好ましい。このようなパラメタを拘束条件として用いることで、検査領域の抽出精度をより一層高めることができる。
 パラメタとしては、上述したものの他、検査領域の最適解探索に影響を及ぼし得るものであれば、どのようなパラメタを与えても良い。例えば、検査領域の形状、大きさ、画像内での位置、テクスチャ、トポロジ、隣接要素、内包要素などに関する特徴を表す情報をパラメタとして与え、ピクセル分離度とエッジ重なり度に加え、検査領域の特徴とこれらのパラメタで与えられた特徴との類似度合も高くなるように、検査領域の解探索を行えばよい。このように検査領域の各種特徴を拘束条件とすることで、検査領域の抽出精度をより一層高めることができる。
 検査対象物の検査を開始する前に、前記検査領域定義情報を生成して前記記憶装置に格納する処理(設定処理、ティーチング処理とも呼ぶ)が必要となるが、この処理は例えば以下の検査領域定義情報設定ステップで行うことが好ましい。すなわち、前記検査領域定義情報設定ステップは、検査対象物のサンプルを撮影して得られたサンプル画像を取得するステップと、ユーザからパラメタの入力を受け付けるステップと、ユーザからパラメタの入力を受け付ける毎に、入力されたパラメタに基づき拘束条件を更新しながら前記サンプル画像に対して前記最適解探索処理を実行することで、前記サンプル画像において所望の検査領域を得ることのできるパラメタを追い込むステップと、前記サンプル画像において所望の検査領域を得ることができたときに用いられたパラメタを検査領域定義情報として前記記憶装置に格納するステップと、を有するとよい。
 なお、本発明は、上記手段の少なくともいずれかを有する画像検査装置として捉えることもできるし、上記の検査領域設定に関わる手段の少なくともいずれかを有する画像検査装置のための検査領域設定装置として捉えることもできる。また本発明は、上記処理の少なくともいずれかを実行する画像検査方法もしくは検査領域設定方法、または、かかる方法をコンピュータに実行させるためのプログラムやこのプログラムを記録した記憶媒体として捉えることもできる。
 本発明によれば、複雑な形状や特殊な形状の対象の場合や、前景と背景の色が紛らわしい場合であっても、簡単かつ高精度に検査領域を設定することができる。また、検査対象物に個体差がある場合や検査対象物の位置・向きが不定の場合であっても、適応的に検査領域を自動設定し、高精度な検査を行うことができる。
画像検査装置の構成を模式的に示す図。 検査処理の流れを示すフローチャート。 検査処理における検査領域の抽出過程を説明するための図。 設定ツール103を用いて検査領域を設定する処理の流れを示すフローチャート。 検査領域設定画面の一例を示す図。 パラメタ調整により検査領域を追い込んでいく過程の一例を示す図。
 以下に図面を参照して本発明の好適な実施の形態について詳しく説明する。
 以下に述べる実施形態は、画像による外観検査を行う画像検査装置、並びに、画像検査装置に与える検査領域定義情報を作成する作業を支援するための検査領域設定装置に関するものである。この画像検査装置は、FAの生産ラインなどにおいて多数の物品を自動もしくは半自動で連続的に検査する用途などに好適に利用されるものである。検査対象となる物品の種類は問わないが、本実施形態の画像検査装置では画像センサで撮像された元画像を用いて検査対象物ごとに適応的に検査領域を決定して検査を行うため、元画像中の検査領域の位置・形状が検査対象物ごとに変動するようなケースに特に好ましく適用できる。外観検査の目的や検査項目には様々なものが存在するが、本実施形態の検査領域設定装置はいずれの検査に対しても好適に適用することができる。なお本実施形態では、画像検査装置の一機能(設定ツール)という形で検査領域設定装置が実装されているが、画像検査装置と検査領域設定装置とを別々の構成としてもよい。
 <第1実施形態>
 (画像検査装置)
 図1は、画像検査装置の構成を模式的に示している。この画像検査装置1は、搬送路上を搬送される検査対象物2の外観検査を行うシステムである。
 図1に示すように、画像検査装置1は、装置本体10、画像センサ11、表示装置12、記憶装置13、入力装置14などのハードウエアから構成される。画像センサ11は、カラー又はモノクロの静止画像あるいは動画像を装置本体10に取り込むためのデバイスであり、例えばデジタルカメラを好適に用いることができる。ただし、可視光像以外の特殊な画像(X線画像、サーモ画像など)を検査に利用する場合には、その画像に合わせたセンサを用いればよい。表示装置12は、画像センサ11で取り込まれた画像、検査結果、検査処理や設定処理に関わるGUI画面を表示するためのデバイスであり、例えば液晶ディスプレイなどを用いることができる。記憶装置13は、画像検査装置1が検査処理において参照する各種の設定情報(検査領域定義情報、検査ロジックなど)や検査結果などを格納するデバイスであり、例えばHDD、SSD、フラッシュメモリ、ネットワークストレージなどを利用可能である。入力装置14は、ユーザが装置本体10に対し指示を入力するために操作するデバイスであり、例えばマウス、キーボード、タッチパネル、専用コンソールなどを利用可能である。
 装置本体10は、ハードウエアとして、CPU(中央演算処理装置)、主記憶装置(RAM)、補助記憶装置(ROM、HDD、SSDなど)を備えたコンピュータで構成することができ、その機能として、検査処理部101、検査領域抽出部102、設定ツール103を有している。検査処理部101と検査領域抽出部102が検査処理に関わる機能であり、設定ツール103は検査処理に必要な設定情報のユーザによる設定作業を支援する機能である。これらの機能は、補助記憶装置又は記憶装置13に格納されたコンピュータ・プログラムが主記憶装置にロードされ、CPUによって実行されることで実現される。なお、図1は装置構成の一例を示すものにすぎず、画像センサ11、表示装置12、記憶装置13、入力装置14の全部又は一部を装置本体10に一体化してもよい。なお装置本体10は、パーソナルコンピュータやスレート型端末のようなコンピュータで構成してもよいし、或いは、専用チップやオンボードコンピュータなどで構成することもできる。
 (検査処理)
 図2及び図3を参照して、画像検査装置1の検査処理に関わる動作を説明する。図2は、検査処理の流れを示すフローチャートであり、図3は、検査処理における検査領域の抽出過程を説明するための図である。ここでは、説明の便宜のため、携帯電話の筐体部品のパネル面の検査(キズ、色ムラの検出)を例に挙げて検査処理の流れを説明する。
 ステップS20では、画像センサ11によって検査対象物2が撮影され、画像データが装置本体10に取り込まれる。ここで取り込まれた画像(元画像;検査対象物画像)は必要に応じて表示装置12に表示される。図3の上段は元画像の一例を示している。元画像の中央に検査対象となる筐体部品2が写っており、その左右には搬送路上の隣にある筐体部品の一部が写り込んでいる。
 ステップS21では、検査領域抽出部102が、記憶装置13から必要な設定情報を読み込む。設定情報には、少なくとも検査領域定義情報と検査ロジックとが含まれる。検査領域定義情報とは、後段の検査領域探索処理において拘束条件として用いられるいくつかのパラメタを定義する情報である。検査領域定義情報として与えられるパラメタの例については後述する。検査ロジックとは、検査処理の内容を定義する情報であり、例えば、検査に用いる特徴量の種類、判定方法、特徴量抽出や判定処理で用いるパラメタや閾値などが該当する。
 ステップS22では、検査領域抽出部102は、ステップS21で読み込まれた検査領域定義情報(パラメタ)を用いて、元画像を前景と背景に分離(セグメンテーション)し、その前景部分を検査領域として選ぶ。本実施形態においては、元画像の各ピクセルの色の情報に加えて、元画像に含まれるエッジの情報も用い、検査領域の候補解である複数の候補領域について、前景と背景の間(つまり候補領域の内側と外側の間)での色の分離の度合い(これをピクセル分離度と呼ぶ)と、前景と背景の境界(つまり候補領域の輪郭)と元画像中のエッジとの重なりの度合い(これをエッジ重なり度と呼ぶ)の両方を総合的に評価し、ピクセル分離度とエッジ重なり度の両方を高くするような最適解を探索する。このような処理により、検査対象物2の個体差や姿勢などに合わせて個別に最適な検査領域が決定される。なお最適解探索処理の詳細については後述する。
 ステップS23では、検査領域抽出部102が、ステップS22で求められた検査領域にしたがって、元画像から検査領域の部分を抽出する。図3の中段は、ステップS22で求められた検査領域(クロスハッチングで示す)30を元画像に重ねた様子を示している。検査領域30がちょうど筐体部品2のパネル面の上に重なっていることがわかる。図3の下段は、元画像から検査領域30の部分の画像(検査領域画像31)を抽出した様子を示している。検査領域画像31では、筐体部品2のまわりに写っていた搬送経路や隣の部品が削除されている。また、表面検査の対象部位から除外される、ヒンジ部分20やボタン部分21も削除されている。このようにして得られた検査領域画像31は検査処理部101に引き渡される。
 ステップS24では、検査処理部101が、検査ロジックにしたがって、検査領域画像31から必要な特徴量を抽出する。本例では、表面のキズ・色ムラの検査を行うための特徴量として、検査領域画像31の各ピクセルの色とその平均値が抽出される。
 ステップS25では、検査処理部101が、検査ロジックにしたがって、キズ・色ムラの有無を判定する。例えば、ステップS24で得られた平均値に対する色差が閾値を超えるピクセル群が検出された場合に、そのピクセル群をキズあるいは色ムラと判定することができる。
 ステップS26では、検査処理部101が検査結果を表示装置12に表示したり、記憶装置13に記録する。以上で、1つの検査対象物2に対する検査処理が完了する。生産ラインにおいては、検査対象物2が画像センサ11の画角内に搬送されるタイミングと同期して、図2のステップS20~S26の処理が繰り返される。
 外観検査においては、検査の対象とすべきピクセルのみを過不足なく検査領域画像31として切り出すことが望ましい。検査領域画像31の中に背景部分や余計な部分(図3の例ではヒンジ部分20やボタン部分21)が含まれていたりするとそのピクセルがノイズとなり検査精度を低下させるおそれがあるし、逆に、検査領域画像31が検査の対象とすべき範囲よりも小さいと、検査の漏れを生じるおそれがあるからである。そこで本実施形態の画像検査装置1では、正確な検査領域画像を切り出すための検査領域定義情報を簡単に作成するための設定ツール103を用意している。
 (検査領域の設定処理)
 図4及び図5を参照して、設定ツール103の機能及び動作について説明する。図4は、設定ツール103を用いて検査領域定義情報を設定する処理の流れを示すフローチャートであり、図5は、検査領域設定画面の一例を示す図である。
 設定ツール103を起動すると、表示装置12に図5の設定画面が表示される。この設定画面には、画像ウィンドウ50、画像取込ボタン51、前景指定ボタン52、背景指定ボタン53、優先度調整スライダ54、確定ボタン55が設けられている。ボタンの選択やスライダの移動などの操作は入力装置14を利用して行うことができる。なおこの設定画面はあくまでも一例にすぎず、以下に述べるパラメタ入力や検査領域の確認などを行うことができればどのようなUIを用いてもよい。
 画像取込ボタン51が押されると、設定ツール103は画像センサ11によって検査対象物のサンプルを撮影する(ステップS40)。サンプルとしては良品の検査対象物(上記の例であれば筐体部品)を用い、実際の検査処理の場合と同じ状態(画像センサ11とサンプルの相対位置、照明など)で撮影を行うとよい。得られたサンプル画像データは装置本体10に取り込まれる。なお、事前に撮影されたサンプル画像が装置本体10の補助記憶装置や記憶装置13の中に存在する場合には、設定ツール103は補助記憶装置又は記憶装置13からサンプル画像のデータを読み込んでもよい。
 ステップS40で取得したサンプル画像は、図5に示すように、設定画面の画像ウィンドウ50に表示される(ステップS41)。
 ステップS42では、ユーザが前景と背景の代表色(モノクロ画像の場合は代表輝度)を入力する。前景とは、検査領域として抽出すべき部分を指し、背景とは、検査領域以外の部分を指す。前景の代表色を入力する場合、ユーザは、設定画面の前景指定ボタン52を押して前景指定モードにした後、画像ウィンドウ50に表示されたサンプル画像上で前景とすべき部分を指定する。ここでの指定は、前景の代表的な色をピックアップすることが目的なので、図5の例であれば、筐体部品のパネル面の一部のピクセル又はピクセル群を適当に選択すればよい。もし前景の中に模様、陰影、色の大きく異なる部分などが含まれている場合には、それらの色をできるだけ網羅するようにピクセル群を選択することが好ましい。背景の代表色を入力する場合は、背景指定ボタン53を押して背景指定モードに切り替えた後、同様の操作を行う。なお、前景と背景の代表色の入力は必須ではない。前景と背景のいずれか一方のみを入力してもよいし、代表色が既知の場合や、サンプル画像の色分布などから自動で代表色を算出できる場合には、ステップS42を省略してもよい。
 ステップS43では、設定ツール103は、ステップS42で指定された前景・背景の代表色に基づいて、サンプル画像を前景と背景に分離(セグメンテーション)し、その前景部分を検査領域として選ぶ。本実施形態においては、サンプル画像の各ピクセルの色の情報に加えて、サンプル画像に含まれるエッジの情報も用い、検査領域の候補解である複数の候補領域について、前景と背景の間(つまり候補領域の内側と外側の間)での色の分離の度合い(ピクセル分離度)と、前景と背景の境界(つまり候補領域の輪郭)とサンプル画像中のエッジとの重なりの度合い(エッジ重なり度)の両方を総合的に評価し、ピクセル分離度とエッジ重なり度の両方を高くするような最適解を探索する。ここでの最適解探索処理は、検査処理における検査領域の決定(ステップS22)で用いられる最適解探索処理と同じアルゴリズムのものが用いられる。
 ステップS44では、ステップS43で計算された検査領域を設定画面の画像ウィンドウ50に表示する。ユーザは設定画面に表示された検査領域を見ることで、所望の領域が検査領域として選ばれているかどうかを確認することができる。このとき、サンプル画像の上に検査領域をオーバーレイ表示すると、検査対象物と検査領域との比較が容易になるので好ましい。
 その後、設定ツール103は、ユーザからの入力を待つ(ステップS45)。確定ボタン55が押された場合は、設定ツール103は、現在のパラメタについて検査領域定義情報を生成し記憶装置13に格納する(ステップS46)。ここで記憶装置13に保存された検査領域定義情報が検査処理で利用される。本実施形態の設定ツール103では、前景の代表色、背景の代表色、色情報とエッジ情報の間の優先度(バランスパラメタ)などのパラメタが検査領域定義情報に記述される。なお、前景の代表色や背景の代表色としては、画素値や色ヒストグラムなどの色情報をそのままパラメタとして用いてもよいし、そのような色情報から加工された情報(色情報をモデル化した情報)をパラメタとして用いることもできる。例えば、ヒストグラムをガウス混合モデルで表したものや、カーネル密度推定を使ってモデル化したものをパラメタとしてもよい。また、検査領域定義情報として与えるパラメタは前景の代表色、背景の代表色、色情報とエッジ情報の間の優先度に限られず、最適解探索処理において拘束条件として作用するものであればどのようなパラメタを与えてもよい。
 ところで、最適解探索処理の結果、画面表示された検査領域が適当でない場合は、ユーザは、前景指定ボタン52、背景指定ボタン53、優先度調整スライダ54を操作してパラメタを調整することができる(ステップS47)。前景または背景の代表色を指定しなおすと、前述したピクセル分離度の評価に影響を与える。また優先度調整スライダ54で色情報とエッジ情報の間の優先度を変更すると、前述したピクセル分離度とエッジ重なり度を評価する際のバランス(重み)を変えることができる。設定ツール103は、ユーザからパラメタの入力(変更)を受け付けると、この新たなパラメタを拘束条件として用いて検査領域の最適解を再計算し、再計算後の検査領域を画面表示する(ステップS47→S43、S44)。このような機能により、パラメタを適宜調整しながら、所望の結果が得られるまで検査領域の計算を繰り返すことができる。
 図6は、パラメタを追い込んでいく過程の一例を示している。最初の計算で得られた検査領域30を上段に示す。最初の計算結果では、筐体部品のヒンジ部分20やボタン部分21も検査領域30に含まれているが、ここではパネル面のキズ・色ムラを検査することが目的のためヒンジ部分20とボタン部分21は検査領域から除外したい(図3参照)。そこでまず、ユーザは、背景指定ボタン53を押して背景指定モードに切り替え、サンプル画像中のボタン部分21の色を背景の代表色に追加指定する。これにより、中段に示す画像例のように、ボタン部分21が検査領域30から除かれる。次に、ヒンジ部分20に関しては、パネル面との色の差が小さいためバランスパラメタの調整で対処する。すなわち、ヒンジ部分20とパネル面との間の段差に生じたエッジに着目し、優先度調整スライダ54でエッジ情報の優先度を高くする。これにより、下段に示す画像例のように、ヒンジ部分20と部品表面とのエッジに検査領域30の輪郭が設定され、所望の検査領域30が形成される。
 (最適解探索処理)
 検査処理における最適解探索処理(図2のステップS22)と、検査領域設定処理における最適解探索処理(図4のステップS43)は同じアルゴリズムに基づくものである。以下、具体的な計算方法について説明する。
 前述のように、本実施形態の最適解探索処理では、前景と背景の間でのピクセル分離度と、前景と背景の境界のエッジ重なり度の両方を総合的に評価することにより、検査領域の候補解の中から最適解を求める。この計算は、色情報に基づくピクセル分離度を評価する関数とエッジ情報に基づくエッジ重なり度を評価する関数とを含む目的関数を最小化(もしくは最大化)する最適化問題として捉えることができる。以下、グラフカットアルゴリズムを用いて検査領域の最適化問題を解く手法について説明する。なお、グラフカットアルゴリズムは公知の手法であるため(非特許文献1参照)、本明細書ではグラフカットアルゴリズムの基本概念の説明は割愛し、以下では本実施形態に特有の部分を中心に説明を行う。
 グラフカットアルゴリズムでは、目的関数として下記式のようにエネルギー関数を定義し、Iが与えられたときにエネルギーEを最小化する解Lを求める。本例では、Iがサンプル画像であり、Lが前景か背景かを示すラベル(すなわち検査領域)である。
Figure JPOXMLDOC01-appb-M000001

 ここで、i,jはピクセルのインデックスであり、Ωは画像I中のピクセル群であり、Nは画像Iにおける隣接ピクセルペア群である。またli,ljはそれぞれピクセルi,jの指定ラベルである。前景の場合は「1」、背景の場合は「0」というラベルが与えられるものとする。右辺第1項はデータ項と呼ばれ、対象ピクセルiに関する拘束条件を与える。右辺第2項は平滑化項と呼ばれ、互いに隣接するピクセルi,jに関する拘束条件を与える。λは、データ項と平滑化項の重み(バランス)を決定するバランスパラメタである。
 データ項は、前述した色情報に基づくピクセル分離度を評価する関数で定義される。例えば、下記式によりデータ項の評価関数Uを定義するとよい。
Figure JPOXMLDOC01-appb-M000002
 ここで、-logp(I|li=1)は、前景代表色に対する前景ピクセル(前景ラベル「1」が付されたピクセル)の前景らしさを表す関数(対数尤度)であり、前景尤度と呼ぶ。前景尤度における確率密度関数は前景代表色から推定したもの(例えば前景代表色の色分布をガウス混合モデルで近似したもの)を用いる。一方、-logp(I|li=0)は、背景代表色に対する背景ピクセル(背景ラベル「0」が付されたピクセル)の背景らしさを表す関数(対数尤度)であり、背景尤度と呼ぶ。背景尤度における確率密度関数は背景代表色から推定したもの(例えば背景代表色の色分布をガウス混合モデルで近似したもの)を用いる。すなわち、データ項は各前景ピクセルの前景尤度と各背景ピクセルの背景尤度の総和を表しており、前景ピクセルの色が前景代表色に近いほど、また背景ピクセルの色が背景代表色に近いほど、エネルギーが小さくなり、逆に前景ピクセルの色が前景代表色から離れるほど、また背景ピクセルの色が背景代表色から離れるほど、エネルギーが大きくなる。
 平滑化項は、前述したエッジ情報に基づくエッジ重なり度を評価する関数で定義される。例えば、下記式により平滑化項の評価関数Vを定義することができる。
Figure JPOXMLDOC01-appb-M000003

 ここで、Ii,Ijはそれぞれピクセルi,jのピクセル値(色又は輝度)であり、βは係数である。∥Ii-Ij∥は、所定の色空間上でのピクセル値の差分(距離)、すなわちピクセル間のコントラストの高さを表している。
 上記式によれば、隣接するピクセルi,jのラベルが異なっている場合に、ピクセルi,jのコントラストが低いとエネルギーが大きくなり、コントラストが高いとエネルギーが小さくなる。隣接するピクセルのコントラストが高い部分は、画像中の色又は輝度が大きく変化している部分、つまり画像におけるエッジ部分である。すなわち、上記式は、前景と背景の境界(ラベルが異なっているピクセルペア)が画像中のエッジに重なっているほど、エネルギーが小さくなる。
 以上述べたエネルギー関数は、一定の数学的条件(submodularity)が満たされている場合には、大局的最小解が存在する。また、同様にsubmodularityを満たす項を付け加えて拘束条件付きで大局的最小解を求めることもできる。なお大局的最小解の効率的な解法については、公知の探索アルゴリズムを利用すればよいので、ここでは詳しい説明は省略する。
 前述した設定画面で調整可能なパラメタのうち「前景代表色」と「背景代表色」はデータ項の値に影響を及ぼすものである。また、「色情報とエッジ情報の優先度」は、バランスパラメタλに対応する。つまり、ユーザが色情報の優先度を大きくすると、パラメタλの値を小さくしてデータ項の重みを大きくし、ユーザがエッジ情報の優先度を大きくすると、パラメタλの値を大きくして平滑化項の重みを大きくするのである。なお、パラメタλの値については、計算機(設定ツール103)によって自動的に決定することもできる。例えば、設定ツール103が前景代表色と背景代表色との差を計算し、その差が大きいときにはパラメタλの値を小さくし、データ項の重みを大きくする。前景と背景の色の差が明確である場合は、データ項の信頼性が高いと推定できるからである。逆に、前景代表色と背景代表色の差が小さいときにはパラメタλの値を大きくし、平滑化項の重みを大きくする。前景と背景の色の差が明確でない場合は、色情報よりもエッジ情報に基づく領域分割のほうがよい結果が得られる傾向にあるからである。このようにバランスパラメタλを自動調整することで、ユーザの補助が無い状態でも妥当な解に到達できる可能性を高めることができる。好ましくは、バランスパラメタλの初期値を上記方法により自動で決定し、それを出発点としてユーザにバランスパラメタλ(色情報とエッジ情報の優先度)を調整させると良い。初期値の妥当性が高いほど、ユーザの試行錯誤の回数を減らすことができ、パラメタ調整にかかる作業負荷を軽減できると期待できるからである。
 なお、上述した式(2)では、前景ピクセルの前景らしさ(前景尤度)と背景ピクセルの背景らしさ(背景尤度)の総和をデータ項として用いたが、ピクセル分離度の評価関数はこれに限らない。例えば、前景らしさと背景らしさの積、重み付き和、重み付き積、非線形関数和、非線形関数積などを用いてもよい。なお非線形関数としては単調増加関数を用いるとよい。また、前景らしさと背景らしさの両方を評価するのではなく、前景らしさのみ、或いは、背景らしさのみを評価したものをピクセル分離度として用いることもできる。具体的には、式(2)において、li=0の場合(もしくはli=1の場合)にU(li|I)=0となるような関数を用いることができる。下記式(4)は、前景らしさのみを評価する関数である。
Figure JPOXMLDOC01-appb-M000004
 また、前景らしさの計算には、全ての前景ピクセル(つまり候補領域の内側の全てのピクセル)を用いてもよいし、一部の前景ピクセルだけを用いてもよい。同様に、背景らしさの計算についても、全ての背景ピクセル(つまり候補領域の外側の全てのピクセル)を用いてもよいし、一部の背景ピクセルだけを用いてもよい。例えば、ラベルが確定しているピクセルを計算から除外したり、候補領域の輪郭から所定距離内のピクセルだけを計算に用いたりすることにより、計算時間の短縮を図ることができる。
 また、前景らしさもしくは背景らしさを評価する関数は式(2)のものに限られない。例えば、下記式のように前景尤度と背景尤度の比である尤度比を用いることができる。
Figure JPOXMLDOC01-appb-M000005
 ユーザにより前景代表色として指定されたピクセル群のヒストグラムを直接用い(確率密度関数を推定することなく)、その前景代表色ヒストグラムに対する各ピクセルの色の類似度に基づき前景らしさを評価したり、逆に前景代表色ヒストグラムに対する各ピクセルの色の相違度に基づき背景らしさを評価したりしてもよい。同様に、ユーザにより背景代表色として指定されたピクセル群のヒストグラム(背景代表色ヒストグラム)に対する類似度に基づき背景らしさを評価したり、背景代表色ヒストグラムに対する相違度に基づき前景らしさを評価したりしてもよい。或いは、候補領域の前景ピクセル群から求めた前景ヒストグラムや背景ピクセル群から求めた背景ヒストグラムと、上記前景代表色ヒストグラムや背景代表色ヒストグラムとの間の類似度もしくは相違度を、所定の関数や距離指標を用いて計算してもよい。或いは、ピクセル群の色や輝度の情報からヒストグラムを近似したものを計算し、そのヒストグラムを近似したものを用いて類似度や相違度を計算してもよい。
 (追加的なパラメタ)
 上記例では、前景代表色、背景代表色、色情報とエッジ情報の優先度の3つのパラメタについて説明したが、これらの他にも、検査領域の最適解探索に影響を及ぼし得るものであれば、どのようなパラメタを用いて良い。例えば、外観検査の対象物としては工業製品が主であるため、検査領域となる部分の形状、テクスチャ、トポロジ、検査領域に隣接する要素、検査領域に内包される要素などに特徴があるケースが多い。また画像センサの設置に際し検査対象物がちょうど良く画角に収まるように設定されるため、検査領域となる部分の大きさや画像内での位置はある程度予測できる。それゆえ、このような検査領域の特徴を表す情報をパラメタとしてユーザに入力させ、そのパラメタで与えられた特徴と検査領域の特徴との類似度合を評価する拘束条件を目的関数の中に追加することで、妥当な検査領域が探索される可能性をより一層高めることができる。なお、パラメタを新たに加えた場合には、そのパラメタの値も検査領域定義情報に含める。
 検査領域の形状に関する特徴を表す形状情報としては、検査領域の基本形状(円形、四角形、三角形、星形・・・)や、輪郭の特徴(直線的な外形、丸みのある外形、ギザギザが多い・・・)などを用いることができる。形状情報を入力するUIとしては、基本形状のテンプレートや輪郭の特徴をリスト表示し、その中から該当するものをユーザに選択させるとよい。基本形状のテンプレートが指定された場合には、例えば、拘束条件として下記式を挿入すればよい。
Figure JPOXMLDOC01-appb-M000006

 ここで、liはピクセルiの指定ラベルであり、tiはテンプレート上のピクセルiに対応する点のラベルである。T()はアフィン変換を表す。上記式は、指定されたテンプレートを拡大/縮小、回転、変形等しつつ候補領域に対してテンプレートマッチングを行い、最小スコアを計算する、という操作を表している。すなわち、この拘束条件を加えることにより、ユーザ指定の基本形状に近い形状をもつ領域の方がエネルギーが小さくなり、最適解として優先的に選ばれるようになる。
 また、輪郭の特徴としてギザギザ度合いもしくは滑らか度合いが指定された場合には、例えば、拘束条件として下記式を挿入すればよい。
Figure JPOXMLDOC01-appb-M000007

 ここで、Sは前景領域の輪郭上の点、θは輪郭の勾配角度であり、∂θ/∂Sは前景領域の輪郭に沿った勾配角度の変化量を表している。また、Cはユーザにより指定されたギザギザ度合い(滑らか度合い)を示す定数であり、ギザギザであるほどCは大きく、滑らかであるほどCは小さい値となる。上記式は、前景領域の輪郭の勾配角度の変化量の合計値(輪郭のギザギザ度合いを表す)が値C(指定されたギザギザ度合いを表す)に近いかどうか、を評価する関数である。すなわち、この拘束条件を加えることにより、ユーザ指定のギザギザ度合いに近い輪郭特徴をもつ領域の方が最適解として優先的に選ばれるようになる。
 検査領域の大きさに関する特徴を表す大きさ情報としては、検査領域の面積、縦横の長さなどを用いることができる。大きさ情報として面積が入力された場合には、例えば、拘束条件として下記式を挿入すればよい。
Figure JPOXMLDOC01-appb-M000008

 ここで、Cはユーザにより指定された前景領域の面積(ピクセル数)である。前景ラベルは1、背景ラベルは0ゆえ、Σliは前景ピクセルの総数、つまり前景領域の面積を表している。したがって、上記式は、前景領域の面積が指定された面積Cに近いかどうか、を評価する関数である。この拘束条件を加えることにより、ユーザ指定の面積に近い大きさの領域の方が最適解として優先的に選ばれるようになる。
 検査領域の画像内での位置に関する特徴を表す位置情報としては、検査領域の重心座標、検査領域の存在範囲(上、下、右、左、中央・・・)などを用いることができる。位置情報として重心座標が入力された場合には、例えば、拘束条件として下記式を挿入すればよい。
Figure JPOXMLDOC01-appb-M000009

 ここで、wは前景領域の重心座標であり、Cはユーザにより指定された重心座標である。上記式は、前景領域の重心座標が指定された座標Cに近いかどうか、を評価する関数である。この拘束条件を加えることにより、ユーザ指定の座標に近い位置に重心をもつ領域の方が最適解として優先的に選ばれるようになる。
 検査領域のテクスチャに関する特徴を表すテクスチャ情報としては、検査領域内の模様、色の濃淡、凹凸、素材などを表す情報を用いることができる。例えば、各種のテクスチャテンプレートをリスト表示し、その中から該当するものをユーザに選択させるとよい。テクスチャテンプレートが入力された場合には、例えば、拘束条件として下記式を挿入すればよい。
Figure JPOXMLDOC01-appb-M000010

 ここで、Iはサンプル画像であり、Eはユーザにより指定されたテクスチャテンプレートである。hl=1()は前景ピクセルの色ヒストグラムを表しており、f()はヒストグラムの類似度を示す関数である。つまり、上記式は、サンプル画像中の前景領域の色ヒストグラムが、指定されたテクスチャの色ヒストグラムに類似するかどうか、を評価する関数である。この拘束条件を加えることにより、ユーザ指定のテクスチャに類似したテクスチャをもつ領域の方が最適解として優先的に選ばれるようになる。
 (本実施形態の利点)
 本実施形態の画像検査装置1では、サンプル画像から求めた検査領域をそのまま検査処理に利用するのではなく、サンプル画像から検査領域の最適解を求める過程で用いたパラメタ(拘束条件)を画像検査装置1に与えている。検査処理の段階では、画像検査装置1が記憶装置からパラメタを読み込み、そのパラメタを用いて最適解探索処理を実行することで、検査対象物毎に個別に検査領域の位置や形状を決定している。したがって、複雑な形状や特殊な形状をもつ検査対象物に対しても正確な検査領域を自動で設定でき、また検査対象物に個体差がある場合や検査対象物の位置・向きが不定の場合であっても、適応的に正確な検査領域を自動設定できる。さらに、本実施形態では、色・輝度の情報に加えてエッジの情報も用い、ピクセル分離度とエッジ重なり度の両方を総合的に評価するアルゴリズムを採用したので、二値化や色域抽出といった従来手法に比べて、領域の抽出精度を向上することができる。よって、本実施形態の画像検査装置1によれば、検査対象物として取り扱うことのできる幅が広がるとともに、従来に比べて高精度な検査を行うことが可能となる。
 また、本実施形態の設定ツール103は、設定画面において、色情報とエッジ情報の優先度のいずれを優先させるかをユーザに任意に選ばせることができる。例えば、前景や背景の中に模様が含まれているなど疑似輪郭が多い画像の場合はエッジの情報よりも色・輝度の情報を優先したほうが良い結果が得られる可能性が高く、前景と背景の色が似ている画像の場合はエッジの情報を優先したほうが良い結果が得られる可能性が高い。このような前景と背景の切り分けが困難な画像に対して、完全自動で正解にたどり着くことは非常に困難である。その一方で、いずれを優先させるべきかはヒトであれば画像を見て容易に判断できるし、試行錯誤によりパラメタを追い込むことも容易である。したがって、上記構成のようにバランスパラメタを調整可能としたことにより、簡単に且つ短時間で所望の検査領域が得られる検査領域定義情報を作成できるようになる。
 上述した実施形態は本発明の一具体例を示したものであり、本発明の範囲をそれらの具体例に限定する趣旨のものではない。例えば、上記実施形態ではカラー画像を想定しているため、画像の色情報を利用したが、モノクロ画像を用いる場合には、色情報の代わりに輝度情報を用いればよい。また、上記実施形態では最適化にグラフカットアルゴリズムを利用したが、レベルセットアルゴリズムなどの他の方法を利用することもできる。他の方法の場合にも、色情報(輝度情報)とエッジ情報を利用することにより検査領域の高精度な算出が可能となる。またこの場合も、色情報(輝度情報)とエッジ情報の優先度をユーザにより変更できるようにすることが好ましい。
1:画像検査装置2:検査対象物(筐体部品)10:装置本体、11:画像センサ、12:表示装置、13:記憶装置、14:入力装置、101:検査処理部、102:検査領域抽出部、103:設定ツール20:ヒンジ部分、21:ボタン部分30:検査領域、31:検査領域画像50:画像ウィンドウ、51:画像取込ボタン、52:前景指定ボタン、53:背景指定ボタン、54:優先度調整スライダ、55:確定ボタン

Claims (12)

  1.  画像検査装置が実行する画像検査方法であって、
     検査対象物を撮影して得られた検査対象物画像を取得する取得ステップと、
     検査領域定義情報を予め記憶している記憶装置から、前記検査領域定義情報を読み込む設定読込ステップと、
     前記検査領域定義情報に基づいて、前記検査対象物画像から検査領域とする部分を検査領域画像として抽出する検査領域抽出ステップと、
     前記検査領域画像を解析することにより前記検査対象物の検査を行う検査処理ステップと、を有しており、
     前記検査領域定義情報は、最適解探索処理において拘束条件として用いられるパラメタであり、
     前記検査領域抽出ステップでは、前記パラメタを拘束条件として用いて検査対象物画像の中から検査領域の最適解を求める最適解探索処理を行うことによって、各々の検査対象物に対して個別に検査領域の位置及び形状が決定されることを特徴とする画像検査方法。
  2.  前記最適解探索処理は、前記検査対象物画像における各ピクセルの色又は輝度の情報、及び、前記検査対象物画像に含まれるエッジの情報に基づいて、検査領域の候補解である複数の候補領域について、各候補領域の内側と外側の間での色又は輝度の分離の度合いであるピクセル分離度と、各候補領域の輪郭と前記検査対象物画像中のエッジとの重なりの度合いであるエッジ重なり度の両方を評価することにより、前記複数の候補領域の中から検査領域の最適解を求める処理であることを特徴とする請求項1に記載の画像検査方法。
  3.  前記検査領域定義情報は、パラメタの一つとして、前記ピクセル分離度と前記エッジ重なり度を評価する際の重みを調整するためのバランスパラメタを含むことを特徴とする請求項2に記載の画像検査方法。
  4.  前記最適解探索処理では、前景の代表色又は代表輝度に対する候補領域の内側の各ピクセルの色又は輝度の前景らしさを評価した値、或いは、背景の代表色又は代表輝度に対する候補領域の外側の各ピクセルの色又は輝度の背景らしさを評価した値、或いは、その両方の値を総合した値を前記ピクセル分離度として用いることを特徴とする請求項2又は3に記載の画像検査方法。
  5.  前記検査領域定義情報は、パラメタの一つとして、前景若しくは背景若しくはその両方の代表色又は代表輝度の情報を含むことを特徴とする請求項4に記載の画像検査方法。
  6.  前記検査領域定義情報は、パラメタの一つとして、検査領域の形状に関する特徴を表す形状情報を含み、
     前記最適解探索処理では、前記ピクセル分離度と前記エッジ重なり度に加え、検査領域の形状と前記形状情報で表される形状との類似度合も高くなるように、検査領域の最適解が求められることを特徴とする請求項2~5のうちいずれか1項に記載の画像検査方法。
  7.  前記検査領域定義情報は、パラメタの一つとして、検査領域の大きさに関する特徴を表す大きさ情報を含み、
     前記最適解探索処理では、前記ピクセル分離度と前記エッジ重なり度に加え、検査領域の大きさと前記大きさ情報で表される大きさとの類似度合も高くなるように、検査領域の最適解が求められることを特徴とする請求項2~6のうちいずれか1項に記載の画像検査方法。
  8.  前記検査領域定義情報は、パラメタの一つとして、検査領域の画像内での位置に関する特徴を表す位置情報を含み、
     前記最適解探索処理では、前記ピクセル分離度と前記エッジ重なり度に加え、検査領域のサンプル画像内での位置と前記位置情報で表される位置との類似度合も高くなるように、検査領域の最適解が求められることを特徴とする請求項2~7のうちいずれか1項に記載の画像検査方法。
  9.  前記検査領域定義情報は、パラメタの一つとして、検査領域内の画像のテクスチャに関する特徴を表すテクスチャ情報を含み、
     前記最適解探索処理では、前記ピクセル分離度と前記エッジ重なり度に加え、検査領域内の画像のテクスチャと前記テクスチャ情報で表されるテクスチャとの類似度合も高くなるように、検査領域の最適解が求められることを特徴とする請求項2~8のうちいずれか1項に記載の画像検査方法。
  10.  検査対象物の検査を開始する前に、前記検査領域定義情報を生成して前記記憶装置に格納する検査領域定義情報設定ステップをさらに有し、
     前記検査領域定義情報設定ステップは、
      検査対象物のサンプルを撮影して得られたサンプル画像を取得するステップと、
      ユーザからパラメタの入力を受け付けるステップと、
      ユーザからパラメタの入力を受け付ける毎に、入力されたパラメタに基づき拘束条件を更新しながら前記サンプル画像に対して前記最適解探索処理を実行することで、前記サンプル画像において所望の検査領域を得ることのできるパラメタを追い込むステップと、
      前記サンプル画像において所望の検査領域を得ることができたときに用いられたパラメタを検査領域定義情報として前記記憶装置に格納するステップと、を有することを特徴とする請求項1~9のうちいずれか1項に記載の画像検査方法。
  11.  請求項1~10のうちいずれか1項に記載の画像検査方法の各ステップをコンピュータに実行させることを特徴とするプログラム。
  12.  検査対象物を撮影して得られた検査対象物画像を取得する取得手段と、
     検査領域定義情報を予め記憶している記憶装置から、前記検査領域定義情報を読み込む設定読込手段と、
     前記検査領域定義情報に基づいて、前記検査対象物画像から検査領域とする部分を検査領域画像として抽出する検査領域抽出手段と、
     前記検査領域画像を解析することにより前記検査対象物の検査を行う検査処理手段と、を有する画像検査装置であって、
     前記検査領域定義情報は、最適解探索処理において拘束条件として用いられるパラメタであり、
     前記検査領域抽出手段は、前記パラメタを拘束条件として用いて検査対象物画像の中から検査領域の最適解を求める最適解探索処理を行うことによって、各々の検査対象物に対して個別に検査領域の位置及び形状を決定することを特徴とする画像検査装置。
PCT/JP2012/073686 2012-01-27 2012-09-14 画像検査方法および画像検査装置 WO2013111373A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
US14/370,601 US9619877B2 (en) 2012-01-27 2012-09-14 Image examination method and image examination apparatus
CN201280067331.6A CN104053984A (zh) 2012-01-27 2012-09-14 图像检查方法和图像检查装置
EP12866952.0A EP2808674A4 (en) 2012-01-27 2012-09-14 Image examination method and image examination device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2012-015810 2012-01-27
JP2012015810A JP5929238B2 (ja) 2012-01-27 2012-01-27 画像検査方法および画像検査装置

Publications (1)

Publication Number Publication Date
WO2013111373A1 true WO2013111373A1 (ja) 2013-08-01

Family

ID=48873122

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2012/073686 WO2013111373A1 (ja) 2012-01-27 2012-09-14 画像検査方法および画像検査装置

Country Status (5)

Country Link
US (1) US9619877B2 (ja)
EP (1) EP2808674A4 (ja)
JP (1) JP5929238B2 (ja)
CN (1) CN104053984A (ja)
WO (1) WO2013111373A1 (ja)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6331517B2 (ja) 2014-03-13 2018-05-30 オムロン株式会社 画像処理装置、システム、画像処理方法、および画像処理プログラム
JP6337530B2 (ja) 2014-03-14 2018-06-06 オムロン株式会社 画像処理装置、画像処理方法、および画像処理プログラム
JP6478492B2 (ja) * 2014-06-27 2019-03-06 キヤノン株式会社 画像処理装置およびその方法
US10533952B2 (en) * 2014-12-08 2020-01-14 Koh Young Technology Inc. Method of inspecting a terminal of a component mounted on a substrate and substrate inspection apparatus
JP6165362B1 (ja) * 2015-08-21 2017-07-19 新日鉄住金ソリューションズ株式会社 表示システム、表示装置、表示方法及びプログラム
JP6731753B2 (ja) 2016-03-07 2020-07-29 キヤノン株式会社 画像処理装置、画像処理方法、画像処理システムおよびプログラム
JP6864549B2 (ja) * 2017-05-09 2021-04-28 株式会社キーエンス 画像検査装置
JP6919982B2 (ja) * 2017-05-09 2021-08-18 株式会社キーエンス 画像検査装置
JP7143649B2 (ja) * 2017-09-29 2022-09-29 株式会社リコー 画像処理装置、画像処理システム、画像処理方法、及びプログラム
CN112351247A (zh) * 2020-10-16 2021-02-09 国电大渡河枕头坝发电有限公司 一种基于图像处理的水电厂内电光闪光检测方法
CN114677384B (zh) * 2022-03-13 2022-12-02 江苏神州新能源电力有限公司 一种太阳能电池镀膜缺陷检测方法

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10214327A (ja) * 1997-01-30 1998-08-11 Nippon Telegr & Teleph Corp <Ntt> 画像を用いた表面欠陥検出方法
JP2000163582A (ja) * 1998-11-26 2000-06-16 Dainippon Printing Co Ltd 金属試料表面の欠陥検査方法及び装置
JP2000163579A (ja) * 1998-11-26 2000-06-16 Toshiba Corp 外観検査方法およびその装置
JP2003194735A (ja) * 2001-09-27 2003-07-09 Shoei Kk プリント配線基板の検査方法及び検査装置
JP2004053369A (ja) * 2002-07-18 2004-02-19 Nidec Copal Corp 実装部品検査方法
JP2006058284A (ja) 2004-07-21 2006-03-02 Omron Corp 基板検査用ウィンドウの設定条件の決定方法、基板検査方法、基板検査用の検査データ作成方法、および基板検査装置
JP2008139085A (ja) * 2006-11-30 2008-06-19 Hitachi High-Technologies Corp パターン寸法計測方法及び走査型透過荷電粒子顕微鏡

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006260401A (ja) * 2005-03-18 2006-09-28 Toshiba Corp 画像処理装置、方法、およびプログラム
US20070093987A1 (en) * 2005-10-07 2007-04-26 Omron Corporation Knowledge generation support system, parameter search method and program product
JP5159373B2 (ja) * 2008-03-06 2013-03-06 オリンパス株式会社 基板検査方法
JP5353566B2 (ja) * 2009-08-31 2013-11-27 オムロン株式会社 画像処理装置および画像処理プログラム
JP5152231B2 (ja) * 2010-03-12 2013-02-27 オムロン株式会社 画像処理方法および画像処理装置
JP5874398B2 (ja) * 2012-01-05 2016-03-02 オムロン株式会社 画像検査装置の検査領域設定方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10214327A (ja) * 1997-01-30 1998-08-11 Nippon Telegr & Teleph Corp <Ntt> 画像を用いた表面欠陥検出方法
JP2000163582A (ja) * 1998-11-26 2000-06-16 Dainippon Printing Co Ltd 金属試料表面の欠陥検査方法及び装置
JP2000163579A (ja) * 1998-11-26 2000-06-16 Toshiba Corp 外観検査方法およびその装置
JP2003194735A (ja) * 2001-09-27 2003-07-09 Shoei Kk プリント配線基板の検査方法及び検査装置
JP2004053369A (ja) * 2002-07-18 2004-02-19 Nidec Copal Corp 実装部品検査方法
JP2006058284A (ja) 2004-07-21 2006-03-02 Omron Corp 基板検査用ウィンドウの設定条件の決定方法、基板検査方法、基板検査用の検査データ作成方法、および基板検査装置
JP2008139085A (ja) * 2006-11-30 2008-06-19 Hitachi High-Technologies Corp パターン寸法計測方法及び走査型透過荷電粒子顕微鏡

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
See also references of EP2808674A4
TOMOYUKI NAGAHASHI ET AL.: "Heikatsuka Shori no Kurikaeshi ni yoru Gazo Segmentation no Tameno Graph Cut", DAI 10 KAI MEETING ON IMAGE RECOGNITION AND UNDERSTANDING (MIRU2007), vol. 07, 2007, pages 241 - 248, XP008174941 *
Y. OYKOV; M.-P. JOLLY: "Interactive Graph Cuts for Optimal Boundary & Region Segmentation of Objects in N-D images", ICCV2001, vol. 01, 2001, pages 105

Also Published As

Publication number Publication date
US20150117750A1 (en) 2015-04-30
CN104053984A (zh) 2014-09-17
US9619877B2 (en) 2017-04-11
JP2013156094A (ja) 2013-08-15
EP2808674A4 (en) 2015-10-07
JP5929238B2 (ja) 2016-06-01
EP2808674A1 (en) 2014-12-03

Similar Documents

Publication Publication Date Title
JP5874398B2 (ja) 画像検査装置の検査領域設定方法
JP5929238B2 (ja) 画像検査方法および画像検査装置
JP5953842B2 (ja) 画像検査方法および検査領域設定方法
JP5546317B2 (ja) 外観検査装置、外観検査用識別器の生成装置及び外観検査用識別器生成方法ならびに外観検査用識別器生成用コンピュータプログラム
US8750596B2 (en) System and method for identifying defects in a material
CN109671058B (zh) 一种大分辨率图像的缺陷检测方法及系统
US11222418B2 (en) System and method for automated surface assessment
CN111833303A (zh) 产品的检测方法、装置、电子设备及存储介质
US11348349B2 (en) Training data increment method, electronic apparatus and computer-readable medium
JP7214432B2 (ja) 画像処理方法、画像処理プログラム、記録媒体、画像処理装置、生産システム、物品の製造方法
KR101997048B1 (ko) 물류 관리를 위한 원거리 다수의 코드 인식 방법 및 이를 이용한 코드 인식 장치
CN114820594B (zh) 基于图像检测板材封边缺陷的方法、相关设备及存储介质
WO2024002187A1 (zh) 缺陷检测方法、缺陷检测设备及存储介质
KR20210073561A (ko) 제조 필름으로부터의 임의 형상의 시트 파트들에 대한 자동화된 검사
CN116152166A (zh) 基于特征相关性的缺陷检测方法及相关装置
US20210183037A1 (en) Image processing device, image processing method, and image processing non-transitory computer readable medium
JP2007033126A (ja) 基板検査装置並びにそのパラメータ調整方法およびパラメータ調整装置
Ieamsaard et al. Automatic optical inspection of solder ball burn defects on head gimbal assembly
JP2020060398A (ja) 推定器生成装置、検査装置、推定器生成方法、及び推定器生成プログラム
Cislariu et al. Defect detection and restoration of cultural heritage images
JP2022114462A (ja) 検査装置および検査方法
Jean Development of Software Inspection Tools for Defect Examination in Machine Vision

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12866952

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2012866952

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 14370601

Country of ref document: US