WO2017141611A1 - 欠陥検出装置、欠陥検出方法およびプログラム - Google Patents

欠陥検出装置、欠陥検出方法およびプログラム Download PDF

Info

Publication number
WO2017141611A1
WO2017141611A1 PCT/JP2017/001604 JP2017001604W WO2017141611A1 WO 2017141611 A1 WO2017141611 A1 WO 2017141611A1 JP 2017001604 W JP2017001604 W JP 2017001604W WO 2017141611 A1 WO2017141611 A1 WO 2017141611A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
defect
defect candidate
area
region
Prior art date
Application number
PCT/JP2017/001604
Other languages
English (en)
French (fr)
Inventor
努 作山
泰史 永田
大西 浩之
Original Assignee
株式会社Screenホールディングス
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
Priority claimed from JP2016029422A external-priority patent/JP6688629B2/ja
Priority claimed from JP2016052074A external-priority patent/JP6811540B2/ja
Priority claimed from JP2016052075A external-priority patent/JP6812118B2/ja
Application filed by 株式会社Screenホールディングス filed Critical 株式会社Screenホールディングス
Priority to EP17752875.9A priority Critical patent/EP3418726A4/en
Priority to US15/998,664 priority patent/US11216936B2/en
Publication of WO2017141611A1 publication Critical patent/WO2017141611A1/ja
Priority to US17/536,290 priority patent/US20220084183A1/en

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
    • G06T7/001Industrial image inspection using an image reference approach
    • 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
    • G01N21/95Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
    • G01N21/9515Objects of complex shape, e.g. examined with use of a surface follower device
    • 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
    • G01N21/8806Specially adapted optical and illumination features
    • 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
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N33/00Investigating or analysing materials by specific methods not covered by groups G01N1/00 - G01N31/00
    • G01N33/20Metals
    • G01N33/204Structure thereof, e.g. crystal structure
    • G01N33/2045Defects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformation in the plane of the image
    • G06T3/40Scaling the whole image or part thereof
    • 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
    • G01N21/8851Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
    • G01N2021/8887Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
    • 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/30136Metal

Definitions

  • the present invention relates to a technique for detecting defects on the surface of an object.
  • metal parts used for driving parts of automobiles are manufactured by forging or casting. After the metal parts are manufactured, so-called appearance inspection is performed to check whether the obtained metal parts are free from defects such as scratches.
  • Such visual inspection of metal parts has been conventionally performed by visual inspection by an operator. However, depending on the visual observation of the worker, the time required for the inspection and the inspection result vary among the plurality of workers. In addition, even the same worker may take a long time for inspection due to poor physical condition or a decrease in concentration, and a defect may be overlooked. For this reason, development of the apparatus which can perform the external appearance inspection of metal parts automatically and at high speed is calculated
  • a contracted image obtained by binarizing a captured image and then performing expansion processing and contraction processing to eliminate a small-sized defect. , And the difference between this and the captured image is taken to extract a small defect.
  • a large-size defect is also extracted by a difference process between a captured image and a reference image, and at least one of the difference images is determined to be NG (defect).
  • NG defect
  • the inspection by the self-comparison as described above does not require preparation of an image serving as a reference for inspection (hereinafter referred to as “reference image”), and various defects existing in the captured image can be extracted only from the captured image. it can. However, in the surface of the target object included in the captured image, thin lines and fine irregularities that are not defects are also detected as defects, so it is necessary to suppress overdetection.
  • reference image an image serving as a reference for inspection
  • a technique for extracting defect candidates included in a captured image by preparing an image (hereinafter referred to as a “reference image”) as an inspection standard for the captured image and comparing the captured image with a reference image is also known. It is.
  • a predetermined amount of one pixel is positioned two-dimensionally over an extended area in which the required number of pixels is expanded in the area centered on the area of the master pattern that should be positioned with respect to the object pattern area.
  • a plurality of misaligned master patterns are set, and the binarization signal of these master pattern areas and the binarization signal of the object pattern are compared for each master pattern area, and defect detection is performed.
  • the “comparison” technique is disclosed in Japanese Patent Laid-Open No. 62-140009.
  • the inspection for comparing the captured image and the reference image as described above is based on the precondition that an image having no defect is prepared as the reference image.
  • the sheet-like material is irradiated with light from an oblique direction, and from the positional relationship between a dark shadow region and a bright bright spot region, a concave portion, a convex portion, Dirty parts are classified.
  • the appearance inspection apparatus disclosed in Japanese Patent Laid-Open No. 2002-116153 the illuminance of the surface to be inspected is changed, and the flaw is detected accurately by utilizing the fact that the density change in the image due to the illuminance change differs between the flaw and oil.
  • the rod-shaped object inspection apparatus disclosed in Japanese Patent Application Laid-Open No.
  • the rod-shaped object is irradiated with red light and blue light from opposite directions, and the color image is decomposed into a red image and a blue image. Convex defects and dirt are detected from the positional relationship between the light and dark areas.
  • the object of the present invention is to suppress overdetection of defects by excluding defects that are not actually defects (false defects) from defect candidates extracted by self-comparison with high accuracy.
  • a defect detection apparatus for detecting defects on the surface of an object.
  • a defect detection apparatus includes an imaging unit that captures an image of an object and acquires a captured image, a storage unit that stores a reference image corresponding to the captured image, and each pixel of the captured image Corresponding to the captured image of an image obtained by performing one of expansion processing and contraction processing on the value of the image and the captured image, and further performing the other processing different from the one processing of expansion processing and contraction processing.
  • a defect candidate area is detected based on at least one of a difference or a ratio of a pixel to be processed, and the one processing is performed on the value of each pixel of the reference image and the reference image, and the other processing is further performed.
  • the present invention among the defect candidates detected by the self-comparison of the captured image, those that overlap with the self-comparison result of the reference image can be excluded from the defect candidates.
  • Over-detection can be suppressed by removing from the defect candidates a brighter or darker part than the surrounding of the non-existing thing.
  • the defect acquisition unit acquires the first defect in the captured image and the presence of a second defect different from the first defect, and performs an expansion process on the value of each pixel of the captured image and the captured image.
  • the first defect candidate region is detected based on at least one of the difference or ratio between the pixel value corresponding to the captured image of the image obtained by performing the contraction process after performing the processing, and each pixel of the reference image
  • the first mask based on at least one of the difference or the ratio between the value of the pixel and the value of the pixel corresponding to the reference image of the image obtained by performing the contraction process after performing the expansion process on the reference image
  • An area is detected, and an area that overlaps the first mask area is excluded from the first defect candidates among the first defect candidate areas, and then the first defect in the captured image based on the first defect candidate area Get the presence of A first defect acquisition unit, a value of each pixel of the captured image, a value of a pixel corresponding to the captured image of an image obtained by performing an expansion process after performing a
  • the defect acquisition unit can acquire the first defect and the second defect different from the first defect, that is, different types of defects, by changing the order of the expansion process and the contraction process. As a result, it is possible to more reliably prevent detection of defects included in the captured image from being detected.
  • the captured image is darker than the reference image based on a difference image between these images. Is obtained as a third defect candidate area, and an area that does not overlap with the third defect candidate area is excluded from the first defect candidates, and then, based on the first defect candidate area.
  • the presence of the first defect in the captured image is acquired, and the second defect acquisition unit aligns the captured image with the reference image, and then determines the reference image based on a difference image of these images.
  • obtaining a brighter area of the captured image as a fourth defect candidate area and excluding an area that does not overlap with the fourth defect candidate area from the second defect candidates. The above To obtain the presence of the second defect in the captured image based on the second defect candidate regions.
  • defect candidates detected by so-called self-comparison an area that does not overlap with a defect candidate detected by a difference image between the captured image and the reference image (a defect candidate detected by so-called other comparison) is excluded from the defect candidates.
  • overdetection can be more reliably suppressed.
  • a defect detection method includes: a) an imaging step of capturing an image of an object by an imaging unit to obtain a captured image; b) a value of each pixel of the captured image, and the captured image.
  • a value of a pixel corresponding to the captured image of an image obtained by performing one process of the expansion process and the contraction process and further performing the other process different from the one process of the expansion process and the contraction process A defect candidate area detection step for detecting a defect candidate area based on at least one of the difference or the ratio; and c) a reference image corresponding to the captured image is prepared, and the value of each pixel of the reference image, A mask for detecting a mask region based on at least one of a difference or a ratio between a pixel value corresponding to the reference image of an image obtained by performing the one process on the reference image and further performing the other process.
  • An area detection step; and d) defect candidate exclusion that obtains the presence of a defect in the captured image based on the defect candidate area after excluding an area that overlaps the mask area from the defect candidate area.
  • an area overlapping with the self-comparison result of the reference image can be excluded from the defect candidates.
  • Over-detection can be suppressed by removing from the defect candidates a brighter or darker part than the surrounding of the non-existing thing.
  • the present invention is also directed to a program for causing a computer to detect a defect in the target area from a plurality of images of the target area on the surface of the target object.
  • Execution of the program according to one preferred embodiment of the present invention by the computer includes: a) preparing a captured image acquired by imaging the target region and a corresponding reference image; b) the imaging The image of the image obtained by performing one of expansion processing and contraction processing on the value of each pixel of the image and the captured image, and further performing the other processing different from the one processing of expansion processing and contraction processing
  • a defect candidate area detecting step for detecting a defect candidate area based on at least one of a difference or a ratio of a pixel corresponding to the captured image; and c) a reference image corresponding to the captured image is prepared.
  • a mask region detection step for detecting a mask region based on at least one of the difference or the ratio of the difference, and d) a region that overlaps the mask region among the defect candidate regions is excluded from the defect candidates, and A defect candidate excluding step of acquiring the presence of a defect in the captured image based on a defect candidate area is executed.
  • a defect detection device that excludes, from defect candidates, a region that overlaps with a self-comparison result of a reference image among defect candidates detected by self-comparison of captured images.
  • overdetection can be suppressed by removing, from the defect candidates, a brighter or darker part than the surroundings that is not a defect included in the captured image.
  • Another object of the present invention is to suppress excessive detection of defects even when an image including a defect is used as a reference image.
  • a defect detection apparatus includes an imaging unit that captures an image of an object and acquires the captured image, a storage unit that stores a reference image corresponding to the captured image, and the captured image.
  • a defect acquisition unit that acquires the presence of a defect, and the defect acquisition unit performs one of expansion processing and contraction processing on the value of each pixel of the captured image and the captured image, and further performs expansion processing.
  • a self-comparison defect candidate region is acquired based on at least one of a difference or a ratio of a pixel corresponding to the captured image of an image obtained by performing the other processing different from the one processing among the shrinking processing.
  • the self-comparison defect candidate acquisition unit and the captured image and the reference image are aligned, if the one process is an expansion process, the difference image or the ratio image of these images is reduced. If the captured image is darker than the reference image on the basis of one of the reference images, and the other image comparison defect candidate region is acquired, and if the one process is a contraction process, the difference image or ratio of these images Output from the other image comparison defect candidate acquisition unit that acquires, as the other image comparison defect candidate region, a region where the captured image is brighter than the reference image based on at least one of the images, and the self comparison defect candidate acquisition unit A defect candidate limiting unit that acquires, as a defect candidate region, a region where the self-comparison defect candidate region to be overlapped with the other image comparison defect candidate region output from the other image comparison defect candidate acquisition unit.
  • self-comparison defect candidates detected based on self-comparison of captured images (comparison between the captured image itself and an image obtained by subjecting the captured image to expansion / contraction processing or contraction / expansion processing), the captured image,
  • noise included in at least one of the self comparison defect candidate and the other image comparison defect candidate Can be removed, and overdetection can be suppressed.
  • the self-comparison defect candidate acquiring unit corresponds to the reference image of an image obtained by performing the one process on the value of each pixel of the reference image and the reference image, and further performing the other process.
  • a self-comparison mask region is further detected on the basis of at least one of a difference or a ratio of a pixel to be processed, and a region that overlaps the self-comparison mask region is selected from the self-comparison defect candidate regions. After excluding from the region, the self-comparing defect candidate region is output to the defect candidate limiting unit.
  • the self-comparison defect candidate acquisition unit excludes a region that is not a defect included in the self-comparison defect candidate detected by so-called self-comparison of the captured image based on a self-comparison mask region that is a self-comparison result of the reference image. Overdetection can be suppressed more reliably.
  • a defect detection method includes: a) an imaging step of capturing an image of an object by an imaging unit to obtain a captured image; b) a value of each pixel of the captured image, and the captured image.
  • the one process is an expansion process after the registration of the image
  • the captured image is darker than the reference image based on at least one of the difference image or the ratio image of these images
  • the one process is a contraction process
  • the captured image is compared to the reference image based on at least one of a difference image or a ratio image of these images.
  • Another image comparison defect candidate acquisition step of acquiring a bright region as the other image comparison defect candidate region, d) the self comparison defect candidate region acquired by the self comparison defect candidate acquisition step, and the other image comparison defect candidate A defect candidate limiting step of acquiring, as a defect candidate region, a region overlapping with the other image comparison defect candidate region acquired by the acquisition step.
  • the region where the self-comparison defect candidate detected based on the self-comparison of the captured image and the other image comparison defect candidate detected based on the other image comparison between the captured image and the reference image are overlapped.
  • noise included in at least one of the self-comparison defect candidate and the other image comparison defect candidate can be removed, and overdetection can be suppressed.
  • the present invention is also directed to a program for causing a computer to detect a defect in the target area from a plurality of images of the target area on the surface of the target object.
  • Execution of the program according to one preferred embodiment of the present invention by the computer includes: a) preparing a captured image acquired by imaging the target region and a corresponding reference image; b) the imaging The image of the image obtained by performing one of expansion processing and contraction processing on the value of each pixel of the image and the captured image, and further performing the other processing different from the one processing of expansion processing and contraction processing
  • the reference image is determined based on at least one of the difference image or the ratio image of these images.
  • another image comparison defect candidate acquisition step of acquiring a brighter region of the captured image as the other image comparison defect candidate region, and d) the self comparison defect candidate region acquired by the self comparison defect candidate acquisition step is executed.
  • a self-comparison defect candidate detected based on a self-comparison of a captured image and another image comparison defect candidate detected based on another image comparison between the captured image and a reference image Therefore, it is possible to obtain a defect detection device that acquires an overlapping area as a defect candidate area, and as a result, it is possible to remove noise included in at least one of a self-comparison defect candidate and another image comparison defect candidate, Can be suppressed.
  • Another object of the present invention is to suppress overdetection of defects by removing from the defect candidates those resulting from the color of the surface of the object with high accuracy.
  • a defect detection apparatus includes a light irradiation unit capable of irradiating light on a target object in a plurality of different illumination states, and a target on the surface of the target object. From an imaging unit that acquires an image of a region as a captured image, an imaging control unit that controls an illumination state by the light irradiation unit, and acquisition of an image by the imaging unit, and at least one captured image used for defect detection Referring to the corresponding reference image, one of the dark region and the bright region is acquired as a defect candidate region with respect to the reference image, and the corresponding reference is obtained from each of the plurality of captured images acquired in a plurality of illumination states.
  • the other of the dark area and the bright area with respect to the reference image is acquired as a light / dark reverse area, and any of the defect candidate areas overlaps with the light / dark reverse area over a predetermined condition On excluding those without al from the defect candidate, and a defect acquisition unit for acquiring the presence of defects based on the defect candidate regions.
  • the at least one captured image used for defect detection is included in the plurality of captured images acquired in the plurality of illumination states.
  • the defect acquisition unit refers to a corresponding reference image from the at least one picked-up image used for defect detection, and determines the other of the dark area and the bright area as another defect candidate area with respect to the reference image. And the brightness inversion region corresponding to the defect candidate region is acquired when the other defect candidate region is acquired.
  • the defect acquisition unit acquires a first defect candidate region from the at least one captured image used for defect detection by a first method, and a second method different from the first method.
  • a second defect candidate region is obtained at, and the defect candidate region is obtained based on the first defect candidate region and the second defect candidate region.
  • the first method is a method of acquiring the first defect candidate region from a difference image of these images after performing alignment between the captured image and the reference image
  • the second method Is a method of acquiring the second defect candidate region from a difference image of these images after performing a minute region removal process on the captured image and the reference image.
  • a defect detection method includes: a) an object on a surface of the object by an imaging unit while the object is irradiated with light in each of a plurality of different illumination states different from each other; A step of acquiring a plurality of captured images by acquiring an image of the region; and b) a dark region with respect to the reference image while referring to the corresponding reference image from at least one captured image used for defect detection And a step of acquiring one of the bright areas as a defect candidate area, and c) the other of the dark area and the bright area with respect to the reference image while referring to the corresponding reference image from each of the plurality of captured images. And d) excluding, from the defect candidates, the defect candidate areas that do not overlap with any of the light and dark reverse areas for a predetermined condition or more, and then based on the defect candidate areas. And a step of acquiring the presence of defects Te.
  • the at least one captured image used for defect detection is included in the plurality of captured images acquired in the plurality of illumination states.
  • the defect detection method e) from the at least one captured image used for defect detection, referring to the corresponding reference image, the other of the dark region and the bright region with respect to the reference image is determined as another defect.
  • the method further includes a step of acquiring as a candidate region, and the step c) is included in the step e).
  • the present invention is also directed to a program for causing a computer to detect a defect in the target area from a plurality of images of the target area on the surface of the target object.
  • the execution of the program according to one preferred embodiment of the present invention by the computer is performed by the computer: a) a plurality of captured images of the target area and a plurality of corresponding reference images acquired in a plurality of different biased illumination states; And b) acquiring one of a dark area and a bright area as a defect candidate area with respect to the reference image while referring to the corresponding reference image from at least one captured image used for defect detection.
  • C) a step of acquiring, from each of the plurality of captured images, the other of the dark region and the bright region with respect to the reference image while referring to the corresponding reference image, and d) the defect candidate region Of these, after removing from the defect candidates those that do not overlap with any of the light and dark reverse areas for more than a predetermined condition, To execute a step of acquiring the presence of.
  • FIG. 1 shows the structure of a 4th defect candidate acquisition part. It is a figure which shows the structure of the defect candidate limitation part in FIG. It is a figure which shows the flow of operation
  • FIG. 1 is a diagram showing a configuration of a defect detection apparatus 1 according to an embodiment of the present invention.
  • FIG. 2 is a plan view showing the main body 11 of the defect detection apparatus 1.
  • the defect detection apparatus 1 is an apparatus that inspects the appearance of a three-dimensional object 9 having a non-mirror surface, and detects defects on the surface of the object 9.
  • the object 9 is a metal part formed by forging or casting, for example.
  • the surface of the object 9 has a satin-like shape with minute irregularities, that is, a matte state. In other words, the surface of the object 9 is glossy while irregularly reflecting light.
  • the glossiness of the surface of the object 9 is preferably about 20 to about 60.
  • the glossiness is an index that one-dimensionally represents the degree of gloss on the surface of an object by paying attention to the ratio of regular reflection light, the direction distribution of diffuse reflection light, and the like.
  • the glossiness is measured using a gloss meter that conforms to an industrial standard glossiness measurement method such as JIS.
  • the surface of the object 9 is processed by shot blasting using a predetermined projection material such as sand blasting or steel shot blasting to remove the boundary between the upper and lower surfaces and the side surfaces, the corners at the edges, and burrs during molding. It has a shape (so-called R shape).
  • the object 9 is various parts used for a universal joint, for example, for example, is a metal part used for the drive part of a vehicle, an aircraft, or a generator.
  • the defect on the surface of the object 9 is a portion that is concave or convex with respect to an ideal shape.
  • the defects are, for example, dents, scratches, processing defects, and the like.
  • the defect may be a foreign matter adhering to the surface.
  • the defect detection apparatus 1 includes a main body 11 and a computer 12.
  • the main body 11 includes a holding unit 2, a plurality of imaging units 3 (in FIG. 1, reference numerals 3 a, 3 b, and 3 c are attached, but a reference numeral 3 is attached when they are not distinguished), and a light irradiation unit 4. .
  • the object 9 is held by the holding unit 2.
  • the main body 11 is provided with a light-shielding cover (not shown) that prevents external light from reaching the holding unit 2, and the holding unit 2, the imaging unit 3, and the light irradiation unit 4 are provided in the light-shielding cover.
  • Another main body 11 When the entire surface of the object 9 is automatically inspected, another main body 11 is provided. A mechanism is provided between the two main bodies 11 to convey the object 9 by turning the object 9 upside down.
  • the plurality of imaging units 3 include one upper imaging unit 3a, eight oblique imaging units 3b, and eight side imaging units 3c.
  • the upper imaging unit 3 a is disposed above the holding unit 2. An image obtained by imaging the object 9 on the holding unit 2 from directly above can be acquired by the upper imaging unit 3a.
  • the eight oblique imaging units 3 b are arranged around the holding unit 2.
  • the eight oblique imaging units 3b pass through the center of the holding unit 2 and are arranged at an angular interval (angular pitch) of 45 ° in the circumferential direction centering on the central axis J1 that faces the vertical direction.
  • the angle ⁇ 2 formed by the optical axis K2 and the central axis J1 is approximately 45 °.
  • An image obtained by imaging the object 9 on the holding unit 2 from obliquely above can be acquired by each oblique imaging unit 3b. If the object 9 is imaged obliquely from above, the angle ⁇ 2 is not limited to 45 °, and may be arbitrarily set within a range of 15 to 75 °.
  • the eight side imaging units 3c are also arranged around the holding unit 2 in the same manner as the eight oblique imaging units 3b.
  • the eight side imaging units 3c are arranged at an angular interval of 45 ° in the circumferential direction.
  • an angle ⁇ 3 formed by the optical axis K3 and the central axis J1 is approximately 90 °.
  • An image obtained by imaging the object 9 on the holding unit 2 from the side can be acquired by each side imaging unit 3c.
  • the upper imaging unit 3a, the oblique imaging unit 3b, and the side imaging unit 3c have, for example, a two-dimensional image sensor such as a CCD (Charge-Coupled Device) or a CMOS (Complementary Metal-Oxide-Semiconductor). Is acquired.
  • the upper imaging unit 3a, the oblique imaging unit 3b, and the side imaging unit 3c are supported by a support unit (not shown).
  • the light irradiation unit 4 includes one upper light source unit 4a, eight oblique light source units 4b, and eight side light source units 4c.
  • the upper light source unit 4a is adjacent to the upper imaging unit 3a.
  • a plurality of LEDs are arranged perpendicular to the central axis J1, that is, horizontally.
  • the upper light source unit 4a irradiates the object 9 on the holding unit 2 from substantially above.
  • the eight oblique light source parts 4b are arranged around the holding part 2.
  • the oblique light source unit 4b is adjacent to the oblique imaging unit 3b.
  • the eight oblique light source parts 4b are arranged at an angular interval of 45 ° in the circumferential direction.
  • a plurality of LEDs are arranged substantially perpendicular to the optical axis K2.
  • the object 9 on the holding unit 2 can be irradiated with light from obliquely above.
  • the eight side light source parts 4 c are arranged around the holding part 2.
  • the side light source units 4c are adjacent to the side imaging unit 3c.
  • the eight side light source parts 4c are arranged at an angular interval of 45 ° in the circumferential direction.
  • a plurality of LEDs are arranged substantially perpendicular to the optical axis K3 and in the horizontal direction. Therefore, the eight side light source parts 4c form a substantially octagonal shape in plan view.
  • light can be irradiated from the side to the object 9 on the holding unit 2.
  • the light color is white, but the light color and wavelength band may be variously changed.
  • the light irradiation unit 4 can irradiate the object 9 with diffused light from various directions.
  • each state in which light is irradiated from at least one specific light source unit and the object 9 is illuminated with polarized light is referred to as an “illumination state”.
  • the light irradiation unit 4 can irradiate the object 9 with light in a plurality of different illumination states different from each other.
  • FIG. 3 is a diagram showing the configuration of the computer 12.
  • the computer 12 has a general computer system configuration including a CPU 121 that performs various arithmetic processes, a ROM 122 that stores basic programs, and a RAM 123 that stores various information.
  • the computer 12 includes a fixed disk 124 that stores information, a display 125 that displays various types of information such as images, a keyboard 126a and a mouse 126b that accept input from an operator (hereinafter collectively referred to as “input unit 126”), and the like.
  • a reading device 127 that reads information from a computer-readable recording medium 8 such as an optical disk, a magnetic disk, or a magneto-optical disk, and a communication unit 128 that transmits / receives signals to / from other components of the defect detection device 1 Including.
  • a computer-readable recording medium 8 such as an optical disk, a magnetic disk, or a magneto-optical disk
  • a communication unit 128 that transmits / receives signals to / from other components of the defect detection device 1 Including.
  • the program 80 is read from the recording medium 8 via the reader 127 in advance and stored in the fixed disk 124.
  • the CPU 121 executes arithmetic processing according to the program 80 while using the RAM 123 and the fixed disk 124.
  • the CPU 121 functions as a calculation unit in the computer 12. Other configurations that function as a calculation unit other than the CPU 121 may be employed.
  • FIG. 4 is a diagram showing functions realized by the computer 12 executing arithmetic processing according to the program 80.
  • the imaging control unit 51, the defect acquisition unit 52, and the storage unit 53 correspond to functions realized by the computer 12. All or part of these functions may be realized by a dedicated electric circuit. These functions may be realized by a plurality of computers.
  • the imaging control unit 51 controls the imaging unit 3 and the light irradiation unit 4 to acquire an image of the object 9 (more precisely, data indicating the image).
  • the image data is stored in the storage unit 53.
  • the imaging unit 3 is shown as one block, but actually, the upper imaging unit 3 a, the oblique imaging unit 3 b, and the side imaging unit 3 c are connected to the imaging control unit 51.
  • image data is acquired by at least one of the 17 imaging units 3.
  • an image acquired by imaging is referred to as “captured image”, and the data is referred to as “captured image data”.
  • the captured image data 911 is stored in the storage unit 53.
  • the storage unit 53 stores image data of an ideal object 9 in each illumination state as reference image data 912. That is, ideal image data corresponding to each illumination state of each imaging unit 3 is prepared in the storage unit 53 as reference image data 912.
  • the illumination state of light by the light irradiation unit 4 refers to a state in which light is irradiated on the object 9 from a specific irradiation direction.
  • the irradiation direction is not strictly defined and means an approximate light irradiation direction.
  • the irradiation direction is not limited to parallel light when light is irradiated only from that direction. To irradiate light from a certain direction means to irradiate with a deviation from that direction.
  • the number of light irradiation directions in one photographing is not limited to one. For example, light may be simultaneously emitted from a plurality of light source units that are separated from each other.
  • the defect acquisition unit 52 includes a first defect acquisition unit 521 and a second defect acquisition unit 522.
  • the “first defect” means a defect that appears dark in an image, that is, a “dark defect”.
  • the “second defect” means a defect that appears brightly in an image, that is, a “bright defect”.
  • FIG. 5 is a diagram illustrating a configuration of the first defect acquisition unit 521.
  • the first defect acquisition unit 521 includes a first defect candidate acquisition unit 541, a third defect candidate acquisition unit 551, and a defect candidate limitation unit 581.
  • the first defect acquisition unit 521 performs processing based on the input captured image data 911 and reference image data 912, whereby first defect data 931 that is image data indicating the first defect area is acquired.
  • the first defect area is a dark area in the captured image that is dark with respect to the reference image by various processes that will be described later (in the captured image, an area that is not originally the first defect and is a first defect candidate area that will be described later). This is a region from which the detected region) has been removed.
  • FIG. 6 is a diagram illustrating a configuration of the first defect candidate acquisition unit 541.
  • the first defect candidate acquisition unit 541 includes two filter processing units 542, a pre-alignment unit 543, an expansion processing unit 544, a contraction processing unit 545, a comparison unit 546, a binarization unit 547, and an area filter unit. 548.
  • the first defect candidate acquisition unit 541 performs processing based on the input captured image data 911 and reference image data 912, whereby first defect candidate data 921 that is image data indicating the first defect candidate region is acquired.
  • the first defect candidate region is a dark region with respect to the reference image in the captured image.
  • FIG. 7 is a diagram showing a configuration of the third defect candidate acquisition unit 551.
  • the third defect candidate acquisition unit 551 includes two filter processing units 552, a pre-alignment unit 553, a shake comparison unit 554, a binarization unit 555, and an area filter unit 556.
  • the third defect candidate acquisition unit 551 Based on the input captured image data 911 and reference image data 912, the third defect candidate acquisition unit 551 performs processing to acquire third defect candidate data 923 that is image data indicating the third defect candidate region.
  • the third defect candidate region is a dark region with respect to the reference image in the captured image. As will be described later, the method for acquiring the third defect candidate region is different from the method for acquiring the first defect candidate region.
  • FIG. 8 is a diagram showing a configuration of the defect candidate limiting unit 581.
  • the defect candidate limiting unit 581 includes two or more logical product calculation units 582 and 583 and a region selection unit 584. Based on the input first defect candidate data 921 and third defect candidate data 923, the defect candidate limiting unit 581 performs processing, whereby first defect data 931 is acquired.
  • FIG. 9 is a diagram illustrating a configuration of the second defect acquisition unit 522.
  • the second defect acquisition unit 522 includes a second defect candidate acquisition unit 561, a fourth defect candidate acquisition unit 571, and a defect candidate limitation unit 591.
  • the second defect acquisition unit 522 Based on the input captured image data 911 and reference image data 912, the second defect acquisition unit 522 performs processing, whereby second defect data 932, which is image data indicating the second defect area, is acquired.
  • the second defect region is a region that is brighter than the reference image in the captured image, and is subjected to noise (a region that is not originally a second defect in the captured image and is a second defect candidate region described later) by various processes described later. This is a region from which the detected region) has been removed.
  • FIG. 10 is a diagram illustrating a configuration of the second defect candidate acquisition unit 561.
  • the second defect candidate acquisition unit 561 includes two filter processing units 562, a pre-alignment unit 563, a contraction processing unit 564, an expansion processing unit 565, a comparison unit 566, a binarization unit 567, and an area filter unit. 568.
  • the second defect candidate acquisition unit 561 Based on the input captured image data 911 and reference image data 912, the second defect candidate acquisition unit 561 performs processing, whereby second defect candidate data 922, which is image data indicating the second defect candidate region, is acquired.
  • the second defect candidate area is an area brighter than the reference image in the captured image.
  • FIG. 11 is a diagram illustrating a configuration of the fourth defect candidate acquisition unit 571.
  • the fourth defect candidate acquisition unit 571 includes two filter processing units 572, a pre-alignment unit 573, a sway comparison unit 574, a binarization unit 575, and an area filter unit 576.
  • the fourth defect candidate acquisition unit 571 Based on the input captured image data 911 and reference image data 912, the fourth defect candidate acquisition unit 571 performs processing, whereby fourth defect candidate data 924, which is image data indicating the fourth defect candidate region, is acquired.
  • the fourth defect candidate area is an area brighter than the reference image in the captured image.
  • the method for acquiring the fourth defect candidate region is different from the method for acquiring the second defect candidate region.
  • FIG. 12 is a diagram showing a configuration of the defect candidate limiting unit 591.
  • the defect candidate limiting unit 591 includes two or more logical product calculation units 592 and 593 and a region selection unit 594. Based on the input second defect candidate data 922 and fourth defect candidate data 924, the defect candidate limiting unit 591 performs processing, whereby second defect data 932 is acquired.
  • first defect candidate acquisition units 541 and third defect candidate acquisition units 551 are provided in the first defect acquisition unit 521, and a large number of second defect candidate acquisition units 561 are provided.
  • the 4th defect candidate acquisition part 571 is provided in the 2nd defect acquisition part 522, and a process is performed in parallel with respect to a some captured image.
  • FIG. 13 is a diagram showing an operation flow of the defect detection apparatus 1.
  • the object 9 to be inspected is held on the holding unit 2.
  • the holding unit 2 is provided with, for example, an abutting portion for alignment. When the predetermined portion of the object 9 is in contact with the abutting portion, the object 9 is in a predetermined direction at a predetermined position. It is arranged at.
  • the holding unit 2 may be a stage provided with positioning pins.
  • the imaging control unit 51 performs imaging with the selected imaging unit 3 while changing the illumination state by changing the light source unit to be lit (steps S11 to S13). That is, the imaging control unit 51 issues a lighting command to the light irradiation unit 4, the light irradiation process (step S ⁇ b> 11) in which the selected light irradiation unit 4 is turned on, and the imaging control unit 51 during the light irradiation unit 4 is lighting.
  • the imaging unit 3 selected by the above-described imaging unit 3 captures an image of the object 9 and acquires the captured image (step S12). After the imaging step, the imaging control unit 51 determines whether or not to perform the next imaging.
  • the imaging continuation determination step (step S13) is executed.
  • one side imaging unit 3c is selected, and one of the five side light source units 4c continuous in the horizontal direction with the side imaging unit 3c as the center is sequentially selected and turned on.
  • the side imaging unit 3c acquires an image.
  • the above operation is repeated while changing the side imaging unit 3c.
  • the operation time can be shortened by performing imaging with the plurality of side imaging units 3c in each illumination state.
  • all the side light sources 4c are turned on, and imaging is performed by all the side imaging units 3c. Thereby, six images are acquired by each side imaging unit 3c.
  • the oblique imaging unit 3b In the case of the oblique imaging unit 3b, one oblique imaging unit 3b is selected, one of the eight oblique light source units 4b is sequentially selected and turned on, and the oblique imaging unit 3b acquires an image every time it is turned on. To do. The above operation is repeated while changing the oblique imaging unit 3b. Actually, the operation time can be shortened by performing imaging in all the oblique imaging units 3b in each illumination state. Further, all the oblique light sources 4b are turned on, and imaging is performed by all the oblique imaging units 3b. Even in the state where only the upper light source unit 4a is turned on, imaging is performed by all the oblique imaging units 3b. Thereby, ten images are acquired in each oblique imaging unit 3b.
  • the illumination state is changed as in the oblique imaging unit 3b, and ten images are acquired.
  • the operation time can be shortened by performing imaging with the upper imaging unit 3a during imaging by the oblique imaging unit 3b.
  • the data of the captured image is stored in the storage unit 53 as captured image data 911.
  • reference image data corresponding to each captured image is prepared as reference image data 912 in the storage unit 53.
  • the reference image indicates an object 9 (so-called non-defective product) extracted as a defect inspection standard under the same illumination state as the captured image.
  • the reference image data 912 may be acquired by capturing an image of the target 9 having no defect, or may be acquired as average image data of images of a large number of targets 9.
  • the defect acquisition unit 52 executes a first defect acquisition process (step S14) and a second defect acquisition process (step S15).
  • the first defect acquisition step S14 is a step of acquiring the first defect included in the captured image.
  • the second defect acquisition step S15 is a step of acquiring the second defect included in the captured image.
  • the first defect acquisition step S14 and the second defect acquisition step S15 are executed in parallel in the defect acquisition unit 52, but the present invention is not limited to this, and the first defect acquisition step S14 may be executed prior to the second defect acquisition step S15, or in the reverse order.
  • the processing for the image data may be simply expressed as processing for the image. Further, only the processing focused on one imaging unit 3 will be described. Similar processing is performed for the other imaging units 3.
  • the defect detection apparatus 1 can detect the presence of the first defect (dark defect) and the second defect (bright defect). In the following description, the first defect will be described. In the two-defect detection process, the description common to the first defect detection process is omitted as appropriate.
  • FIG. 14 is a diagram showing details of the first defect acquisition step S14.
  • the first defect acquisition step S14 includes a first defect candidate acquisition step S141, a third defect candidate acquisition step S142, and a defect candidate limitation step S143.
  • FIG. 15 is a diagram showing details of the second defect acquisition step S15.
  • the second defect acquisition step S15 includes a second defect candidate acquisition step S151, a fourth defect candidate acquisition step S152, and a defect candidate limitation step S153.
  • FIG. 16 is a diagram showing details of the first defect candidate acquisition step S141.
  • the first defect candidate acquisition step S141 includes a first defect candidate region detection step S1411 for detecting the first defect candidate region, a first mask region detection step S1412 for detecting the first mask region, and the first defect candidate regions. , Including a defect candidate exclusion step S1413 for excluding those overlapping the first mask region from the first defect candidate by a predetermined condition or more and a post-processing step S1414.
  • FIG. 17 is a diagram showing details of the second defect candidate acquisition step S151.
  • the second defect candidate acquisition step S151 includes a second defect candidate region detection step S1511 for detecting a second defect candidate region, a second mask region detection step S1512 for detecting a second mask region, and the second defect candidate regions.
  • a first defect candidate acquisition step S141 is executed.
  • the first defect candidate acquisition step S141 first, one captured image is selected by the first defect acquisition unit 521, and a reference image corresponding to the captured image is selected.
  • captured image data 911 of the captured image is input to the filter processing unit 542 (captured image data input step S201), and the reference image data 912 of the reference image is filtered. Is input to the unit 542 (reference image data input step S211).
  • the filter processing unit 542 and the pre-alignment unit 543 perform pre-processing steps S202 and S212 that perform filter processing and pre-alignment processing on the captured image and the reference image.
  • filter processing for reducing noise such as a median filter and a Gaussian filter
  • the filtered captured image and reference image are output to the pre-alignment unit 543.
  • a relative position and an angle shift amount with respect to the captured image of the reference image are specified by pattern matching using a predetermined pattern.
  • the approximate position and angle of the reference image are matched to the captured image by translating and rotating the reference image with respect to the captured image by the amount of positional and angular deviation between the two images. Thereby, pre-alignment with respect to both images is performed.
  • FIG. 18 is an image example showing the contents of the process in the first defect candidate acquisition step S141.
  • a captured image that has been input in the captured image data input step S201 and in which the preprocessing step S202 has been executed is illustrated as a captured image 811.
  • the reference image input in the reference image data input step S211 and executed in the preprocessing step S212 is exemplified as the reference image 812.
  • a region appearing in the captured image 811 and the reference image 812 is referred to as a “target region 70” and is indicated by a rectangle in the captured image 811 and the reference image 812.
  • the imaging unit 3 and the target area 70 correspond one-to-one, and each imaging unit 3 always acquires an image of the same target area 70.
  • a first defect 711 that appears darker than the surroundings and a second defect 721 that appears brighter than the surroundings can be confirmed. These are, for example, dents and scratches.
  • the target area 70 of the captured image 811 includes pattern portions 712 and 722.
  • the pattern portion 712 is a concave portion or convex portion that appears brighter than the surroundings
  • the pattern portion 722 is a concave portion or convex portion that appears darker than the surroundings.
  • the target area 70 of the reference image 812 In the target area 70 of the reference image 812, a second defect 721 that appears brighter than the surroundings can be confirmed. Normally, it is ideal to extract and acquire the defect-free target 9 as the reference image, but the target 9 extracted for the reference image may also contain a defect.
  • the target area 70 of the reference image 812 includes pattern portions 712 and 722 at the same position as the captured image 811.
  • the captured image 811 and the reference image 812 illustrated in FIG. 18 are exaggerated representations of the first defect, the second defect, the pattern portion, and the like for the sake of explanation.
  • the actual defect and the like are represented by smaller pixels. Sometimes expressed.
  • the defect and the pattern portion are described for convenience. However, in the actual image, the dark region is either the first defect or the pattern portion, or is bright. Whether the portion to be reflected is the second defect or the pattern portion is determined for the first time through the processing described later, and the distinction between the defect and the pattern portion is unknown at the stage of the captured image 811 and the reference image 812.
  • the expansion processing unit 544 performs expansion processing steps S203 and S213 for performing expansion processing on the pre-aligned captured image and reference image.
  • the captured image data 911 and the reference image data 912 are input from the pre-alignment unit 543 to the expansion processing unit 544, and expansion processing is performed on the captured image and the reference image.
  • the expansion process here is a process of expanding a bright region in the multi-valued image.
  • a known maximum value filter is used.
  • the maximum value filter is a filter that extracts a pixel having a maximum pixel value from pixels within a kernel size centered on the target pixel and changes the pixel value of the target pixel to the maximum pixel value. By passing through the maximum value filter, a pixel having a high pixel value (ie, bright) is expanded to 3 pixels ⁇ 3 pixels.
  • the expanded image 811a and the expanded image 812a of FIG. 18 are generated.
  • the expanded image 811a and the expanded image 812a are multi-valued images.
  • the second defect 721a and the pattern portion 712a which are bright regions are confirmed in an expanded state, while the small dark region disappears.
  • the kernel size of the maximum value filter is not limited to 3 pixels ⁇ 3 pixels, and various other sizes may be adopted.
  • the contraction processing unit 545 executes contraction processing steps S204 and S214 for performing contraction processing on the captured image and the reference image that have been subjected to expansion processing.
  • the contraction process is a process for contracting a bright region in a multi-valued image.
  • a minimum value filter having the same size as that of the maximum value filter used in the expansion process is used, and the bright area is returned to the original size.
  • the minimum value filter is a filter that extracts a pixel having a minimum pixel value from among pixels within a kernel size centered on the target pixel, and changes the pixel value of the target pixel to the minimum pixel value.
  • the contracted image 811b and the contracted image 812b shown in FIG. 18 are generated.
  • the contracted image 811b and the contracted image 812b are multi-valued images.
  • the second defect 721b and the pattern portion 712b which are bright regions, are confirmed in a state in which they have almost returned to their original sizes.
  • the expansion process and the contraction process the large dark area in the original captured image and the reference image is substantially maintained in the original state, and the small dark area disappears. Note that in the image example of FIG. 18, all dark areas disappear by the expansion process.
  • the comparison unit 546 executes comparison processing steps S205 and S215 for performing a comparison process on the captured image and the reference image that have been subjected to the contraction process.
  • the comparison unit 546 first calculates the captured image and the contracted image obtained by expanding and contracting the captured image.
  • a comparison image is generated based on at least one of the difference and the ratio (comparison processing step S205), and at the same time, at least one of the difference and the ratio between the reference image and the contracted image obtained by expanding and contracting the reference image.
  • a comparison image is generated based on (Comparison processing step S215).
  • the comparison processing step S205 generates a comparison image based on at least one of a difference and a ratio between the captured image and a contracted image obtained by expanding / contracting the captured image.
  • whether to be based on the difference or the ratio is determined based on a parameter predetermined by the program 80 or a parameter instructed by the user using the input unit 126.
  • various predetermined values, reference values, and threshold values used in the defect inspection apparatus 1 of the present application are determined based on parameters predetermined by the program 80 or parameters designated by the user using the input unit 126.
  • generation of a comparison image based on a difference and generation of a comparison image based on a ratio will be described.
  • a comparison image is acquired by a difference (for example, subtraction process). Specifically, a difference image indicating a difference between both images by subtracting a pixel value in a region overlapping the captured image of the contracted image obtained by expanding / contracting the captured image from the value of each pixel of the captured image. Is acquired. And the comparison image which extracted the area
  • a difference image indicating a difference between both images by subtracting a pixel value in a region overlapping the captured image of the contracted image obtained by expanding / contracting the captured image from the value of each pixel of the captured image.
  • a pixel value in which the absolute value of the pixel is equal to or less than a predetermined threshold in the difference image is set to “0”, and an area having a pixel value greater than 0 is extracted as the first defect candidate area.
  • the extraction method of the first defect candidate region in the present invention is not limited to this, and the first defect candidate region may be extracted by performing binarization processing on the difference image with a predetermined threshold.
  • the captured image has a lightness lower than that of the contracted image obtained by expanding / contracting the captured image, and the absolute value of the difference in brightness is not less than the first reference value.
  • the region is represented in the comparative image as the first defect candidate region.
  • the first reference value is a positive value.
  • an area whose brightness is lower than a predetermined value than the contracted image obtained by expanding and contracting the captured image is represented as a first defect candidate area in the comparative image.
  • the pixel value may be regarded as lightness.
  • the image is a color image, a value obtained by performing a predetermined calculation on the pixel value for each color component is treated as lightness.
  • the first defect candidate region is obtained from the ratio between the value of each pixel of the captured image and the value of the corresponding pixel of the contracted image obtained by expanding and contracting the captured image.
  • the pixel value of the ratio image is obtained by dividing the value of each pixel of the contracted image obtained by expanding and contracting the captured image by the value of the corresponding pixel of the captured image.
  • a first reference value greater than 1 is prepared in advance, and an area composed of pixels having a value equal to or greater than the first reference value in the ratio image is extracted as a first defect candidate area, and the first defect candidate area is A comparative image is acquired.
  • the pixel value of the ratio image may be obtained by dividing the value of each pixel of the captured image by the value of the corresponding pixel of the contracted image obtained by expanding and contracting the captured image.
  • an area composed of pixels having a value equal to or smaller than the first reference value smaller than 1 in the ratio image is extracted as the first defect candidate area, and a comparative image including the first defect candidate area is acquired.
  • the first reference value may not be a constant.
  • the first reference value may be a function of the brightness or pixel value of the captured image.
  • the first reference value may be determined by using the brightness or pixel value difference and ratio of the captured image, and other calculations may be used.
  • the first to fourth reference values do not have to be the same value, and the calculation method may be different.
  • the “predetermined condition” may be set individually for each captured image. Furthermore, a plurality of “predetermined conditions” may be used for one captured image.
  • the first reference value may be set at a position where the pixel value is likely to change for each imaging, such as an edge in the captured image, so that it is not easily detected as a defect candidate area.
  • the above description also applies to the extraction of the following second defect candidate region, third defect candidate region, and fourth defect candidate region.
  • the comparison processing step S215 generates a comparison image based on at least one of a difference and a ratio between the reference image and the contracted image obtained by expanding and contracting the reference image. For the acquisition of the difference image or the ratio image, the same processing as the comparison processing step S205 for the captured image is performed. In the comparison process step S215, a first mask area is extracted from the reference image instead of the first defect candidate area by the same process as the comparison process step S205.
  • a comparison image is acquired by a difference (for example, subtraction process). Specifically, a difference image indicating the difference between the two images by subtracting the pixel value in the region overlapping the reference image of the contracted image obtained by expanding and contracting the reference image from the value of each pixel of the reference image. Is acquired. And the comparison image which extracted the area
  • a difference image indicating the difference between the two images by subtracting the pixel value in the region overlapping the reference image of the contracted image obtained by expanding and contracting the reference image from the value of each pixel of the reference image.
  • the first mask area is obtained from the ratio between the value of each pixel of the reference image and the value of the corresponding pixel of the contracted image obtained by expanding and contracting the reference image.
  • the pixel value of the ratio image is obtained by dividing the value of each pixel of the contracted image obtained by expanding and contracting the reference image by the value of the corresponding pixel of the reference image.
  • a first reference value larger than 1 is prepared in advance, and an area composed of pixels having a value greater than or equal to the first reference value in the ratio image is extracted as a first mask area, and a comparison including the first mask area is performed. An image is acquired.
  • the predetermined threshold and the first reference value in the comparison processing step S205 and the predetermined threshold and the first reference value in the comparison processing step S215 may be the same or different. If they are the same, the processing can be shared, which contributes to reduction of processing memory and processing time.
  • the comparison image 811c and the comparison image 812c shown in FIG. 18 are acquired.
  • first defect candidate regions 711c and 722c are extracted as darker regions than the captured image 811.
  • 711c corresponds to the first defect (true defect)
  • 722c corresponds to the pattern portion (false defect).
  • the comparison image 812c the first mask region 722c is extracted as a darker region than the reference image 812. Note that 722c corresponds to a pattern portion (false defect).
  • the captured image data input step S201, the preprocessing step S202, the expansion processing step S203, the contraction processing step S204, and the comparison processing step S205 described above are the first defect candidate region detection step S1411 in this embodiment. Configure. Note that the preprocessing step S202 can be omitted depending on the state of the captured image and the inspection conditions.
  • the reference image data input step S211, the preprocessing step S212, the expansion processing step S213, the contraction processing step S214, and the comparison processing step S215 described above are the first mask region detection step in the present embodiment.
  • S1412 is configured. Note that the preprocessing step S212 may be omitted depending on the state of the reference image and the inspection conditions.
  • the comparison unit 546 executes a defect candidate exclusion step S1413 for performing defect candidate exclusion processing on the comparison image based on the captured image.
  • the comparison unit 546 first executes a fattening process for thickening the first mask region. Specifically, expansion processing is performed on the comparison image 812c as a fattening process using a maximum value filter in the same manner as in the expansion processing step S213.
  • the first mask region there may be a tolerance between the object shown in the reference image and the object shown in the captured image. Further, there may be a positional deviation between the posture of the object when the reference image is captured and the posture of the object when the captured image is captured. Therefore, as described later, only by excluding the region where the first mask region and the first defect candidate region overlap as it is, a region (that is, a pattern portion) that is not a defect among the first defect candidate regions is defined as the first mask region. A region that does not overlap well and is not defective will remain as a first defect candidate region as it is in the misaligned portion. Therefore, a thickening process is performed on the first mask region to reduce a non-overlapping portion between the first defect candidate region and the first mask region due to the positional deviation. Thereby, overdetection can be suppressed more.
  • a first defect candidate image is generated by excluding a partial region of the first defect candidate region in the comparison image of the captured image from the first defect candidate based on the first mask region.
  • a defect candidate exclusion process is executed. More specifically, among the first defect candidate regions of the comparison image based on the captured image generated by the comparison unit 546, those that overlap the first mask region of the comparison image based on the reference image more than a predetermined condition are used as the first defect. A first defect candidate image excluded from the candidates is generated.
  • a difference or sum between each pixel in the comparison image of the captured image and each pixel in the comparison image of the reference image is calculated.
  • a method of extracting the first defect candidate region in comparison with the threshold is used. Which extraction method of difference and sum is used is determined based on a parameter predetermined by the program 80 or a parameter designated by the user using the input unit 126.
  • the first defect candidate image When acquiring the first defect candidate image based on the difference, specifically, by subtracting the value of the pixel at the corresponding position of the comparison image of the reference image from the value of each pixel in the comparison image of the captured image, A difference image indicating the difference between the two images is acquired. Then, the first defect candidate image is acquired in a state where the area where the pixel value is larger than the predetermined threshold is left as the first defect candidate and the other area is set to “0”.
  • a sum image indicating the sum of both images is acquired. Then, by setting a region having a pixel value larger than a predetermined threshold in the sum image to a pixel value “0”, the first mask region and the first defect candidate region are excluded as overlapping regions, A first defect candidate image is acquired in a state where a first defect candidate area that does not overlap with one mask area remains.
  • each pixel having a pixel value equal to or greater than a predetermined threshold is “1”, and the pixel value is lower than the threshold.
  • the binarization processing by the binarization unit 547 can be omitted in the post-processing step S1414 described later.
  • the fattening process is performed in the defect candidate excluding process S1413.
  • the present invention is not limited to this, and the fattening process is omitted.
  • the defect candidate excluding process S1413 only the defect candidate excluding process is performed. May be executed.
  • the binarization unit 547 and the area filter unit 548 perform a post-processing step S1414 that performs post-processing on the first defect candidate image.
  • the first defect candidate image output from the comparison unit 546 is binarized by a binarization unit 547 with a predetermined threshold.
  • the first defect candidate area is represented by a multi-value, and the other areas are represented by “0”.
  • the binarization processing in the binarization unit 547 the first defect candidate area is set to “1”, and the other areas are set to “0”.
  • the binarized first defect candidate image is input to the area filter unit 548.
  • the area filter unit 548 deletes the first defect candidate area whose area is smaller than a predetermined value, and the image indicating the remaining first defect candidate area is the final first defect candidate image (more precisely, the first defect candidate image).
  • First defect candidate data 921 which is image data indicating one defect candidate area.
  • the first defect candidate image 821 shown in FIG. 18 is acquired.
  • the first defect candidate region 722c extracted from the comparison image 811c is excluded by taking a difference from the comparison image 812c.
  • the false information resulting from the pattern portion 722 that is not originally a defect can be suppressed.
  • some first defect candidate regions 722 c cannot be completely excluded by the first mask region.
  • the first defect candidate region 722d remains.
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the number of first defect candidate data 921 equal to the number of captured images is acquired.
  • the 3rd defect candidate acquisition part 551 performs 3rd defect candidate acquisition process S142.
  • the third defect candidate acquisition step S142 when the third defect candidate acquisition step S142 is started, first, one captured image selected in the first defect candidate acquisition step S141 and a reference image corresponding to the captured image are selected. Then, in the third defect candidate acquisition unit 551, the captured image data 911 of the captured image is input to the filter processing unit 552, and the reference image data 912 of the reference image is input to the filter processing unit 552.
  • the filter processing unit 542 and the pre-alignment unit 543 perform filter processing and pre-alignment processing on the captured image and the reference image. Since these processes are the same as the pre-processing steps S202 and S212 in the first defect candidate acquisition step S141, description thereof is omitted.
  • the sway comparison unit 554 performs sway comparison processing using the preprocessed captured image and the reference image, and the binarization unit 555 performs binarization processing on the sway comparison processed image. By doing so, a third defect candidate image is generated.
  • the sway comparator 554 obtains an evaluation value indicating the difference between the captured image and the reference image while moving the reference image little by little vertically and horizontally from the pre-aligned position.
  • the evaluation value for example, a sum of absolute values of differences (with a sign) of pixel values in a region where both images overlap is obtained.
  • an image indicating a signed difference between the pixel values of both images at the position where the evaluation value is minimized is generated.
  • the signed differential image is binarized with a predetermined value by the binarizing unit 555, and a third defect candidate image indicating the third defect candidate region is generated.
  • a signed differential image is not required to simplify the process.
  • the value of the pixel of the difference image is obtained by subtracting the value of the corresponding pixel of the captured image from the value of each pixel of the reference image and setting it to 0 when the value is negative.
  • a positive value is prepared in advance, and an area composed of pixels having a value greater than or equal to the positive value in the difference image is acquired as a third defect candidate area.
  • an area where the brightness of the captured image is lower than that of the reference image and the absolute value of the difference in brightness is equal to or greater than the second reference value is acquired as the third defect candidate area.
  • the second reference value is a positive value.
  • an area in the captured image whose brightness is lower than a predetermined value than the reference image is acquired as the third defect candidate area.
  • the pixel value may be regarded as lightness.
  • the image is a color image, a value obtained by performing a predetermined calculation on the pixel value for each color component is treated as lightness.
  • the third defect candidate area may be obtained from the ratio between the value of each pixel in the reference image and the value of the corresponding pixel in the captured image.
  • the pixel value of the ratio image is obtained by dividing the value of each pixel of the reference image by the value of the corresponding pixel of the captured image.
  • a second reference value greater than 1 is prepared in advance, and an area composed of pixels having a value equal to or greater than the second reference value in the ratio image is acquired as a third defect candidate area.
  • the pixel value of the ratio image may be obtained by dividing the value of each pixel of the captured image by the value of the corresponding pixel of the reference image. In this case, an area configured by pixels having a value equal to or smaller than the second reference value smaller than 1 in the ratio image is acquired as the third defect candidate area.
  • the second reference value may not be a constant.
  • the second reference value may be a function of the brightness or pixel value of the reference image and / or the captured image.
  • the second reference value may be determined using the difference or ratio between the brightness or pixel value of the reference image and the captured image, and other calculations may be used.
  • FIG. 19 is an image example showing the contents of the process in the third defect candidate acquisition step S142.
  • the input captured image 811 and reference image 812 are the same as the images illustrated in FIG.
  • the third defect candidate image generated as a result of execution of the shake comparison process by the fluctuation comparison unit 554 and the binarization process by the binarization unit 555 is exemplified as the third defect candidate image 823.
  • the third defect candidate image 823 dark regions of the captured image 811 compared to the reference image 812 are extracted as third defect candidate regions 711i and 721i by the sway comparison process.
  • the third defect candidate area 711 i is a true defect corresponding to the first defect 711 existing in the captured image 811, while the third defect candidate area 721 i does not exist in the captured image 811, but the reference image
  • This is a so-called fake defect that has been extracted as a darker area than the reference image 812 by the sway comparison process because it exists as a second defect 721 (that is, a defect that appears brighter than the surroundings) at 812.
  • a defective area is included in the reference image, a defective area that is not included in the captured image may be extracted as noise.
  • the area defect filter unit 556 deletes the third defect candidate area whose area is smaller than a predetermined value, An image indicating the third defect candidate area is acquired as a final third defect candidate image (more precisely, third defect candidate data 923 which is image data indicating the third defect candidate area).
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the number of third defect candidate data 923 equal to the number of captured images is acquired.
  • the defect candidate limiting step S143 is then executed, and the first defect candidate data 921 and the third defect candidate data 923 are used to generate the first defect Data 931 is acquired.
  • the first defect candidate data 921 and the third defect candidate data 923 are input to the AND operation unit 582.
  • the first defect candidate data 921 input to the AND operation unit 582 includes one captured image acquired by the predetermined first imaging unit 3 under a predetermined first illumination condition, and the imaging This is data generated from a reference image corresponding to an image.
  • the third defect candidate data 923 input to the same AND operation unit 582 includes the same captured image acquired by the first imaging unit 3 under the first illumination condition and a reference image corresponding to the captured image. Data generated from
  • a first defect candidate data 921 and a third defect candidate data 923 generated from another captured image and a reference image corresponding to the captured image are input to the AND operation unit 583 different from the AND operation unit 582.
  • the first defect candidate data 921 input to the logical product operation unit 583 is the same as that of the logical product operation unit 582, but the second illumination is different from that of the logical product operation unit 582.
  • the third defect candidate data 923 input to the same AND operation unit 583 is obtained from the captured image acquired by the first imaging unit 3 under the second illumination condition and the reference image corresponding to the captured image. It is the generated data.
  • each logical product image is an image generated from a captured image and a reference image acquired by the same imaging unit under different illumination conditions.
  • the first AND image obtained by the AND operation unit 582 is generated based on the image acquired by the first imaging unit 3 under the first illumination condition, and is obtained by the AND operation unit 583.
  • the two logical product image is generated based on the image acquired by the first imaging unit 3 under the second illumination condition.
  • Each logical product image is an image showing a first defect area generated from the first defect candidate area and the third defect candidate area.
  • FIG. 20 is a diagram illustrating a first defect image 831 showing a first defect area 731 generated from the first defect candidate areas 711d and 722d in FIG. 18 and the third defect candidate areas 711i and 721i in FIG. .
  • the first defect candidate areas 711d and 722d are the first mask areas in the comparison image 812c extracted from the first defect candidate areas 711c and 722c in the comparison image 811c extracted by so-called self-comparison of the captured image. Since it is obtained by masking with 722c, the possibility of detecting noise due to defects included in the reference image 812 is low. However, for the sake of processing time, there is a possibility of detecting a false defect (first defect candidate region 722d in FIG. 20) due to not performing accurate alignment.
  • the third defect candidate areas 711i and 721i are obtained from the difference image of these images after the alignment of the captured image 811 and the reference image 812, the reliability indicating the existence of the defect is high.
  • the third defect candidate area may detect a defect included in the reference image 812 as a false defect (third defect candidate area 721i in FIG. 20).
  • the present embodiment by obtaining a logical product image of the first defect candidate image 821 and the third defect candidate image 823, the first defect image 831 showing the first defect region 731 with improved reliability is obtained.
  • the area selection unit 584 when a plurality of first defect images 831 are overlapped, an area where a predetermined number or more of the first defect areas overlap is maintained as the first defect area, and an area less than the predetermined number is the first defect area.
  • the “overlapping region” may be a logical sum of pixel values in a plurality of overlapping regions, or may be a logical product of the pixel values. In the present embodiment, when the number of overlapping regions is 2 or more, the first defective region is maintained.
  • the region selection unit 584 acquires one first defect image indicating the limited first defect region from the plurality of first defect images 831 indicating the first defect region 731, and first defect data 931 corresponding thereto. Is output from the region selection unit 584. Thereby, a dark area with respect to the reference image is extracted as a first defect area from a plurality of captured images acquired in a plurality of illumination states while referring to the corresponding reference image.
  • the first defect data 931 output from the area selection unit 584 is output from the defect acquisition unit 52 to the storage unit 53 and stored in the storage unit 53.
  • the first defect acquisition step S14 for acquiring the presence of the first defect in the captured image is completed.
  • a second defect acquisition step S15 for acquiring the presence of the second defect in the captured image is executed.
  • a 2nd defect is a defect which appears brightly with respect to a reference image among captured images.
  • the difference between the second defect acquisition step S15 and the first defect acquisition step S14 is that an expansion process step and a contraction process are performed in order to detect a bright region in the captured image as compared with the reference image and other regions inside the captured image. Since the order of the steps is reversed and the order of subtraction and division is reversed, and other portions are common to the first defect acquisition step S14, description of common portions will be omitted as appropriate.
  • a second defect candidate acquisition step S151 is executed.
  • the second defect candidate acquisition step S151 first, one captured image is selected by the second defect acquisition unit 522, and a reference image corresponding to the captured image is selected.
  • captured image data 911 of the captured image is input to the filter processing unit 562 (captured image data input step S301), and the reference image data 912 of the reference image is filtered.
  • the data is input to the unit 562 (reference image data input step S311).
  • the preprocessing steps S302 and S312 are performed in the same manner as the preprocessing steps S201 and S211 (FIG. 16).
  • the contraction processing unit 564 executes contraction processing steps S303 and S313 for performing contraction processing on the pre-aligned captured image and reference image.
  • the captured image data 911 and the reference image data 912 are input from the pre-alignment unit 563 to the contraction processing unit 564, and contraction processing is performed on the captured image and the reference image.
  • the contraction process here is a process for contracting a bright area in a multi-valued image, and is also an expansion process for a dark area. As a result, the bright small area disappears.
  • a known minimum value filter is used, and a pixel having a low pixel value (that is, a dark pixel) is expanded to 3 pixels ⁇ 3 pixels.
  • FIG. 21 is an image example showing the contents of processing in the second defect candidate acquisition step S151, and the input captured image 811 and reference image 812 are the same images as FIG.
  • the contracted image 811e and contracted image 812e in FIG. 21 are generated by the contraction process.
  • the first defect 711e and the pattern portion 722e which are dark regions, are confirmed in an expanded state, while the small bright region disappears.
  • the kernel size of the minimum value filter is not limited to 3 pixels ⁇ 3 pixels, and various other sizes may be adopted.
  • the expansion processing unit 565 executes expansion processing steps S304 and S314 for performing expansion processing on the captured image and the reference image that have been subjected to the contraction processing.
  • the data of the captured image and the reference image that have been subjected to the contraction process are input to the expansion processing unit 565, and the captured image and the reference image are subjected to expansion processing.
  • the expansion process here is a process of expanding a bright region in the multi-valued image.
  • a maximum value filter having the same size as the minimum value filter used in the contraction process is used, and the expanded dark area is returned to the original size.
  • the expanded image 811f and the expanded image 812f shown in FIG. 21 are generated.
  • the first defect 711f and the pattern portion 722f which are dark areas, are confirmed in a state where they have almost returned to their original sizes.
  • the contraction process and the expansion process the large bright area in the original captured image and the reference image is substantially maintained in the original state, and the small bright area disappears. Note that in the image example of FIG. 21, all bright areas disappear by the contraction process.
  • the comparison unit 566 executes comparison processing steps S305 and S315 for performing comparison processing on the captured image and the reference image that have been subjected to expansion processing.
  • the data of the captured image and the reference image that have been subjected to the expansion process are input to the comparison unit 566, which first compares the captured image and the expanded image obtained by performing the contraction / expansion processing on the captured image.
  • a comparison image is generated based on at least one of the difference and the ratio (comparison processing step S305).
  • comparison processing step S315) At the same time, at least one of the difference and the ratio between the reference image and an expanded image obtained by contracting / expanding the reference image.
  • a comparison image is generated based on (Comparison processing step S315).
  • comparison processing steps S305 and S315 Since the processing in the comparison processing steps S305 and S315 is the same as that in the comparison processing steps S205 and S215 except that the reference values used as threshold values and the order of the numerator denominator when generating the comparison image based on the ratio are different. Description of the points to be performed will be omitted as appropriate.
  • a comparison image is acquired by a difference (for example, subtraction process). Specifically, a difference image indicating the difference between the two images is obtained by subtracting the pixel value in the region overlapping the captured image of the expanded image obtained by contracting / expanding the captured image from the value of each pixel of the captured image. Is acquired. And the comparison image which extracted the area
  • the captured image has higher brightness than the expanded image obtained by contracting / expanding the captured image, and the absolute value of the difference in brightness is greater than or equal to the third reference value.
  • the region is represented in the comparative image as the second defect candidate region.
  • the third reference value is a positive value.
  • an area whose brightness is a predetermined value or more higher than the expanded image obtained by contracting / expanding the captured image is represented as a second defect candidate area in the comparative image.
  • the pixel value may be regarded as lightness.
  • the image is a color image, a value obtained by performing a predetermined calculation on the pixel value for each color component is treated as lightness.
  • the second defect candidate region is obtained from the ratio between the value of each pixel of the captured image and the value of the corresponding pixel of the expanded image obtained by contracting / expanding the captured image.
  • the pixel value of the ratio image is obtained by dividing the value of the corresponding pixel of the captured image by the value of each pixel of the expanded image obtained by contracting / expanding the captured image.
  • a third reference value greater than 1 is prepared in advance, and an area composed of pixels having a value greater than or equal to the third reference value in the ratio image is extracted as a second defect candidate area.
  • a comparative image is acquired.
  • the value of the pixel of the ratio image may be obtained by dividing the value of the pixel of the expanded image obtained by contracting / expanding the captured image by the value of each corresponding pixel of the captured image.
  • an area composed of pixels having a value equal to or smaller than the third reference value smaller than 1 in the ratio image is extracted as the second defect candidate area, and a comparison image including the second defect candidate area is acquired.
  • the comparison processing step S315 generates a comparison image based on at least one of the difference and ratio between the reference image and the expanded image obtained by contracting / expanding the reference image. For the acquisition of the difference image or the ratio image, the same processing as the comparison processing step S305 for the captured image is performed. In the comparison processing step S315, a bright region of the reference image is extracted as the second mask region instead of the second defect candidate region by the same processing as the comparison processing step S305.
  • a comparison image is acquired by a difference (for example, subtraction process). Specifically, a difference image indicating a difference between both images by subtracting a pixel value in a region overlapping with the reference image of the expanded image obtained by contracting / expanding the reference image from the value of each pixel of the reference image. Is acquired. And the comparison image which extracted the area
  • the second mask area is obtained from the ratio between the value of each pixel of the reference image and the value of the corresponding pixel of the expanded image obtained by contracting / expanding the reference image. May be.
  • the comparison image 811g and the comparison image 812g shown in FIG. 21 are acquired.
  • second defect candidate regions 712g and 721g are extracted as brighter regions than the captured image 811.
  • second mask regions 712g and 721g are extracted as brighter regions than the reference image 812.
  • 721g corresponds to the second defect (true defect)
  • 712g corresponds to the pattern portion (false defect).
  • the captured image data input step S301, the preprocessing step S302, the contraction processing step S303, the expansion processing step S304, and the comparison processing step S305 described above are the second defect candidate region detection step S1511 in this embodiment. Configure. Note that the preprocessing step S302 can be omitted depending on the state of the captured image and the inspection conditions.
  • the reference image data input step S311, the preprocessing step S312, the contraction processing step S313, the expansion processing step S314, and the comparison processing step S315 described above are the second mask region detection step in the present embodiment.
  • S1512 is configured. Note that the preprocessing step S312 can be omitted depending on the state of the reference image and the inspection conditions.
  • the comparison unit 566 executes a defect candidate exclusion step S1513 for performing defect candidate exclusion processing on the comparison image based on the captured image.
  • a second defect candidate image is generated by excluding a partial region of the second defect candidate region in the comparison image of the captured image from the second defect candidate based on the second mask region. More specifically, similar to the defect candidate exclusion step S1413, the second mask area of the comparison image based on the reference image and the second mask area of the comparison image based on the captured image generated by the comparison unit 566 are predetermined. A second defect candidate image is generated by excluding those overlapping the condition from the second defect candidates.
  • the binarization unit 567 and the area filter unit 568 execute a post-processing step S1514 for performing post-processing on the second defect candidate image, and the final second defect candidate image (more precisely, the second defect candidate image) Second defect candidate data 922), which is image data indicating a defect candidate area, is acquired. Since the post-processing step S1514 is the same as the post-processing step S1414, the description thereof is omitted.
  • the second defect candidate image 822 shown in FIG. 21 is acquired.
  • the second defect candidate region 712g extracted from the comparison image 811g is excluded by taking a difference from the comparison image 812g, and only the second defect candidate region 721h remains. Thereby, it is possible to suppress overdetection caused by the pattern portion 712 that is not originally a defect.
  • the second defect candidate image 822 is prevented from being affected. Since the second defect candidate region 721h is extracted from the second defect candidate regions 712g and 721g of the comparison image 811g, noise is generated in the second defect candidate image 822 due to the second defect 721 generated only in the reference image 812. (Ie false defects) will not occur.
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the number of second defect candidate data 922 equal to the number of captured images is acquired.
  • the 4th defect candidate acquisition part 571 performs 4th defect candidate acquisition process S152.
  • the fourth defect candidate acquisition step S152 when the fourth defect candidate acquisition step S152 is started, first, one captured image selected in the second defect candidate acquisition step S151 and a reference image corresponding to the captured image are selected. The Then, in the fourth defect candidate acquisition unit 571, the captured image data 911 of the captured image is input to the filter processing unit 572, and the reference image data 912 of the reference image is input to the filter processing unit 572.
  • the filter processing unit 572 and the pre-alignment unit 573 perform filter processing and pre-alignment processing on the captured image and the reference image. Since these processes are the same as the pre-processing steps S302 and S312 in the second defect candidate acquisition step S151, description thereof is omitted.
  • the sway comparison unit 574 performs sway comparison processing using the preprocessed captured image and the reference image, and the binarization unit 575 performs binarization processing on the swayed comparison processed image.
  • a fourth defect candidate image is generated.
  • the sway comparator 574 obtains an evaluation value indicating the difference between the captured image and the reference image while moving the reference image little by little vertically and horizontally from the pre-aligned position.
  • the evaluation value for example, a sum of absolute values of differences (with a sign) of pixel values in a region where both images overlap is obtained.
  • an image indicating a signed difference between the pixel values of both images at the position where the evaluation value is minimized is generated.
  • the signed differential image is binarized with a predetermined value by the binarizing unit 575, and a fourth defect candidate image indicating the fourth defect candidate region is generated.
  • the pixel value of the difference image is obtained by subtracting the value of the corresponding pixel of the reference image from the value of each pixel of the captured image and setting it to 0 when the value is negative.
  • a positive value is prepared in advance, and an area composed of pixels having a value greater than or equal to the positive value in the difference image is acquired as the fourth defect candidate area.
  • an area where the brightness of the captured image is higher than that of the reference image and the absolute value of the difference in brightness is equal to or greater than the fourth reference value is acquired as the fourth defect candidate area.
  • the fourth reference value is a positive value.
  • an area having a brightness higher than the reference image by a predetermined value or more in the captured image is acquired as the fourth defect candidate area.
  • the pixel value may be regarded as lightness.
  • the image is a color image, a value obtained by performing a predetermined calculation on the pixel value for each color component is treated as lightness.
  • the fourth defect candidate area may be obtained from the ratio between the value of each pixel in the reference image and the value of the corresponding pixel in the captured image. Specifically, the value of each pixel of the captured image is divided by the value of the corresponding pixel of the reference image to obtain the value of the pixel of the ratio image. A fourth reference value larger than 1 is prepared in advance, and an area composed of pixels having a value equal to or greater than the fourth reference value in the ratio image is acquired as a fourth defect candidate area.
  • the pixel value of the ratio image may be obtained by dividing the value of each pixel of the reference image by the value of the corresponding pixel of the captured image. In this case, an area composed of pixels having a value equal to or smaller than the fourth reference value smaller than 1 in the ratio image is acquired as the fourth defect candidate area.
  • the fourth reference value may not be a constant.
  • the fourth reference value may be a function of brightness or pixel value of the reference image and / or the captured image.
  • the fourth reference value may be determined using the brightness or pixel value difference and ratio between the reference image and the captured image, and other calculations may be used.
  • FIG. 22 is an image example showing the contents of processing in the fourth defect candidate acquisition step S152.
  • the input captured image 811 and reference image 812 are the same as the images illustrated in FIG.
  • the fourth defect candidate image generated as a result of execution of the shake comparison process by the fluctuation comparison unit 574 and the binarization process by the binarization unit 575 is exemplified as the fourth defect candidate image 824.
  • an area brighter than the reference image 812 in the captured image 811 is extracted as the fourth defect candidate area 721j by the sway comparison process.
  • the area filter unit 576 deletes the fourth defect candidate area whose area is smaller than a predetermined value, and the remaining first An image indicating the four defect candidate areas is acquired as a final fourth defect candidate image (more precisely, fourth defect candidate data 924 that is image data indicating the fourth defect candidate area).
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the number of fourth defect candidate data 924 equal to the number of captured images is acquired.
  • the defect candidate limiting step S153 is then executed, and the second defect is determined based on the second defect candidate data 922 and the fourth defect candidate data 924. Data 932 is acquired.
  • the second defect candidate data 922 and the fourth defect candidate data 924 are input to the AND operation units 592 and 593.
  • the relationship between the input second defect candidate data 922 and fourth defect candidate data 924 and the AND operation units 592 and 593 (that is, the relationship between the imaging unit and the illumination condition) is the same as the relationship in the defect candidate limiting step S143. Therefore, the description is omitted.
  • the region selection unit 594 receives AND image data obtained from each combination of the second defect candidate data 922 and the fourth defect candidate data 924.
  • FIG. 23 is a diagram illustrating a second defect image 832 showing a second defect area 732 generated from the second defect candidate area 721h in FIG. 21 and the fourth defect candidate area 721j in FIG.
  • a second defect image 832 showing the second defect region 732 with improved reliability is obtained by obtaining a logical product image of the second defect candidate image 822 and the fourth defect candidate image 824. Can do.
  • the region selection unit 594 when a plurality of second defect images 832 are overlapped, a region where a predetermined number or more of second defect regions overlap is maintained as the second defect region, and a region less than the predetermined number is stored in the second defect region.
  • the “overlapping area” may be a logical sum of a plurality of overlapping areas, or may be a logical product.
  • the second defect region is maintained.
  • One second defect image indicating the limited second defect area is acquired from the plurality of second defect images 832 indicating the second defect area 732 by the area selection unit 594, and second defect data 932 corresponding to the second defect image 932 is acquired. Is output from the region selection unit 594. Thereby, a bright area with respect to the reference image is extracted as a second defect area from a plurality of captured images acquired in a plurality of illumination states while referring to the corresponding reference image.
  • the second defect data 932 output from the region selection unit 594 is output from the defect acquisition unit 52 to the storage unit 53 and stored in the storage unit 53.
  • the second defect acquisition step S15 for acquiring the presence of the second defect in the captured image is completed.
  • the position of the defect when the defect exists is detected in the target area 70 viewed from one imaging unit 3.
  • One captured image is displayed on the display unit of the computer 12, and the first defect area and the second defect area are displayed together on the target area 70 as areas having different colors.
  • it is not restricted to this, It displays so that either one of a 1st defect area
  • the minimum number of captured images acquired by one imaging unit 3 is 2, but is preferably 3 or more. That is, the light irradiation unit 4 can have three or more illumination states different from each other. For example, the object 9 can be irradiated with light from three or more directions.
  • the imaging unit 3 acquires an image during the illumination state. When the preferable lighting state is known, at least one of the three or more captured images acquired based on the information may be selected as the captured image to be processed. By preparing three or more captured images, more appropriate defect detection can be easily performed.
  • first defect candidate and the second defect candidate in the above description can be expressed as “defect candidates”, and the first defect candidate area and the second defect candidate area are expressed as “defect candidate areas”.
  • the first mask area and the second mask area can be expressed as “mask areas”, and the first defect candidate image and the second defect candidate image can be expressed as “defect candidate images”.
  • the first defect candidate acquisition unit 541 and the second defect candidate acquisition unit 561 corresponds to the “self-comparison defect candidate acquisition unit” in the present invention.
  • the third defect candidate acquisition unit 551 is the “other image comparison defect candidate acquisition unit” in the present invention.
  • the defect candidate limiting unit 581 corresponds to the “defect candidate limiting unit” in the present invention.
  • the fourth defect candidate acquisition unit 571 is the “other image comparison defect candidate acquisition unit” in the present invention.
  • the defect candidate limiting unit 591 corresponds to the “defect candidate limiting unit” in the present invention.
  • the imaging step S13 corresponds to the “imaging step” in the present invention
  • at least one of the first defect candidate acquisition step S141 and the second defect candidate acquisition step S151 is the “self-comparison defect candidate acquisition step” in the present invention. It corresponds to.
  • the third defect candidate acquisition step 142 is the “other image comparison defect candidate acquisition step” in the present invention.
  • the defect candidate limiting step S143 corresponds to the “defect candidate limiting step” in the present invention.
  • the fourth defect candidate acquisition step S152 is the “other image comparison defect candidate acquisition step” in the present invention.
  • the defect candidate limiting step S153 corresponds to the “defect candidate limiting step” in the present invention.
  • the third defect candidate acquisition step S142 and the defect candidate limiting step S143 in the first defect acquisition step S14 are omitted, and the first defect candidate region acquired in the first defect candidate acquisition step S141 is defined as the first defect. It may be acquired as a region. Even in this case, in the first defect candidate acquisition step S141, out of the first defect candidate areas, those that overlap the first mask area by a predetermined condition or more are excluded from the first defect candidates, and then based on the first defect candidate areas. Since the presence of a defect in the captured image is acquired, overdetection can be suppressed.
  • the fourth defect candidate acquisition step S152 and the defect candidate limitation step S153 in the second defect acquisition step S15 are omitted, and the second defect candidate region acquired in the second defect candidate acquisition step S151 is used as the second defect region. You may get it. Also in this case, in the second defect candidate acquisition step S151, the second defect candidate region that is overlapped with the second mask region by a predetermined condition or more is excluded from the second defect candidate, and then based on the second defect candidate region. Since the presence of a defect in the captured image is acquired, overdetection can be suppressed.
  • the defect detection apparatus 1 does not include the third defect candidate acquisition unit 551, the fourth defect candidate acquisition unit 571, and the defect candidate limitation units 581 and 591 in particular, and the first defect candidate acquisition unit 541 outputs the first
  • the defect candidate data 921 may be acquired as the first defect data 931, or the second defect candidate data 922 output by the second defect candidate acquisition unit 561 may be acquired as the second defect data 932.
  • the first mask region detection step S1412 and the defect candidate exclusion step S1413 in the first defect acquisition step S14 are omitted, and the first defect candidate region acquired in the first defect candidate region detection step S1411 is used.
  • an area overlapping with the third defect candidate area by a predetermined condition or more is maintained as the first defect candidate area, and the first defect candidate area is maintained. Since the presence of the defect in the captured image is acquired based on the defect candidate area, overdetection can be suppressed.
  • the second mask region detection step S1512 and the defect candidate exclusion step S1513 in the second defect acquisition step S15 are omitted, and the second defect candidate region acquired in the second defect candidate region detection step S1511 is used as the second defect region.
  • the second defect candidate data 922 may be acquired without limiting the second defect candidate area by the second mask area.
  • the second defect candidate acquisition step S151 among the second defect candidate areas, those that overlap with the fourth defect candidate area by a predetermined condition or more are maintained as the second defect candidate areas, and the second defect candidate areas Based on this, the presence of a defect in the captured image is acquired, so that overdetection can be suppressed.
  • FIG. 24 is a diagram illustrating another example of functions realized when the computer 12 executes arithmetic processing in accordance with the program 80.
  • the imaging control unit 51, the defect acquisition unit 52, and the storage unit 53 correspond to functions realized by the computer 12. All or part of these functions may be realized by a dedicated electric circuit. These functions may be realized by a plurality of computers.
  • the defect acquisition unit 52 includes a first dark defect candidate acquisition unit 621, a second dark defect candidate acquisition unit 622, a first bright defect candidate acquisition unit 623, and a second bright defect candidate acquisition unit 624.
  • the “dark defect” means a defect that appears dark in an image.
  • “Bright defect” means a defect that appears bright in an image.
  • FIG. 25 is a diagram illustrating a configuration of the first dark defect candidate acquisition unit 621.
  • the first dark defect candidate acquisition unit 621 includes two filter processing units 631, a pre-alignment unit 632, a shake comparison unit 633, a binarization unit 634, and an area filter unit 635.
  • the first dark defect candidate acquisition unit 621 acquires first dark defect candidate data 951 that is image data indicating the first dark defect candidate region.
  • the first dark defect candidate region is a dark region with respect to the reference image in the captured image.
  • FIG. 26 is a diagram illustrating a configuration of the second dark defect candidate acquisition unit 622.
  • the second dark defect candidate acquisition unit 622 includes an expansion processing unit 641, a contraction processing unit 642, a comparison unit 643, a binarization unit 644, and an area filter unit 645 following the pre-alignment unit 632.
  • the second dark defect candidate acquisition unit 622 acquires second dark defect candidate data 952 that is image data indicating the second dark defect candidate region.
  • the second dark defect candidate region is a dark region with respect to the reference image in the captured image. As will be described later, the method for acquiring the first dark defect candidate region is different from the method for acquiring the second dark defect candidate region.
  • FIG. 27 is a diagram showing a configuration of the second bright defect candidate acquisition unit 624.
  • the second bright defect candidate acquisition unit 624 includes a contraction processing unit 651, an expansion processing unit 652, a comparison unit 653, a binarization unit 654, and an area filter unit 655 following the pre-alignment unit 632.
  • the second bright defect candidate acquisition unit 624 acquires light / dark reverse region data 953 that is image data indicating a light / dark reverse region, which will be described later.
  • first dark defect candidate acquisition units 621, second dark defect candidate acquisition units 622, first bright defect candidate acquisition units 623, and second bright defect candidate acquisition units 624 are defect acquisition units 52. And processing is performed on a plurality of captured images in parallel.
  • FIG. 28 is a diagram illustrating a configuration in which the defect acquisition unit 52 acquires dark defect candidate data 954 that is image data indicating a dark defect candidate region from the first dark defect candidate data 951 and the second dark defect candidate data 952. is there.
  • This configuration includes a plurality of logical product operation units 661 and a region selection unit 662.
  • FIG. 29 is a diagram illustrating a configuration in which the defect acquisition unit 52 limits the dark defect candidate area indicated by the dark defect candidate data 954 using the light / dark reverse area data 953.
  • This configuration includes a logical sum operation unit 663 and a candidate limitation unit 664.
  • FIG. 30 is a diagram showing an operation flow of the defect detection apparatus 1. Steps S11 to S13 in FIG. 30 are the same as steps S11 to S13 in FIG.
  • the processing for the image data may be simply expressed as processing for the image. Further, only the processing focused on one imaging unit 3 will be described. Similar processing is performed for the other imaging units 3.
  • the defect detection apparatus 1 can detect the presence of a dark defect and the presence of a bright defect, but in the following description, the description will be made focusing on the dark defect.
  • the “dark defect candidate region” refers to a region that appears dark as a candidate indicating the presence of a defect in an image.
  • Steps S11 to S13 are executed, first, one captured image is selected, and a reference image corresponding to the captured image is selected. As shown in FIG. 25, in the first dark defect candidate acquisition unit 621, captured image data 911 of the captured image and reference image data 912 of the reference image are input to the filter processing unit 631, respectively.
  • filter processing for reducing noise such as a median filter and a Gaussian filter
  • the filtered captured image and reference image are output to the pre-alignment unit 632.
  • the pre-alignment unit 632 the relative position and angle shift amount of the reference image with respect to the captured image are specified by pattern matching using a predetermined pattern. Then, the approximate position and angle of the reference image are matched to the captured image by translating and rotating the reference image with respect to the captured image by the amount of positional and angular deviation between the two images. Thereby, pre-alignment with respect to both images is performed.
  • the sway comparison unit 633 obtains an evaluation value indicating the difference between the captured image and the reference image while moving the reference image little by little vertically and horizontally from the pre-aligned position.
  • the evaluation value for example, a sum of absolute values of differences (with a sign) of pixel values in a region where both images overlap is obtained.
  • the image which shows the signed difference of the value of the pixel of both the images in the position where evaluation value becomes the minimum is acquired.
  • the signed differential image is binarized with a predetermined value, and a first dark defect candidate image indicating the first dark defect candidate region is acquired.
  • the value of the pixel of the difference image is obtained by subtracting the value of the corresponding pixel of the captured image from the value of each pixel of the reference image and setting it to 0 when the value is negative.
  • a positive value is prepared in advance, and an area composed of pixels having a value greater than or equal to the positive value in the difference image is acquired as the first dark defect candidate area.
  • an area in which the brightness of the first captured image is lower than that of the first reference image and the absolute value of the brightness difference is equal to or greater than the first reference value is acquired as the first dark defect candidate area.
  • the first reference value is a positive value.
  • an area in the captured image whose brightness is lower than the reference image by a predetermined value or more is acquired as the first dark defect candidate area.
  • the pixel value may be regarded as lightness.
  • the image is a color image, a value obtained by performing a predetermined calculation on the pixel value for each color component is treated as lightness.
  • the first dark defect candidate area may be obtained from the ratio between the value of each pixel of the reference image and the value of the corresponding pixel of the captured image.
  • the pixel value of the ratio image is obtained by dividing the value of each pixel of the reference image by the value of the corresponding pixel of the captured image.
  • a first reference value greater than 1 is prepared in advance, and an area composed of pixels having a value equal to or greater than the first reference value in the ratio image is acquired as a first dark defect candidate area.
  • the pixel value of the ratio image may be obtained by dividing the value of each pixel of the captured image by the value of the corresponding pixel of the reference image. In this case, an area composed of pixels having a value equal to or smaller than the first reference value smaller than 1 in the ratio image is acquired as the first dark defect candidate area.
  • the first reference value may not be a constant.
  • the first reference value may be a function of the brightness or pixel value of the reference image and / or the captured image.
  • the first reference value may be determined using the brightness or pixel value difference and ratio between the reference image and the captured image, and other calculations may be used.
  • the first to third reference values do not have to be the same value, and the calculation method may be different.
  • an area where the brightness is lower than the brightness of the reference image and lower than a value satisfying a predetermined condition is acquired as the first dark defect candidate area.
  • the “predetermined condition” may be set individually for each captured image.
  • a plurality of “predetermined conditions” may be used for one captured image.
  • the first reference value may be set at a position where the pixel value is likely to change for each imaging, such as an edge in the captured image, so that it is not easily detected as a defect candidate area.
  • the above description also applies to the following second dark defect candidate region, first bright defect candidate region, and second bright defect candidate region.
  • FIG. 31A is a diagram illustrating a captured image 811.
  • FIG. 31B is a diagram illustrating a reference image 812.
  • an area appearing in the captured image on the surface of the object 9 is referred to as a “target area 70”.
  • the imaging unit 3 and the target area 70 correspond one-to-one, and each imaging unit 3 always acquires an image of the same target area 70.
  • the target area 70 is abstractly shown by an ellipse.
  • a first dark defect candidate image 851 showing the first dark defect candidate region 751 shown in FIG. 31C is acquired.
  • the pixel value is “1” in the first dark defect candidate region 751 and the pixel value is “0” in the other regions.
  • the area filter unit 635 deletes the first dark defect candidate region 751 whose area is smaller than a predetermined value, and removes the remaining first dark defect candidate region 751.
  • the image shown is acquired as the final first dark defect candidate image 851 (more precisely, the first dark defect candidate data 951 which is image data indicating the first dark defect candidate region 751).
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the number of first dark defect candidate images 851 equal to the number of captured images is acquired (step S54).
  • the captured image data 911 and the reference image data 912 are input from the pre-alignment unit 632 to the expansion processing unit 641, and expansion processing is performed on the captured image and the reference image. Is called.
  • the expansion process here is a process of expanding a bright region in the multi-valued image. As a result, the small dark area disappears.
  • the captured image data and the reference image data are further input to the contraction processing unit 642, and the captured image and the reference image are contracted.
  • the contraction process here is a process for contracting a bright region in a multi-valued image. As a result, the bright area is restored to its original size. As a result, in the original captured image and the reference image, the large dark area is almost maintained in the original state, and the small dark area disappears.
  • FIG. 32A is a diagram exemplifying an image 813 after the expansion and contraction processing is performed on the captured image 811 of FIG. 31A.
  • FIG. 32B is a diagram illustrating an image 814 after the expansion and contraction processing is performed on the reference image 812 in FIG. 31B.
  • the comparison unit 643 generates difference image data of these images.
  • the difference image is binarized by the binarization unit 644 using the second reference value.
  • the process of generating and binarizing the difference image is the same as the sway comparison unit 633 and the binarization unit 634 in FIG. 25 except that the sway is not performed.
  • the point which may use a ratio image instead of a difference image is also the same.
  • an area in the target area 70 where the captured image 811 is darker than the reference image 812 and satisfies a predetermined condition is acquired as the second dark defect candidate area 752.
  • the pixel value is “1” in the second dark defect candidate region 752, and the pixel value is “0” in the other regions.
  • the area filter unit 645 deletes the second dark defect candidate region 752 whose area is smaller than a predetermined value and removes the remaining second dark defect candidate region 752.
  • An image to be shown is acquired as a final second dark defect candidate image 852 (more precisely, second dark defect candidate data 952 that is image data indicating the second dark defect candidate region 752).
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the number of second dark defect candidate images 852 equal to the number of captured images is acquired (step S55).
  • the first dark defect candidate data 951 and the second dark defect candidate data 952 generated from the same captured image and the corresponding reference image are input to the AND operation unit 661.
  • the region selection unit 662 receives AND image data obtained from each combination of the first dark defect candidate image 851 and the second dark defect candidate image 852.
  • Each logical product image is an image showing a dark defect candidate area generated from the first dark defect candidate area and the second dark defect candidate area.
  • FIG. 33 is a diagram illustrating a dark defect candidate image 854 showing a dark defect candidate area 754 generated from the first dark defect candidate area 751 in FIG. 31C and the second dark defect candidate area 752 in FIG. 32C.
  • the first dark defect candidate region Since the first dark defect candidate region is obtained from the difference image between these images after alignment of the captured image and the reference image, the first dark defect candidate region has high reliability indicating the presence of the defect. However, there is a possibility that the small first dark defect candidate region is generated for some reason such as noise.
  • the second dark defect candidate region 752 is obtained from these difference images after performing a minute region removal process for deleting a small dark region on the captured image and the reference image, it is possible to detect a small false defect. The nature is low. However, due to processing time, there is a risk of detecting a false defect due to not performing accurate alignment. Therefore, in the present embodiment, a dark defect candidate image indicating a dark defect candidate region with improved reliability is obtained by obtaining a logical product image of the first dark defect candidate image and the second dark defect candidate image. .
  • the region selection unit 662 when a plurality of dark defect candidate images are overlapped, a region where a predetermined number or more of dark defect candidate regions overlap is maintained as a dark defect candidate region.
  • the “overlapping area” may be a logical sum of a plurality of overlapping areas, or may be a logical product. In the present embodiment, when the number of overlapping regions is 2 or more, the dark defect candidate regions are maintained.
  • the region selection unit 662 acquires one dark defect candidate image indicating a limited dark defect candidate region from a plurality of dark defect candidate images indicating the dark defect candidate region (step S56). Through the above processing, a dark region with respect to a reference image is acquired as a dark defect candidate region from a plurality of captured images acquired in a plurality of illumination states with reference to the corresponding reference image.
  • the region selection unit 662 Since the dark defect candidate region is limited by the region selection unit 662, in practice, a logical sum operation unit can be used instead of the logical product operation unit 661. In any case, the reliability of the dark defect candidate region can be improved by acquiring the dark defect candidate region based on the first dark defect candidate region and the second dark defect candidate region.
  • the number of overlapping regions when maintained as dark defect candidate regions may be three or more, or one or more. When the number of overlapping regions is set to 1 or more, all dark defect candidate regions are maintained, and the region selection unit 662 simply generates a logical sum image of a plurality of dark defect candidate images as one dark defect candidate image. To do.
  • the data of the light / dark reverse region image indicating the light / dark reverse region is obtained by the process of changing the light and dark with respect to the case of the second dark defect candidate acquisition unit 622. To get.
  • the captured image data 911 and the reference image data 912 are input from the pre-alignment unit 632 to the contraction processing unit 651, and the captured image and the reference image are contracted.
  • the contraction process here is a process for contracting a bright area in a multi-valued image, and is also an expansion process for a dark area. Thereby, a small bright area disappears.
  • the captured image data and the reference image data are further input to the expansion processing unit 652, and the captured image and the reference image are subjected to expansion processing.
  • the expansion process here is a process of expanding a bright area in a multi-valued image, and is also a process of contracting a dark area. As a result, the dark area is restored to its original size. As a result, in the original captured image and the reference image, the large bright area is almost maintained in the original state, and the small bright area disappears.
  • the comparison unit 653 generates difference image data of these images.
  • the difference image is binarized by the binarization unit 654 with the third reference value.
  • a ratio image may be used instead of a difference image.
  • the pixel value is “1” in the bright and dark areas, and the pixel value is “0” in the other areas.
  • the area filter unit 655 deletes the light / dark reverse region whose area is smaller than a predetermined value, and the image showing the remaining light / dark reverse region is the final light / dark reverse region image (accurate). Is acquired as light / dark reverse area data 953), which is image data indicating a light / dark reverse area.
  • the plurality of captured images acquired by the imaging unit 3 are sequentially selected as processing targets, and the same number of light and dark reverse region images as the number of captured images are acquired (step S57).
  • a bright area with respect to the reference image is acquired as a light / dark inverse area from each of the plurality of captured images acquired in a plurality of illumination states with reference to the corresponding reference image.
  • FIG. 34A and FIG. 34B are diagrams illustrating a light / dark reverse region image 853 showing a light / dark reverse region 753.
  • FIG. 34C shows a logical sum image 855 of these images.
  • the actual number of bright and dark reverse region images is equal to or smaller than the number of captured images acquired by one imaging unit 3, and preferably equal to or greater than two.
  • FIG. 35 is a diagram showing the dark defect candidate image 854 in FIG. 33 and the logical sum image 855 in FIG. 34C in an overlapping manner.
  • the right dark defect candidate region 754 is maintained as a defect candidate because it overlaps with the bright and dark reverse region 753.
  • the left dark defect candidate region 754 is excluded from the defect candidates because it does not overlap with any of the dark and dark reverse regions 753 (step S58).
  • the dark defect candidate image 854 may be sequentially overlapped with the respective light / dark reverse region images 853 without obtaining the logical sum image, and the presence / absence of overlap between the dark defect candidate region 754 and the light / dark reverse region 753 may be confirmed.
  • the dark defect candidate region 754 Only the overlap of the dark defect candidate region 754 and the light / dark reverse region 753 over a predetermined area may be detected as the presence of the overlap. In this case, a dark defect candidate region 754 whose overlap with the light / dark inverse region 753 is less than a predetermined area is excluded from the defect candidates. In addition, when the overlap between the dark defect candidate region 754 and the light / dark reverse region 753 is less than a predetermined ratio with respect to the area of the dark defect candidate region 754, the dark defect candidate region 754 is excluded from the defect candidates. Also good. In this way, of the dark defect candidate regions, those that do not overlap with any of the light and dark reverse regions for a predetermined condition or more are excluded from the defect candidates. In other words, among the dark defect candidate regions, those overlapping with any one of the bright and dark reverse regions for a predetermined condition or more are maintained as dark defect candidates.
  • a final dark defect area is acquired based on the dark defect candidate area by a process such as deleting a dark defect candidate area having a predetermined area or less as necessary. That is, the presence of a dark defect is acquired (step S59). With the above processing, the position of the defect when the defect exists is detected in the target region 70 viewed from one imaging unit 3.
  • One captured image is displayed on the display unit of the computer 12, and a dark defect area is displayed on the target area 70.
  • the defect When there is a concave or convex defect on the surface of the object 9, the defect appears bright or dark in the captured image when irradiated with polarized light.
  • surface contamination due to unnecessary oil, paint, or the like is also detected as a defect. Therefore, by using the light / dark reverse region image, the dark region caused by the color of the surface is removed as noise, and overdetection of defects is suppressed.
  • the appearance of light and dark due to the presence of defects is complicated, by using a plurality of light and dark reverse region images, it is possible to remove from the defect candidates those caused by the surface color with high accuracy.
  • the minimum number of captured images acquired by one imaging unit 3 is 2, but is preferably 3 or more. That is, the light irradiation unit 4 can have three or more illumination states different from each other. For example, the object 9 can be irradiated with light from three or more directions.
  • the imaging unit 3 acquires an image during the illumination state. When the preferable lighting state is known, at least one of the three or more captured images acquired based on the information may be selected as the captured image to be processed. By preparing three or more captured images, more appropriate defect detection can be easily performed.
  • the defect detection apparatus 1 also has a function of detecting a bright defect.
  • the detection of the dark defect is the same as steps S54 to S59 except that the light and dark are reversed.
  • the configuration of the first bright defect candidate acquisition unit 623 is the same as that of the first dark defect candidate acquisition unit 621 in FIG. 25 except that the calculation order and the reference value are different. That is, the first bright defect candidate acquisition unit 623 obtains a difference image after aligning the captured image and the reference image, and binarizes the difference image. Thereby, the 1st bright defect candidate image which shows a 1st bright defect candidate area
  • the second bright defect candidate acquisition unit 624 performs a contraction and expansion process on the captured image and the reference image to acquire a difference image, and binarizes the difference image. Thereby, a second bright defect candidate image indicating the second bright defect candidate area is acquired.
  • a bright defect candidate image indicating a bright defect candidate area is generated from a plurality of sets of first bright defect candidate images and second bright defect candidate images.
  • the second dark defect candidate acquisition unit 622 functions as a light / dark reverse region acquisition unit, and acquires the second dark defect candidate image as a light / dark reverse region image. Then, a logical sum image of a plurality of light and dark reverse area images is generated.
  • the bright defect candidate areas those that do not overlap with any of the light and dark reverse areas for a predetermined condition or more are excluded from the defect candidates, and the bright defect candidate areas are limited. Thereafter, a bright defect image indicating the presence or absence of a bright defect is generated using the bright defect candidate image.
  • the dark defect area and the bright defect area are displayed on the display as areas having different colors on one captured image, for example.
  • the second bright defect candidate used for detecting the bright defect It is preferable to use the region as a light-dark reverse region.
  • the second dark defect candidate area used for dark defect detection it is preferable to use the second dark defect candidate area used for dark defect detection as the bright and dark reverse area. That is, it is preferable that the step of acquiring the dark / dark reverse region when acquiring one of the dark defect candidate region and the bright defect candidate region is included in the step of acquiring the other of the dark defect candidate region and the bright defect candidate region.
  • the calculation time it may be possible to use a more preferable one as the light / dark inverse region.
  • the reference value which is a threshold for binarization when obtaining the dark defect candidate region or the bright defect candidate region, is set to an optimum value that suppresses overdetection and also suppresses detection omission.
  • the bright and dark areas are used to suppress detection of false defects caused by surface color such as dirt, noise, and the like. For this reason, by setting the reference value, which is a binarization threshold when obtaining a light / dark reverse area, to a value that makes a light / dark reverse area even if it is doubtful to be a light / dark reverse area, true defects are excluded as dirt or the like. It is suppressed.
  • the reference value (third reference value in the above description) used by the second bright defect candidate acquisition unit 624 when acquiring the dark defect candidate area is used as the second bright defect candidate when acquiring the bright defect candidate area.
  • the reference value used in the acquisition unit 624 it is possible to obtain a dark defect candidate region with higher accuracy.
  • the reference value used by the second dark defect candidate acquisition unit 622 is used as the reference value used by the second dark defect candidate acquisition unit 622 when acquiring the dark defect candidate region.
  • a more preferable bright defect candidate region can be obtained.
  • the binarization reference value when acquiring the bright / dark inverse region may be different from the binarization reference value when acquiring the second dark defect candidate region or the second bright defect candidate region,
  • the binarization reference value for acquiring the bright / dark inverse region is looser than the binarization reference value for acquiring the second dark defect candidate region or the second bright defect candidate region.
  • the area of the bright / dark reverse region is larger than the area of the second dark defect candidate region or the second bright defect candidate region.
  • the defect candidate in the defect detection apparatus 1 is one or both of the dark defect candidate and the bright defect candidate.
  • dark defect candidates and bright defect candidates in the above description can be expressed as “defect candidates”, dark defect candidate regions and bright defect candidate regions can be expressed as “defect candidate regions”,
  • the defect candidate image and the bright defect candidate image can be expressed as “defect candidate images”.
  • the first dark defect candidate area and the first bright defect candidate area can be expressed as “first defect candidate area”, and the second dark defect candidate area and the second bright defect candidate area are “second defect candidate area”. Can be expressed.
  • the defect acquisition unit 52 acquires one of a dark region and a bright region as a defect candidate region with respect to the reference image while referring to the corresponding reference image from the captured image used for defect detection. .
  • the defect acquisition unit 52 acquires, from the captured image used for defect detection, the other of the dark area and the bright area with respect to the reference image as another defect candidate area while referring to the corresponding reference image.
  • the light / dark reversal area corresponding to the defect candidate area is acquired when the other defect candidate area is acquired.
  • the brightness inversion area corresponding to the defect candidate area is acquired by using a reference value different from the reference value in acquiring the other defect candidate areas. Is done.
  • the method for acquiring the first defect candidate region in the above embodiment is expressed as the first method and the method for acquiring the second defect candidate region is expressed as the second method
  • the first method and the second method If these methods are different from each other, various methods can be used as these methods. Thereby, overdetection or detection omission can be suppressed efficiently.
  • the defect candidate area may be obtained by only one method.
  • the second defect candidate area is not obtained in the above-described embodiment, and the area selection unit 662 determines a defect candidate area that overlaps a predetermined number or more of the first defect candidate areas of the plurality of first defect candidate images. It may be acquired.
  • the first defect candidate region is not obtained in the above-described embodiment, and the region selection unit 662 determines a defect candidate region that overlaps a predetermined number or more of the second defect candidate regions of the plurality of second defect candidate images. It may be acquired.
  • only one captured image may be used for defect detection.
  • the number of captured images used when acquiring the bright and dark reverse region images is preferably 2 or more.
  • it is preferable that at least one captured image used for defect detection is included in a plurality of captured images acquired in a plurality of illumination states in order to acquire a light / dark inverse region.
  • the processing order described in the above embodiment is merely an example.
  • the step of acquiring the first dark defect candidate region, the step of acquiring the second dark defect candidate region, and the step of acquiring the bright and dark reverse region may be performed in any order or in parallel.
  • the process for detecting the dark defect and the process for detecting the bright defect may be performed in any order or in parallel.
  • the defect candidate area may be treated as a defective area as it is.
  • the reference image may be generated from the captured image. That is, the defect candidate area may be acquired by so-called self-comparison. For example, a reference image in which a dark defect disappears is acquired by performing a process of expanding a bright region on a captured image and then performing a process of contracting. A reference image in which a bright defect disappears is acquired by performing a process of contracting a bright region on the captured image and then performing a process of expanding.
  • the above-described defect detection apparatus 1 can be variously modified.
  • the arrangement and number of the light source units 4a, 4b, 4c and the imaging unit 3 may be changed as appropriate.
  • the illumination state by the light irradiation unit 4 may be variously changed. Two of the plurality of light source units may be turned on, or three of them may be turned on. In the light irradiation unit 4, the light state may be changed by moving the light source unit.
  • the computer 12 may be dedicated hardware, or partially dedicated hardware may be used. When visual inspection is performed at high speed, it is preferable that parallel processing is performed by a computer or dedicated hardware.
  • processing order can be changed as appropriate.
  • the processing order described in the above embodiment is merely an example.
  • the defect detection apparatus 1 may be used to detect defects on the surface of other objects such as various substrates and films on which patterns are formed.
  • the defect detection apparatus 1 is particularly suitable for inspection of an object that is likely to be overdetected by having a textured area (not limited to a metal surface) on the surface.

Abstract

光の照射状態を変更しつつ複数の撮像画像(811)が取得される(ステップS11~S13)。各撮像画像と、対応する参照画像(812)とが比較され、参照画像に対して暗い領域が暗欠陥候補領域(754)として取得される(ステップS54~S56)。複数の撮像画像のそれぞれから、参照画像に対して明るい領域が明暗逆領域(753)として取得される(ステップS57)。暗欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で(ステップS58)、欠陥候補領域に基づいて欠陥の存在が取得される(ステップS59)。これにより、外観検査において、表面の汚れ等に起因する欠陥の過検出が抑制される。

Description

欠陥検出装置、欠陥検出方法およびプログラム
 本発明は、対象物の表面の欠陥を検出する技術に関する。
 従来、自動車の駆動部に用いられる金属部品は、鍛造または鋳造により製造される。金属部品の製造後には、得られた金属部品に傷等の欠陥が無いかどうかを調べる、いわゆる外観検査が行われる。このような金属部品の外観検査は、従来、作業者の目視により行われていた。しかしながら、作業者の目視に依存すると、複数の作業者間で、検査にかかる時間や検査結果にばらつきが生じる。また、同一の作業者であっても、体調不良や集中力の低下により、検査に時間がかかったり、欠陥の見落としが発生したりするおそれがある。このため、金属部品の外観検査を、自動かつ高速に行うことができる装置の開発が求められている。
 ここで、従来より、対象物に光を照射して撮像し、撮像画像に基づいて対象物の外観を検査する装置が利用されている。特に、撮像画像について、膨張収縮処理を施す前後の画像で差分処理を行って、欠陥候補を抽出する技術(いわゆる自己比較技術)が公知である。
 例えば、特開2015-137921号公報の電子部品の外観を検査する外観検査装置では、撮像画像を二値化処理したあと、膨張処理と収縮処理を行ってサイズの小さな欠陥を消失させた収縮画像を生成し、これと撮像画像との差分をとることでサイズの小さな欠陥を抽出している。また、特開2015-137921号公報では、撮像画像と基準画像との差分処理により、サイズの大きな欠陥の抽出も併せて行い、差分画像のうち1つでもNG(欠陥)であると判定すれば、撮像画像は欠陥であるとする判定結果を出力することが記載されている(段落0061-0074、図5、図6参照)。
 上記のような自己比較による検査は、検査の基準となる画像(以下、「参照画像」という)の準備を要さず、撮像画像のみから、撮像画像に存在する各種の欠陥を抽出することができる。しかしながら、撮像画像に含まれる対象物の表面のうち、欠陥ではない細いラインや細かい凹凸も欠陥として検出するため、過検出の抑制が必要とされる。
 また、撮像画像について、検査の基準となる画像(以下、「参照画像」という)を準備し、撮像画像と参照画像とを比較することで、撮像画像に含まれる欠陥候補を抽出する技術も公知である。
 例えば、パターン欠陥検出技術に関し、オブジェクトパターン区域に対し、位置的に対応すべきマスターパターンの区域を中心として、その区域に所要画素数拡げた拡張区域にわたって2次元的に1画素ずつ所定量だけ位置ずれした複数のマスターパターンを設定し、これらのマスターパターン区域の2値化信号と、オブジェクトパターンの2値化信号とを、各マスターパターン区域ごとにそれぞれ比較して欠陥検出を行う、いわゆる「ゆすらせ比較」技術が、特開昭62-140009号公報に開示されている。
 参照画像として対象物中に欠陥を含む画像が選ばれると、撮像画像に写る対象物に欠陥がなくても当該欠陥の部分で撮像画像と参照画像との相違が生じるため、欠陥のない撮像画像を「欠陥あり」として検出する、いわゆる過検出の原因となる。したがって、従来の技術では、上記のような撮像画像と参照画像とを比較する検査は、参照画像として欠陥のない画像が準備されることが前提条件となっている。
 したがって、欠陥検出を行う前処理として、参照画像を得るために、欠陥のない、いわゆる良品の対象物を選出する選出工程が必要になり、結局は一部の欠陥検出をオペレータの目視で行う必要が生じ、作業時間の短縮の妨げとなっていた。
 また、このような検査装置では、凹部または凸部である欠陥を検出する際に、汚れ等による表面の色が欠陥として検出されることを防止する必要がある。
 例えば、特開平2-156144号公報のシート状物の欠陥検査装置では、シート状物に斜め方向から光を照射し、暗い影領域と明るい輝点領域との位置関係から、凹部、凸部、汚れ部が分類される。特開2002-116153号公報の外観検査装置では、被検査面の照度を変化させ、きずと油とでは照度変化による画像中の濃度変化が異なることを利用して、きずを正確に検出する。特開2005-37203号公報の棒状物体の検査装置では、棒状の物体に赤色の光と青色の光とを反対方向から照射し、カラー画像を赤色画像と青色画像とに分解し、各画像の明暗領域の位置関係から凸欠陥と汚れとを検出する。
 ところが、対象物の表面の凹凸により、画像中には暗領域や明領域が複雑に現れ、先行技術のように凹凸の欠陥と汚れとを精度よく分離できない場合がある。
 本発明は、自己比較により抽出された欠陥候補から実際には欠陥に相当しないもの(偽欠陥)を高い精度にて除くことにより、欠陥の過検出を抑制することを目的としている。
 本発明は、対象物の表面の欠陥を検出する欠陥検出装置に向けられている。本発明の一の好ましい形態に係る欠陥検出装置は、対象物を撮像して撮像画像を取得する撮像部と、前記撮像画像に対応する参照画像を記憶する記憶部と、前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、欠陥候補領域を検出し、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、マスク領域を検出し、前記欠陥候補領域のうち、前記マスク領域と重なる領域を、欠陥候補から除外したうえで、前記欠陥候補領域に基づいて前記撮像画像における欠陥の存在を取得する欠陥取得部とを備える。
 本発明によれば、撮像画像の自己比較により検出された欠陥候補のうち、参照画像の自己比較結果と重なるものを、欠陥候補から除外することができ、その結果、撮像画像に含まれる欠陥ではないものの周囲よりも明るい部分または暗い部分を欠陥候補から除去して過検出を抑制することができる。
 好ましくは、欠陥取得部は、前記撮像画像における第1欠陥および当該第1欠陥とは異なる第2欠陥の存在を取得し、前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理を施した後に収縮処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第1欠陥候補領域を検出し、前記参照画像の各画素の値と、前記参照画像に対し、膨張処理を施した後に収縮処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第1マスク領域を検出し、前記第1欠陥候補領域のうち、前記第1マスク領域と重なる領域を、第1欠陥候補から除外したうえで、前記第1欠陥候補領域に基づいて前記撮像画像における第1欠陥の存在を取得する第1欠陥取得部と、前記撮像画像の各画素の値と、前記撮像画像に対し、収縮処理を施した後に膨張処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第2欠陥候補領域を検出し、前記参照画像の各画素の値と、前記参照画像に対し、収縮処理を施した後に膨張処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第2マスク領域を検出し、前記第2欠陥候補領域のうち、前記第2マスク領域と重なる領域を、第2欠陥候補から除外したうえで、前記第2欠陥候補領域に基づいて前記撮像画像における第2欠陥の存在を取得する第2欠陥取得部とを有する。
 欠陥取得部は、膨張処理および収縮処理の順序を換えることで、第1欠陥および当該第1欠陥とは異なる第2欠陥、すなわち異なる種類の欠陥を取得することができる。これにより、撮像画像に含まれる欠陥の検出漏れをより確実に防止することができる。
 好ましくは、前記第1欠陥取得部は、前記撮像画像と前記参照画像との位置合わせを行った後に、これらの画像の差分画像に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を第3欠陥候補領域として取得し、前記第1欠陥候補領域のうち、前記第3欠陥候補領域と重ならない領域を、第1欠陥候補から除外したうえで、前記第1欠陥候補領域に基づいて前記撮像画像における第1欠陥の存在を取得し、前記第2欠陥取得部は、前記撮像画像と前記参照画像との位置合わせを行った後に、これらの画像の差分画像に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を第4欠陥候補領域として取得し、前記第2欠陥候補領域のうち、前記第4欠陥候補領域と重ならない領域を、第2欠陥候補から除外したうえで、前記第2欠陥候補領域に基づいて前記撮像画像における第2欠陥の存在を取得する。
 いわゆる自己比較により検出された欠陥候補のうち、撮像画像と参照画像との差分画像により検出された欠陥候補(いわゆる他者比較により検出された欠陥候補)と重ならない領域を、欠陥候補から除外することで、より確実に過検出を抑制することができる。
 本発明は、対象物の表面の欠陥を検出する欠陥検出方法にも向けられている。本発明の一の好ましい形態に係る欠陥検出方法は、a)撮像部にて対象物を撮像して撮像画像を取得する撮像工程と、b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、欠陥候補領域を検出する欠陥候補領域検出工程と、c)前記撮像画像に対応する参照画像が準備されており、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、マスク領域を検出するマスク領域検出工程と、d)前記欠陥候補領域のうち、前記マスク領域と重なる領域を、欠陥候補から除外したうえで、前記欠陥候補領域に基づいて前記撮像画像における欠陥の存在を取得する欠陥候補除外工程とを備える。
 本発明によれば、撮像画像の自己比較により検出された欠陥候補のうち、参照画像の自己比較結果と重なる領域を、欠陥候補から除外することができ、その結果、撮像画像に含まれる欠陥ではないものの周囲よりも明るい部分または暗い部分を欠陥候補から除去して過検出を抑制することができる。
 本発明は、コンピュータに、対象物の表面の対象領域の複数の画像から前記対象領域における欠陥を検出させるプログラムにも向けられている。本発明の一の好ましい形態に係るプログラムの前記コンピュータによる実行は、前記コンピュータに、a)前記対象領域を撮像して取得される撮像画像および対応する参照画像を準備する工程と、b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、欠陥候補領域を検出する欠陥候補領域検出工程と、c)前記撮像画像に対応する参照画像が準備されており、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、マスク領域を検出するマスク領域検出工程と、d)前記欠陥候補領域のうち、前記マスク領域と重なる領域を、欠陥候補から除外したうえで、前記欠陥候補領域に基づいて前記撮像画像における欠陥の存在を取得する欠陥候補除外工程とを実行させる。
 前記プログラムをコンピュータにインストールすることによって、撮像画像の自己比較により検出された欠陥候補のうち、参照画像の自己比較結果と重なる領域を、欠陥候補から除外する欠陥検出装置を得ることができ、その結果、撮像画像に含まれる欠陥ではないものの周囲よりも明るい部分または暗い部分を欠陥候補から除去して過検出を抑制することができる。
 本発明は、参照画像として欠陥を含む画像が使用された場合であっても、欠陥の過検出を抑制することを他の一の目的としている。
 本発明の他の好ましい一の形態に係る欠陥検出装置は、対象物を撮像して撮像画像を取得する撮像部と、前記撮像画像に対応する参照画像を記憶する記憶部と、前記撮像画像における欠陥の存在を取得する欠陥取得部とを備え、前記欠陥取得部は、前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較欠陥候補領域を取得する自己比較欠陥候補取得部と、前記撮像画像と前記参照画像との位置合わせを行った後に、前記一方処理が膨張処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を他画像比較欠陥候補領域として取得し、前記一方処理が収縮処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を前記他画像比較欠陥候補領域として取得する他画像比較欠陥候補取得部と、前記自己比較欠陥候補取得部から出力される前記自己比較欠陥候補領域と、前記他画像比較欠陥候補取得部から出力される前記他画像比較欠陥候補領域とが重なる領域を、欠陥候補領域として取得する、欠陥候補限定部とを有する。
 本発明によれば、撮像画像の自己比較(撮像画像自身と、撮像画像に膨張収縮処理または収縮膨張処理を施した画像との比較)に基づいて検出された自己比較欠陥候補と、撮像画像と参照画像との他画像比較に基づいて検出された他画像比較欠陥候補とが、重なる領域を、欠陥候補領域として取得する結果、自己比較欠陥候補および他画像比較欠陥候補の少なくとも一方に含まれるノイズを除去することができ、過検出を抑制することができる。
 好ましくは、前記自己比較欠陥候補取得部は、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較マスク領域をさらに検出し、前記自己比較欠陥候補領域のうち、前記自己比較マスク領域と重なる領域を、前記自己比較欠陥候補領域から除外したうえで、前記自己比較欠陥候補領域を前記欠陥候補限定部に出力する。
 自己比較欠陥候補取得部が、撮像画像のいわゆる自己比較により検出された自己比較欠陥候補に含まれる欠陥ではない領域を、参照画像の自己比較結果である自己比較マスク領域に基づいて除外することで、過検出をより確実に抑制することができる。
 本発明は、対象物の表面の欠陥を検出する欠陥検出方法にも向けられている。本発明の一の好ましい形態に係る欠陥検出方法は、a)撮像部にて対象物を撮像して撮像画像を取得する撮像工程と、b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較欠陥候補領域を取得する自己比較欠陥候補取得工程と、c)前記撮像画像に対応する参照画像が準備されており、前記撮像画像と前記参照画像との位置合わせを行った後に、前記一方処理が膨張処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を他画像比較欠陥候補領域として取得し、前記一方処理が収縮処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を前記他画像比較欠陥候補領域として取得する他画像比較欠陥候補取得工程と、d)前記自己比較欠陥候補取得工程により取得される前記自己比較欠陥候補領域と、前記他画像比較欠陥候補取得工程により取得される前記他画像比較欠陥候補領域とが重なる領域を、欠陥候補領域として取得する、欠陥候補限定工程とを備える。
 本発明によれば、撮像画像の自己比較に基づいて検出された自己比較欠陥候補と、撮像画像と参照画像との他画像比較に基づいて検出された他画像比較欠陥候補とが、重なる領域を、欠陥候補領域として取得する結果、自己比較欠陥候補および他画像比較欠陥候補の少なくとも一方に含まれるノイズを除去することができ、過検出を抑制することができる。
 本発明は、コンピュータに、対象物の表面の対象領域の複数の画像から前記対象領域における欠陥を検出させるプログラムにも向けられている。本発明の一の好ましい形態に係るプログラムの前記コンピュータによる実行は、前記コンピュータに、a)前記対象領域を撮像して取得される撮像画像および対応する参照画像を準備する工程と、b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較欠陥候補領域を取得する自己比較欠陥候補取得工程と、c)前記撮像画像と前記参照画像との位置合わせを行った後に、前記一方処理が膨張処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を他画像比較欠陥候補領域として取得し、前記一方処理が収縮処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を前記他画像比較欠陥候補領域として取得する他画像比較欠陥候補取得工程と、d)前記自己比較欠陥候補取得工程により取得される前記自己比較欠陥候補領域と、前記他画像比較欠陥候補取得工程により取得される前記他画像比較欠陥候補領域とが重なる領域を、欠陥候補領域として取得する、欠陥候補限定工程とを実行させる。
 前記プログラムをコンピュータにインストールすることによって、撮像画像の自己比較に基づいて検出された自己比較欠陥候補と、撮像画像と参照画像との他画像比較に基づいて検出された他画像比較欠陥候補とが、重なる領域を、欠陥候補領域として取得する欠陥検出装置を得ることができ、その結果、自己比較欠陥候補および他画像比較欠陥候補の少なくとも一方に含まれるノイズを除去することができ、過検出を抑制することができる。
 本発明は、欠陥候補から対象物の表面の色に起因するものを高い精度にて除くことにより、欠陥の過検出を抑制することをさらに他の一つの目的としている。
 本発明のさらに他の好ましい一の形態に係る欠陥検出装置は、互いに異なる複数の偏った照明状態にて、対象物に光を照射することができる光照射部と、前記対象物の表面の対象領域の画像を撮像画像として取得する撮像部と、前記光照射部による照明状態と、前記撮像部による画像の取得とを制御する撮像制御部と、欠陥検出に利用される少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得し、複数の照明状態にて取得された複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を明暗逆領域として取得し、前記欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で、前記欠陥候補領域に基づいて欠陥の存在を取得する欠陥取得部とを備える。
 本発明によれば、欠陥の過検出を抑制することができる。
 好ましくは、欠陥検出に利用される前記少なくとも1つの撮像画像は、前記複数の照明状態にて取得された前記複数の撮像画像に含まれる。
 好ましくは、前記欠陥取得部は、欠陥検出に利用される前記少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を他の欠陥候補領域として取得し、前記欠陥候補領域に対応する前記明暗逆転領域が、前記他の欠陥候補領域を取得する際に取得される。
 好ましくは、前記欠陥取得部は、欠陥検出に利用される前記少なくとも1つの撮像画像から、第1の手法にて第1欠陥候補領域を取得し、前記第1の手法とは異なる第2の手法にて第2欠陥候補領域を取得し、前記第1欠陥候補領域および前記第2欠陥候補領域に基づいて前記欠陥候補領域を取得する。
 さらに好ましくは、前記第1の手法は、撮像画像と参照画像との位置合わせを行った後に、これらの画像の差分画像から前記第1欠陥候補領域を取得する手法であり、前記第2の手法は、撮像画像および参照画像に対して微小領域除去処理を行った後にこれらの画像の差分画像から前記第2欠陥候補領域を取得する手法である。
 本発明は、対象物の表面の欠陥を検出する欠陥検出方法にも向けられている。本発明の一の好ましい形態に係る欠陥検出方法は、a)互いに異なる複数の偏った照明状態のそれぞれにて対象物に光が照射されている間に、撮像部により前記対象物の表面の対象領域の画像を取得することにより、複数の撮像画像を取得する工程と、b)欠陥検出に利用される少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得する工程と、c)複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を明暗逆領域として取得する工程と、d)前記欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で、前記欠陥候補領域に基づいて欠陥の存在を取得する工程とを備える。
 好ましくは、欠陥検出に利用される前記少なくとも1つの撮像画像は、前記複数の照明状態にて取得された前記複数の撮像画像に含まれる。
 好ましくは、前記欠陥検出方法は、e)欠陥検出に利用される前記少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を他の欠陥候補領域として取得する工程をさらに備え、前記c)工程が、前記e)工程に含まれる。
 本発明は、コンピュータに、対象物の表面の対象領域の複数の画像から前記対象領域における欠陥を検出させるプログラムにも向けられている。本発明の一の好ましい形態に係るプログラムの前記コンピュータによる実行は、前記コンピュータに、a)互いに異なる複数の偏った照明状態において取得された前記対象領域の複数の撮像画像および対応する複数の参照画像を準備する工程と、b)欠陥検出に利用される少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得する工程と、c)複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を明暗逆領域として取得する工程と、d)前記欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で、前記欠陥候補領域に基づいて欠陥の存在を取得する工程とを実行させる。
 上述の目的および他の目的、特徴、態様および利点は、添付した図面を参照して以下に行うこの発明の詳細な説明により明らかにされる。
欠陥検出装置の構成を示す図である。 欠陥検出装置の本体を示す平面図である。 コンピュータの構成を示す図である。 コンピュータが実現する機能構成を示すブロック図である。 第1欠陥取得部の構成を示す図である。 第1欠陥候補取得部の構成を示す図である。 第3欠陥候補取得部の構成を示す図である。 図5における欠陥候補限定部の構成を示す図である。 第2欠陥取得部の構成を示す図である。 第2欠陥候補取得部の構成を示す図である。 第4欠陥候補取得部の構成を示す図である。 図9における欠陥候補限定部の構成を示す図である。 欠陥検出装置の動作の流れを示す図である。 図13における第1欠陥取得工程の流れを示す図である。 図13における第2欠陥取得工程の流れを示す図である。 図14における第1欠陥候補取得工程の流れを示す図である。 図15における第2欠陥候補取得工程の流れを示す図である。 図16の処理内容を説明するための画像例である。 図14の第3欠陥候補取得工程の処理内容を説明するための画像例である。 図14の欠陥候補限定工程の処理内容を説明するための画像例である。 図17の処理内容を説明するための画像例である。 図15の第4欠陥候補取得工程の処理内容を説明するための画像例である。 図15の欠陥候補限定工程の処理内容を説明するための画像例である。 コンピュータが実現する機能構成を示すブロック図である。 第1暗欠陥候補取得部の構成を示す図である。 第2暗欠陥候補取得部の構成を示す図である。 第2明欠陥候補取得部の構成を示す図である。 暗欠陥候補データを取得する構成を示す図である。 暗欠陥候補データを限定する構成を示す図である。 欠陥検出装置の動作の流れを示す図である。 撮像画像を例示する図である。 参照画像を例示する図である。 第1暗欠陥候補画像を示す図である。 膨張および収縮処理を行った後の撮像画像を示す図である。 膨張および収縮処理を行った後の参照画像を示す図である。 第2暗欠陥候補画像を示す図である。 暗欠陥候補画像を示す図である。 明暗逆領域画像を例示する図である。 他の明暗逆領域画像を例示する図である。 論理和画像を示す図である。 暗欠陥候補画像と論理和画像とを重ねて示す図である。
 図1は、本発明の一の実施の形態に係る欠陥検出装置1の構成を示す図である。図2は、欠陥検出装置1の本体11を示す平面図である。欠陥検出装置1は、鏡面でない表面を有する立体的な対象物9の外観を検査する装置であり、対象物9の表面の欠陥を検出する。
 対象物9は、例えば、鍛造や鋳造により形成された金属部品である。対象物9の表面は微小な凹凸を有する梨地状、すなわち、艶消し状態である。換言すれば、対象物9の表面は、光を乱反射しつつ、光沢を有する。対象物9の表面の光沢度は、好ましくは、約20~約60である。光沢度とは、正反射光の割合や、拡散反射光の方向分布等に注目して、物体表面の光沢の程度を一次元的に表す指標である。光沢度は、JIS等の工業規格の光沢度測定方法に準拠した光沢計を利用して測定される。
 対象物9の表面は、サンドブラストや、スチールショットブラスト等、所定の投射材を用いたショットブラストにより処理され、上下面と側面との境界部やエッジにおける角部や成形時のバリが除去された形状(いわゆる、R形状)となっている。対象物9は、例えば、自在継手に用いられる各種部品であり、例えば車両、航空機または発電機の駆動部分に用いられる金属部品である。
 対象物9の表面における欠陥とは、理想的な形状に対して凹状または凸状となっている部位である。欠陥は、例えば、打痕、傷、加工不良等である。欠陥は、表面に付着している異物であってもよい。
 図1に示すように、欠陥検出装置1は、本体11と、コンピュータ12とを備える。本体11は、保持部2と、複数の撮像部3(図1では、符号3a,3b,3cを付すが、これらを区別しない場合は符合3を付す。)と、光照射部4とを備える。対象物9は保持部2に保持される。本体11には、外部の光が保持部2上に到達することを防止する図示省略の遮光カバーが設けられ、保持部2、撮像部3および光照射部4は、遮光カバー内に設けられる。
 対象物9の全表面を自動で検査する場合は、もう1つの本体11が設けられる。そして、2つの本体11の間に対象物9の上下を反転して対象物9を搬送する機構が設けられる。
 図1および図2に示すように、複数の撮像部3には、1個の上方撮像部3aと、8個の斜方撮像部3bと、8個の側方撮像部3cとが含まれる。上方撮像部3aは、保持部2の上方に配置される。上方撮像部3aにより保持部2上の対象物9を真上から撮像した画像が取得可能である。
 図2に示すように、上側から下方を向いて本体11を見た場合に(すなわち、本体11を平面視した場合に)、8個の斜方撮像部3bは保持部2の周囲に配置される。8個の斜方撮像部3bは、保持部2の中心を通り、上下方向を向く中心軸J1を中心とする周方向に45°の角度間隔(角度ピッチ)にて配列される。図1に示すように、各斜方撮像部3bの光軸K2と中心軸J1とを含む面において、光軸K2と中心軸J1とがなす角度θ2は、およそ45°である。各斜方撮像部3bにより保持部2上の対象物9を斜め上から撮像した画像が取得可能である。対象物9を斜め上から撮像するのであれば、角度θ2は45°には限定されず、好ましくは、15~75°の範囲で任意に設定されてよい。
 本体11を平面視した場合に、8個の側方撮像部3cも、8個の斜方撮像部3bと同様に保持部2の周囲に配置される。8個の側方撮像部3cは、周方向に45°の角度間隔にて配列される。各側方撮像部3cの光軸K3と中心軸J1とを含む面において、光軸K3と中心軸J1とがなす角度θ3は、およそ90°である。各側方撮像部3cにより保持部2上の対象物9を横から撮像した画像が取得可能である。
 上方撮像部3a、斜方撮像部3bおよび側方撮像部3cは、例えば、CCD(Charge Coupled Device)やCMOS(Complementary Metal-Oxide Semiconductor)等の2次元イメージセンサを有し、多階調の画像が取得される。上方撮像部3a、斜方撮像部3bおよび側方撮像部3cは、図示省略の支持部により支持される。
 光照射部4は、1個の上方光源部4aと、8個の斜方光源部4bと、8個の側方光源部4cとを含む。上方光源部4aは上方撮像部3aに隣接する。上方光源部4aでは、複数のLED(発光ダイオード)が中心軸J1に垂直に、すなわち、水平に配列される。上方光源部4aにより保持部2上の対象物9に対してほぼ真上から光が照射される。
 本体11を平面視した場合に、8個の斜方光源部4bは保持部2の周囲に配置される。斜方光源部4bはそれぞれ斜方撮像部3bに隣接する。8個の斜方光源部4bは、周方向に45°の角度間隔にて配列される。各斜方光源部4bでは、複数のLEDが光軸K2にほぼ垂直に配列される。各斜方光源部4bでは、保持部2上の対象物9に対して斜め上から光が照射可能である。
 本体11を平面視した場合に、8個の側方光源部4cは保持部2の周囲に配置される。側方光源部4cはそれぞれ側方撮像部3cに隣接する。8個の側方光源部4cは、周方向に45°の角度間隔にて配列される。各側方光源部4cでは、複数のLEDが光軸K3にほぼ垂直に、かつ、水平方向に配列される。そのため、平面視では8個の側方光源部4cは略八角形をなす。各側方光源部4cでは、保持部2上の対象物9に対して横から光が照射可能である。上方光源部4a、斜方光源部4bおよび側方光源部4cでは、LED以外の種類の光源が用いられてよい。本実施の形態では光の色は白であるが、光の色や波長帯は様々に変更されてよい。光照射部4により、対象物9に様々な方向から拡散光を照射することができる。以下、特定の少なくとも1つの光源部から光が照射されて対象物9が偏った光で照明される各状態を「照明状態」と呼ぶ。光照射部4は、互いに異なる複数の偏った照明状態にて、対象物9に光を照射することができる。
 図3はコンピュータ12の構成を示す図である。コンピュータ12は各種演算処理を行うCPU121、基本プログラムを記憶するROM122および各種情報を記憶するRAM123を含む一般的なコンピュータシステムの構成となっている。コンピュータ12は、情報記憶を行う固定ディスク124、画像等の各種情報の表示を行うディスプレイ125、操作者からの入力を受け付けるキーボード126aおよびマウス126b(以下、「入力部126」と総称する。)、光ディスク、磁気ディスク、光磁気ディスク等のコンピュータ読み取り可能な記録媒体8から情報の読み取りを行う読取装置127、並びに、欠陥検出装置1の他の構成との間で信号を送受信する通信部128をさらに含む。
 コンピュータ12では、事前に読取装置127を介して記録媒体8からプログラム80が読み出されて固定ディスク124に記憶されている。CPU121は、プログラム80に従ってRAM123や固定ディスク124を利用しつつ演算処理を実行する。CPU121は、コンピュータ12において演算部として機能する。CPU121以外に演算部として機能する他の構成が採用されてもよい。
 図4は、コンピュータ12がプログラム80に従って演算処理を実行することにより実現される機能を示す図である。図4において、撮像制御部51と、欠陥取得部52と、記憶部53とが、コンピュータ12が実現する機能に相当する。これらの機能の全部または一部は専用の電気回路により実現されてもよい。また、複数のコンピュータによりこれらの機能が実現されてもよい。
 撮像制御部51は、撮像部3と、光照射部4とを制御し、対象物9の画像(正確には、画像を示すデータ)を取得する。画像データは記憶部53に保存される。図4では、撮像部3を1つのブロックにて示しているが、実際には、上方撮像部3a、斜方撮像部3bおよび側方撮像部3cが撮像制御部51に接続される。
 後述するように、撮像制御部51が光照射部4の各光源部を制御して照明状態を変化させる毎に、17台の撮像部3の少なくとも1つにて画像のデータが取得される。以下、撮像により取得される画像を「撮像画像」と呼び、そのデータを「撮像画像データ」と呼ぶ。撮像画像データ911は、記憶部53に保存される。記憶部53には、各照明状態での理想的な対象物9の画像のデータが、参照画像データ912として保存されている。すなわち、各撮像部3の各照明状態に対応する理想的な画像データが、参照画像データ912として記憶部53に準備されている。
 光照射部4による光の照明状態とは、特定の照射方向から対象物9に光が照射される状態を指す。照射方向は厳密に定められるものではなく、およその光の照射方向を意味する。照射方向は、光がその方向からのみ照射される場合の平行光であることを限定するものでもない。光がある方向から照射されることは、その方向から偏って照射されることを意味する。また、1回の撮影における光の照射方向の数は1つには限定されない。例えば、互いに離れた複数の光源部から同時に光が照射されてもよい。
 欠陥取得部52は、第1欠陥取得部521と、第2欠陥取得部522とを含む。なお、「第1欠陥」は、本実施形態においては画像中に暗く現れる欠陥、すなわち「暗欠陥」を意味する。「第2欠陥」は、本実施形態においては画像中に明るく現れる欠陥、すなわち「明欠陥」を意味する。
 以下、第1欠陥取得部521の各種構成について、図5から図8を参照しつつ、説明する。
 図5は、第1欠陥取得部521の構成を示す図である。第1欠陥取得部521は、第1欠陥候補取得部541と、第3欠陥候補取得部551と、欠陥候補限定部581とを含む。入力される撮像画像データ911および参照画像データ912に基づいて、第1欠陥取得部521が処理を行うことで、第1欠陥領域を示す画像データである第1欠陥データ931が取得される。第1欠陥領域は、撮像画像において参照画像に対して暗い領域のうち、後述する各種処理によってノイズ(撮像画像において、本来は第1欠陥ではない領域であって、後述する第1欠陥候補領域として検出した領域)を除去した領域である。
 図6は、第1欠陥候補取得部541の構成を示す図である。第1欠陥候補取得部541は、2つのフィルタ処理部542と、プリアライメント部543と、膨張処理部544と、収縮処理部545と、比較部546と、2値化部547と、面積フィルタ部548とを含む。入力される撮像画像データ911および参照画像データ912に基づいて、第1欠陥候補取得部541が処理を行うことで、第1欠陥候補領域を示す画像データである第1欠陥候補データ921が取得される。第1欠陥候補領域は、撮像画像において参照画像に対して暗い領域である。
 図7は、第3欠陥候補取得部551の構成を示す図である。第3欠陥候補取得部551は、2つのフィルタ処理部552と、プリアライメント部553と、ゆすらせ比較部554と、2値化部555と、面積フィルタ部556とを含む。入力される撮像画像データ911および参照画像データ912に基づいて、第3欠陥候補取得部551が処理を行うことで、第3欠陥候補領域を示す画像データである第3欠陥候補データ923が取得される。第3欠陥候補領域は、撮像画像において参照画像に対して暗い領域である。後述するように、第3欠陥候補領域を取得する手法は、第1欠陥候補領域を取得する手法とは異なる。
 図8は、欠陥候補限定部581の構成を示す図である。欠陥候補限定部581は、2個以上の論理積演算部582,583と、領域選択部584とを含む。入力される第1欠陥候補データ921および第3欠陥候補データ923に基づいて、欠陥候補限定部581が処理を行うことで、第1欠陥データ931が取得される。
 次に、第2欠陥取得部522の各種構成について、図9から図12を参照しつつ、説明する。
 図9は、第2欠陥取得部522の構成を示す図である。第2欠陥取得部522は、第2欠陥候補取得部561と、第4欠陥候補取得部571と、欠陥候補限定部591とを含む。入力される撮像画像データ911および参照画像データ912に基づいて、第2欠陥取得部522が処理を行うことで、第2欠陥領域を示す画像データである第2欠陥データ932が取得される。第2欠陥領域は、撮像画像において参照画像に対して明るい領域のうち、後述する各種処理によってノイズ(撮像画像において、本来は第2欠陥ではない領域であって、後述する第2欠陥候補領域として検出した領域)を除去した領域である。
 図10は、第2欠陥候補取得部561の構成を示す図である。第2欠陥候補取得部561は、2つのフィルタ処理部562と、プリアライメント部563と、収縮処理部564と、膨張処理部565と、比較部566と、2値化部567と、面積フィルタ部568とを含む。入力される撮像画像データ911および参照画像データ912に基づいて、第2欠陥候補取得部561が処理を行うことで、第2欠陥候補領域を示す画像データである第2欠陥候補データ922が取得される。第2欠陥候補領域は、撮像画像において参照画像に対して明るい領域である。
 図11は、第4欠陥候補取得部571の構成を示す図である。第4欠陥候補取得部571は、2つのフィルタ処理部572と、プリアライメント部573と、ゆすらせ比較部574と、2値化部575と、面積フィルタ部576とを含む。入力される撮像画像データ911および参照画像データ912に基づいて、第4欠陥候補取得部571が処理を行うことで、第4欠陥候補領域を示す画像データである第4欠陥候補データ924が取得される。第4欠陥候補領域は、撮像画像において参照画像に対して明るい領域である。後述するように、第4欠陥候補領域を取得する手法は、第2欠陥候補領域を取得する手法とは異なる。
 図12は、欠陥候補限定部591の構成を示す図である。欠陥候補限定部591は、2個以上の論理積演算部592,593と、領域選択部594とを含む。入力される第2欠陥候補データ922および第4欠陥候補データ924に基づいて、欠陥候補限定部591が処理を行うことで、第2欠陥データ932が取得される。
 ここで、高速に処理を行う場合は、多数の第1欠陥候補取得部541および第3欠陥候補取得部551が第1欠陥取得部521に設けられ、また、多数の第2欠陥候補取得部561および第4欠陥候補取得部571が第2欠陥取得部522に設けられ、複数の撮像画像に対して処理が並行して行われる。
 図13は、欠陥検出装置1の動作の流れを示す図である。まず、保持部2上に検査対象となる対象物9が保持される。保持部2には、例えば、位置合わせ用の当接部が設けられており、対象物9の予め定められた部位と当接部とが接することにより、所定位置に対象物9が所定の向きにて配置される。保持部2は、位置決めピンを設けたステージであってもよい。
 次に、撮像制御部51が、点灯する光源部を変更することにより照明状態を変更しながら、選択された撮像部3にて撮像が行われる(ステップS11~S13)。すなわち、撮像制御部51が光照射部4に対し点灯命令を出し、選択された光照射部4が点灯する光照射工程(ステップS11)と、光照射部4の点灯中に、撮像制御部51により選択された撮像部3にて対象物9の撮像を行い、撮像画像を取得する撮像工程(ステップS12)と、撮像工程後に、撮像制御部51が、次の撮像を行うか否かを判断する撮像継続判断工程(ステップS13)とを実行する。
 具体的には、1つの側方撮像部3cが選択され、当該側方撮像部3cを中央として水平方向に連続する5個の側方光源部4cの1つが順に選択されて点灯し、点灯毎に側方撮像部3cが画像を取得する。上記動作が側方撮像部3cを変更しつつ繰り返される。実際には、各照明状態で複数の側方撮像部3cにて撮像を行うことにより、動作時間の短縮が図られる。さらに、全ての側方光源部4cを点灯して全ての側方撮像部3cにて撮像が行われる。これにより、各側方撮像部3cにて6枚の画像が取得される。
 斜方撮像部3bの場合は、1つの斜方撮像部3bが選択され、8個の斜方光源部4bの1つが順に選択されて点灯し、点灯毎に斜方撮像部3bが画像を取得する。上記動作が斜方撮像部3bを変更しつつ繰り返される。実際には、各照明状態で全ての斜方撮像部3bにて撮像を行うことにより、動作時間の短縮が図られる。さらに、全ての斜方光源部4bを点灯して全ての斜方撮像部3bにて撮像が行われる。上方光源部4aのみが点灯した状態でも全ての斜方撮像部3bにて撮像が行われる。これにより、各斜方撮像部3bにて10枚の画像が取得される。
 上方撮像部3aの場合は、斜方撮像部3bと同様に照明状態が変更されて10枚の画像が取得される。実際の動作では、斜方撮像部3bの撮像時に上方撮像部3aにて撮像を行うことにより、動作時間の短縮が図られる。
 撮像された画像のデータは、撮像画像データ911として記憶部53に記憶される。記憶部53には、既述のように、各撮像画像に対応する参照画像のデータが参照画像データ912として準備されている。参照画像は、撮像画像と同様の照明状態下での欠陥検査の基準として抽出された対象物9(いわゆる、良品)を示す。参照画像データ912は、欠陥の存在しない対象物9を撮像することにより取得されてもよく、多数の対象物9の画像の平均画像のデータとして取得されてもよい。
 撮像制御部51が予定する全ての撮像工程が終了すると、次に、欠陥取得部52が、第1欠陥取得工程(ステップS14)および第2欠陥取得工程(ステップS15)を実行する。第1欠陥取得工程S14は、撮像画像に含まれる第1欠陥を取得する工程である。第2欠陥取得工程S15は、撮像画像に含まれる第2欠陥を取得する工程である。第1欠陥取得工程S14および第2欠陥取得工程S15は、本実施形態においては、欠陥取得部52において並行して実行されるが、本発明の実施に関してはこれに限られず、第1欠陥取得工程S14が第2欠陥取得工程S15よりも先に実行されても良いし、その逆順であっても良い。
 以下、表現を簡素化するために、画像データに対する処理を、単に画像に対する処理として表現する場合がある。また、1つの撮像部3に注目した処理のみを説明する。他の撮像部3に対しても同様の処理が行われる。欠陥検出装置1では、第1欠陥(暗欠陥)の存在と第2欠陥(明欠陥)の存在とを検出することができるが、以下の説明では、第1欠陥に注目して説明し、第2欠陥の検出処理において第1欠陥の検出処理と共通する点については説明を適宜省略する。
 図14は、第1欠陥取得工程S14の詳細を示す図である。第1欠陥取得工程S14は、第1欠陥候補取得工程S141と、第3欠陥候補取得工程S142と、欠陥候補限定工程S143とを含む。
 図15は、第2欠陥取得工程S15の詳細を示す図である。第2欠陥取得工程S15は、第2欠陥候補取得工程S151と、第4欠陥候補取得工程S152と、欠陥候補限定工程S153とを含む。
 図16は、第1欠陥候補取得工程S141の詳細を示す図である。第1欠陥候補取得工程S141は、第1欠陥候補領域を検出する第1欠陥候補領域検出工程S1411と、第1マスク領域を検出する第1マスク領域検出工程S1412と、第1欠陥候補領域のうち、第1マスク領域と所定条件以上重なるものを第1欠陥候補から除外する欠陥候補除外工程S1413と、後処理工程S1414とを含む。
 図17は、第2欠陥候補取得工程S151の詳細を示す図である。第2欠陥候補取得工程S151は、第2欠陥候補領域を検出する第2欠陥候補領域検出工程S1511と、第2マスク領域を検出する第2マスク領域検出工程S1512と、第2欠陥候補領域のうち、第2マスク領域と所定条件以上重なるものを第2欠陥候補から除外する欠陥候補除外工程S1513と、後処理工程S1514とを含む。
 以下、図5から図20までを適宜参照しつつ、第1欠陥取得工程S14について説明する。
 第1欠陥取得工程S14が開始すると、まず、第1欠陥候補取得工程S141が実行される。第1欠陥候補取得工程S141では、まず、第1欠陥取得部521により1つの撮像画像が選択され、当該撮像画像に対応する参照画像が選択される。図6に示すように、第1欠陥候補取得部541では、撮像画像の撮像画像データ911がフィルタ処理部542に入力され(撮像画像データ入力工程S201)、参照画像の参照画像データ912がフィルタ処理部542に入力される(参照画像データ入力工程S211)。
 図16を参照する。次に、フィルタ処理部542およびプリアライメント部543が、撮像画像および参照画像に対してフィルタ処理およびプリアライメント処理を行う前処理工程S202、S212を実行する。2つのフィルタ処理部542では、撮像画像および参照画像に対してメディアンフィルタやガウスフィルタ等のノイズを低減するフィルタ処理がそれぞれ行われる。フィルタ処理済みの撮像画像および参照画像は、プリアライメント部543に出力される。プリアライメント部543では、所定のパターンを利用したパターンマッチングにより、参照画像の撮像画像に対する相対的な位置および角度のずれ量が特定される。そして、両画像の間における位置および角度のずれ量だけ、参照画像を撮像画像に対して平行移動および回転することにより、参照画像のおよその位置および角度が撮像画像に合わせられる。これにより、両画像に対するプリアライメントが行われる。
 図18を参照する。図18は、第1欠陥候補取得工程S141における処理の内容を示す画像例である。撮像画像データ入力工程S201により入力され、前処理工程S202が実行された撮像画像を撮像画像811として例示する。また、参照画像データ入力工程S211により入力され、前処理工程S212が実行された参照画像を参照画像812として例示する。対象物9の検査対象となる表面のうち、撮像画像811および参照画像812に表れる領域を「対象領域70」と称し、撮像画像811および参照画像812の中に矩形にて示す。撮像部3と対象領域70とは一対一に対応し、各撮像部3は常に同じ対象領域70の画像を取得する。
 撮像画像811の対象領域70には、周囲よりも暗く写る第1欠陥711および周囲よりも明るく写る第2欠陥721を確認することができる。これらは、例えば打痕や傷である。撮像画像811の対象領域70には、パターン部分712、722が含まれる。パターン部分712は、周囲よりも明るく写る凹部または凸部であり、パターン部分722は、周囲よりも暗く写る凹部または凸部である。これらパターン部分712、722は、対象物9に従来形成されている形状に由来するものであり、欠陥ではない。
 参照画像812の対象領域70には、周囲よりも明るく写る第2欠陥721を確認することができる。通常、参照画像としては欠陥のない対象物9を抽出して取得することが理想であるが、参照画像用に抽出した対象物9にも欠陥が含まれているおそれがある。また、参照画像812の対象領域70には、撮像画像811と同じ位置に、パターン部分712、722が含まれる。
 なお、図18に示す撮像画像811および参照画像812は、説明のために第1欠陥、第2欠陥およびパターン部分等を誇張して表現したものであり、実際の欠陥等は、より小さい画素によって表されることもある。また、撮像画像811および参照画像812では、便宜上、欠陥およびパターン部分の別を記載しているが、実際の画像においては、暗く写る領域が第1欠陥とパターン部分のいずれであるか、あるいは明るく映る部分が第2欠陥とパターン部分のいずれであるかは、後述する処理を通じてはじめて判明するものであり、撮像画像811および参照画像812の段階では欠陥およびパターン部分の別は不明である。
 図16を参照する。次に、膨張処理部544が、プリアライメント済みの撮像画像および参照画像に対して膨張処理を行う膨張処理工程S203、S213を実行する。
 図6に示すように、第1欠陥候補取得部541では、プリアライメント部543から撮像画像データ911および参照画像データ912が膨張処理部544に入力され、撮像画像および参照画像に膨張処理が行われる。ここでの膨張処理は、多値画像における明るい領域を膨張させる処理である。膨張処理では、公知の最大値フィルタが用いられる。最大値フィルタは、注目画素を中心とするカーネルサイズ内の画素中で、画素値が最大のものを抽出し、注目画素の画素値を当該最大の画素値に変更するフィルタである。最大値フィルタを通すことで、画素値の高い(すなわち、明るい)1ピクセルの画素が、3ピクセル×3ピクセルに膨張される。
 これにより、図18の膨張画像811aおよび膨張画像812aが生成される。膨張画像811aおよび膨張画像812aは、多値画像である。膨張画像811aおよび膨張画像812aでは、明るい領域である第2欠陥721aおよびパターン部分712aが膨張された状態で確認される一方、小さな暗い領域は消滅する。
 なお、本発明の実施に関しては、最大値フィルタのカーネルサイズは3ピクセル×3ピクセルに限られず、他の各種のサイズを採用してもよい。
 図16を参照する。次に、収縮処理部545が、膨張処理済みの撮像画像および参照画像に対して収縮処理を行う収縮処理工程S204、S214を実行する。
 図6に示すように、膨張処理済みの撮像画像および参照画像のデータは、収縮処理部545に入力され、撮像画像および参照画像に収縮処理が行われる。ここでの収縮処理は、多値画像における明るい領域を収縮させる処理である。収縮処理では、例えば膨張処理で用いた最大値フィルタと同サイズの最小値フィルタが用いられ、明るい領域がほぼ元の大きさに戻される。最小値フィルタは、注目画素を中心とするカーネルサイズ内の画素中で、画素値が最小のものを抽出し、注目画素の画素値を当該最小の画素値に変更するフィルタである。
 これにより、図18に示す収縮画像811bおよび収縮画像812bが生成される。収縮画像811bおよび収縮画像812bは、多値画像である。収縮画像811bおよび収縮画像812bでは、明るい領域である第2欠陥721bおよびパターン部分712bがほぼ元の大きさに戻った状態で確認される。膨張処理および収縮処理によって、元の撮像画像および参照画像において大きな暗い領域はほぼ元の状態が維持され、小さな暗い領域は消滅する。なお、図18の画像例においては、暗い領域はすべて膨張処理により消滅する。
 図16を参照する。次に、比較部546が、収縮処理済みの撮像画像および参照画像に対して比較処理を行う比較処理工程S205、S215を実行する。
 図6に示すように、収縮処理済みの撮像画像および参照画像のデータは、比較部546に入力され、比較部546は、まず撮像画像と、当該撮像画像を膨張・収縮処理した収縮画像との差および比の少なくとも一方に基づいて比較画像を生成し(比較処理工程S205)、これと並行して、参照画像と、当該参照画像を膨張・収縮処理した収縮画像との差および比の少なくとも一方に基づいて比較画像を生成する(比較処理工程S215)。
 比較処理工程S205は、撮像画像と、当該撮像画像を膨張・収縮処理した収縮画像との差および比の少なくとも一方に基づいて比較画像を生成する。本願の欠陥検査装置1において、差に基づくか、比に基づくかは、プログラム80により予め定められたパラメータ、またはユーザが入力部126を用いて指示したパラメータに基づいて決定される。また、本願の欠陥検査装置1において用いられる各種の所定値、基準値および閾値は、プログラム80により予め定められたパラメータ、またはユーザが入力部126を用いて指示したパラメータに基づいて決定される。以下、差に基づく比較画像の生成と、比に基づく比較画像の生成について、説明する。
 比較処理工程S205の具体例の一つとして、差(例えば、減算処理)によって比較画像を取得する。具体的には、撮像画像の各画素の値から、当該撮像画像を膨張・収縮処理した収縮画像の当該撮像画像と重なる領域における画素の値を減算することで、両画像の差分を示す差画像が取得される。そして、当該差画像のうち、画素の絶対値が所定の閾値よりも大きい領域を、第1欠陥候補領域として抽出した比較画像を取得する。
 本実施形態では、差画像のうち画素の絶対値が所定の閾値以下となる画素の値を「0」とし、画素値が0よりも大きい領域を第1欠陥候補領域として抽出する。なお、本願発明における第1欠陥候補領域の抽出手法としてはこれに限られず、所定の閾値によって差画像に対し2値化処理を実行することで第1欠陥候補領域を抽出してもよい。
 一般的に表現すれば、比較処理工程S205では、撮像画像において、当該撮像画像を膨張・収縮処理した収縮画像よりも明度が低く、かつ、明度の差の絶対値が第1基準値以上である領域が第1欠陥候補領域として比較画像に表現される。第1基準値は正の値である。さらに換言すれば、撮像画像において当該撮像画像を膨張・収縮処理した収縮画像よりも明度が所定値よりも低い領域が第1欠陥候補領域として比較画像に表現される。画像がモノクロである場合は、画素値を明度と捉えてもよく、カラー画像の場合は、色成分毎の画素値に対して所定の演算を行うことにより求められる値が明度として扱われる。
 また、比較処理工程S205の他の具体例として、第1欠陥候補領域は、撮像画像の各画素の値と当該撮像画像を膨張・収縮処理した収縮画像の対応する画素の値との比から求められてもよい。具体的には、撮像画像を膨張・収縮処理した収縮画像の各画素の値を当該撮像画像の対応する画素の値で除算することにより、比画像の画素の値が求められる。予め1よりも大きい第1基準値が準備されており、比画像において第1基準値以上の値を有する画素により構成される領域が第1欠陥候補領域として抽出され、当該第1欠陥候補領域を含む比較画像が取得される。
 もちろん、撮像画像の各画素の値を当該撮像画像を膨張・収縮処理した収縮画像の対応する画素の値で除算することにより、比画像の画素の値が求められてもよい。この場合、比画像において1よりも小さい第1基準値以下の値を有する画素により構成される領域が第1欠陥候補領域として抽出され、当該第1欠陥候補領域を含む比較画像が取得される。
 第1基準値は定数でなくてもよい。第1基準値は撮像画像の明度または画素値の関数でもよい。第1基準値は、撮像画像の明度または画素値の差および比を用いて定められてもよく、さらに他の演算が利用されてもよい。第1基準値が様々に定められてよい点は、後述の第2、第3および第4基準値についても同様である。第1ないし第4基準値は同じ値である必要はなく、算出方法も異なってもよい。一般的に表現すれば、撮像画像において、明度が、参照画像の明度よりも低く、かつ、予め定められた条件を満たす値よりも低い領域が第1欠陥候補領域として取得される。「予め定められた条件」は、各撮像画像に対して個別に設定されてもよい。さらに、複数の「予め定められた条件」が、1つの撮像画像に用いられてもよい。例えば、撮像画像中のエッジのように、撮像毎に画素値が変化しやすい位置では、欠陥候補の領域として検出されにくいように第1基準値が設定されてよい。上記説明は、以下の第2欠陥候補領域、第3欠陥候補領域、第4欠陥候補領域の抽出に関しても同様である。
 比較処理工程S215は、参照画像と、当該参照画像を膨張・収縮処理した収縮画像との差および比の少なくとも一方に基づいて比較画像を生成する。差画像または比画像の取得については、撮像画像についての比較処理工程S205と同様の処理を行う。比較処理工程S215では、比較処理工程S205と同様の処理により、第1欠陥候補領域に代えて、参照画像から第1マスク領域を抽出する。
 比較処理工程S215の具体例の一つとして、差(例えば、減算処理)によって比較画像を取得する。具体的には、参照画像の各画素の値から、当該参照画像を膨張・収縮処理した収縮画像の当該参照画像と重なる領域における画素の値を減算することで、両画像の差分を示す差画像が取得される。そして、当該差画像のうち、画素の絶対値が所定の閾値よりも大きい領域を、第1マスク領域として抽出した比較画像を取得する。
 また、比較処理工程S215の他の具体例として、第1マスク領域は、参照画像の各画素の値と当該参照画像を膨張・収縮処理した収縮画像の対応する画素の値との比から求められてもよい。具体的には、参照画像を膨張・収縮処理した収縮画像の各画素の値を当該参照画像の対応する画素の値で除算することにより、比画像の画素の値が求められる。予め1よりも大きい第1基準値が準備されており、比画像において第1基準値以上の値を有する画素により構成される領域が第1マスク領域として抽出され、当該第1マスク領域を含む比較画像が取得される。
 このとき、比較処理工程S205における所定の閾値および第1基準値と、比較処理工程S215における所定の閾値および第1基準値とは、同一であっても良いし、異なっていても良い。同一である場合には、処理を共通させることができ、処理メモリの削減や処理時間の削減に資する。
 以上の処理により、図18に示す比較画像811cおよび比較画像812cが取得される。比較画像811cでは、撮像画像811よりも暗い領域として第1欠陥候補領域711c、722cが抽出されている。なお、711cは第1欠陥(真の欠陥)に対応し、722cはパターン部分(偽の欠陥)に対応する。また、比較画像812cでは、参照画像812よりも暗い領域として第1マスク領域722cが抽出されている。なお、722cはパターン部分(偽の欠陥)に対応する。
 以上に説明した、撮像画像データ入力工程S201と、前処理工程S202と、膨張処理工程S203と、収縮処理工程S204と、比較処理工程S205とが、本実施形態における第1欠陥候補領域検出工程S1411を構成する。なお、前処理工程S202は、撮像画像の状態や検査条件によっては省略することができる。
 また、以上に説明した、参照画像データ入力工程S211と、前処理工程S212と、膨張処理工程S213と、収縮処理工程S214と、比較処理工程S215とが、本実施形態における第1マスク領域検出工程S1412を構成する。なお、前処理工程S212は、参照画像の状態や検査条件によっては省略することができる。
 図16を参照する。次に、比較部546が、撮像画像に基づく比較画像に対して欠陥候補除外処理を行う欠陥候補除外工程S1413を実行する。
 欠陥候補除外工程S1413が開始されると、まず比較部546が、第1マスク領域を太らせる太らせ処理を実行する。具体的には、比較画像812cに対して、膨張処理工程S213と同様に最大値フィルタを用いて膨張処理を、太らせ処理として施す。
 なお、本発明の実施に関しては、最大値フィルタを用いた太らせ処理に限られず、各種の太らせ処理を採用することができる。
 ここで、参照画像に写る対象物と、撮像画像に写る対象物との間には、公差が存在する場合がある。また、参照画像を撮像する際の対象物の姿勢と、撮像画像を撮像する際の対象物の姿勢との間には、位置ずれが存在する場合がある。したがって、後述するようにそのまま第1マスク領域と第1欠陥候補領域とが重なる領域を除外するのみでは、第1欠陥候補領域のうち欠陥ではない領域(すなわち、パターン部分)が第1マスク領域と良好に重ならず、位置ずれした部分については欠陥ではない領域がそのまま第1欠陥候補領域として残留することになる。そこで、第1マスク領域に対し太らせ処理を行い、位置ずれに起因する第1欠陥候補領域と第1マスク領域との非重複部分を低減する。これにより、より過検出を抑制することができる。
 続いて、欠陥候補除外工程S1413では、撮像画像の比較画像における第1欠陥候補領域の一部領域を、第1マスク領域に基づいて、第1欠陥候補から除外した第1欠陥候補画像を生成する欠陥候補除外処理を実行する。より具体的には、比較部546において生成された撮像画像に基づく比較画像の第1欠陥候補領域のうち、参照画像に基づく比較画像の第1マスク領域と所定条件以上重なるものを、第1欠陥候補から除外した第1欠陥候補画像を生成する。
 ここで、第1欠陥候補領域と第1マスク領域との重なりの評価方法としては、撮像画像の比較画像における各画素と、参照画像の比較画像における各画素との差または和をとり、所定の閾値と比較して第1欠陥候補領域を抽出する方法が使用される。差および和のいずれの抽出方法を使用するかは、プログラム80により予め定められたパラメータ、またはユーザが入力部126を用いて指示したパラメータに基づいて決定される。
 差に基づいて第1欠陥候補画像を取得する場合、具体的には、撮像画像の比較画像における各画素の値から、参照画像の比較画像の対応する位置の画素の値を減算することで、両画像の差分を示す差画像を取得する。そして、当該差画像のうち、画素の値が所定の閾値よりも大きい領域を、第1欠陥候補として残し、他の領域を「0」とした状態で、第1欠陥候補画像を取得する。
 和に基づいて第1欠陥候補画像を取得する場合、具体的には、撮像画像の比較画像における各画素の値と、参照画像の比較画像の対応する位置の画素の値を加算することで、両画像の和を示す和画像を取得する。そして、当該和画像のうち、画素の値が所定の閾値よりも大きい領域を画素値「0」とすることで、第1マスク領域と第1欠陥候補領域とが重複する領域として除外し、第1マスク領域と重複しない第1欠陥候補領域を残した状態で、第1欠陥候補画像を取得する。
 なお、本発明の実施に関してはこれに限られず、撮像画像の比較画像と、参照画像の比較画像について、それぞれ所定の閾値以上の画素値を有する画素を「1」とし、当該閾値より低い画素値を有する画素を「0」とする2値化処理を施した後に、参照画像の比較画像について画素値「1」と「0」を反転する処理を施し、撮像画像の比較画像の各画素の画素値と、参照画像の比較画像の反転画像における対応する各画素の画素値との論理積を取って、画素値が「1」となる領域を第1欠陥候補領域とする第1欠陥候補画像を取得してもよい。この場合、後述する後処理工程S1414のうち、2値化部547による2値化処理を省略できる。
 また、本実施形態では、欠陥候補除外工程S1413において太らせ処理を行ったが、本発明の実施に関してはこれに限られず、太らせ処理を省略し、欠陥候補除外工程S1413では欠陥候補除外処理のみを実行してもよい。
 図16を参照する。次に、2値化部547および面積フィルタ部548が、第1欠陥候補画像に対して後処理を行う後処理工程S1414を実行する。
 図6に示すように、比較部546から出力される第1欠陥候補画像は2値化部547にて所定の閾値にて2値化される。ここで、第1欠陥候補画像は、第1欠陥候補領域が多値で表され、それ以外の領域は「0」で表されている。2値化部547における2値化処理により、第1欠陥候補領域を「1」とし、それ以外の領域を「0」とする。
 続いて、2値化処理済みの第1欠陥候補画像は、面積フィルタ部548に入力される。面積フィルタ部548により、面積が予め定められた値よりも小さい第1欠陥候補領域が削除され、残りの第1欠陥候補領域を示す画像が最終的な第1欠陥候補画像(正確には、第1欠陥候補領域を示す画像データである第1欠陥候補データ921)として取得される。
 以上の処理により、図18に示す第1欠陥候補画像821が取得される。第1欠陥候補画像821では、比較画像811cで抽出された第1欠陥候補領域722cが、比較画像812cとの差分をとることで除外されている。これにより、本来は欠陥ではないパターン部分722に起因する虚報を抑制することができる。但し、図18の画像例では、撮像画像811と参照画像812との間の、対象物9の公差に起因して、一部の第1欠陥候補領域722cが第1マスク領域によって除外しきれず、第1欠陥候補画像821において第1欠陥候補領域722dとして残留している。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の第1欠陥候補データ921が取得される。
 図14を参照する。次に、第3欠陥候補取得部551が、第3欠陥候補取得工程S142を実行する。
 図7に示すように、第3欠陥候補取得工程S142が開始されると、まず第1欠陥候補取得工程S141にて選択された1つの撮像画像と、当該撮像画像に対応する参照画像が選択される。そして、第3欠陥候補取得部551において、撮像画像の撮像画像データ911がフィルタ処理部552に入力され、参照画像の参照画像データ912がフィルタ処理部552に入力される。
 次に、フィルタ処理部542およびプリアライメント部543が、撮像画像および参照画像に対してフィルタ処理およびプリアライメント処理を行う。これらの処理は、第1欠陥候補取得工程S141における前処理工程S202、S212と同様であるため、説明を省略する。
 続いて、ゆすらせ比較部554が、前処理済みの撮像画像および参照画像を用いて、ゆすらせ比較処理を行い、2値化部555がゆすらせ比較処理済みの画像に対し2値化処理を行うことで、第3欠陥候補画像を生成する。ゆすらせ比較部554では、参照画像をプリアライメント済みの位置から、上下左右に少しずつ移動しながら、撮像画像と参照画像との差異を示す評価値が求められる。評価値としては、例えば、両画像が重なる領域における画素の値の(符号付きの)差の絶対値の和が求められる。そして、評価値が最小となる位置における両画像の画素の値の符号付き差分を示す画像が生成される。符号付き差分画像は、2値化部555により所定の値にて2値化され、第3欠陥候補領域を示す第3欠陥候補画像が生成される。
 実際には、処理を簡素化するために、符号付き差分画像は求められない。具体的には、参照画像の各画素の値から撮像画像の対応する画素の値が減算され、値が負の場合に0とすることにより、差分画像の画素の値が求められる。予め正の値が準備されており、差分画像において当該正の値以上の値を有する画素により構成される領域が第3欠陥候補領域として取得される。
 一般的に表現すれば、撮像画像において参照画像よりも明度が低く、かつ、明度の差の絶対値が第2基準値以上である領域が第3欠陥候補領域として取得される。第2基準値は正の値である。さらに換言すれば、撮像画像において参照画像よりも明度が所定値よりも低い領域が第3欠陥候補領域として取得される。画像がモノクロである場合は、画素値を明度と捉えてもよく、カラー画像の場合は、色成分毎の画素値に対して所定の演算を行うことにより求められる値が明度として扱われる。
 第3欠陥候補領域は、参照画像の各画素の値と撮像画像の対応する画素の値との比から求められてもよい。具体的には、参照画像の各画素の値を撮像画像の対応する画素の値で除算することにより、比画像の画素の値が求められる。予め1よりも大きい第2基準値が準備されており、比画像において第2基準値以上の値を有する画素により構成される領域が第3欠陥候補領域として取得される。もちろん、撮像画像の各画素の値を参照画像の対応する画素の値で除算することにより、比画像の画素の値が求められてもよい。この場合、比画像において1よりも小さい第2基準値以下の値を有する画素により構成される領域が第3欠陥候補領域として取得される。
 第2基準値は定数でなくてもよい。第2基準値は参照画像および/または撮像画像の明度または画素値の関数でもよい。第2基準値は、参照画像および撮像画像の明度または画素値の差および比を用いて定められてもよく、さらに他の演算が利用されてもよい。
 図19は、第3欠陥候補取得工程S142における処理の内容を示す画像例である。入力される撮像画像811および参照画像812は、図18にて例示した画像と同様である。ゆすらせ比較部554によるゆすらせ比較処理および2値化部555による2値化処理が実行された結果、生成される第3欠陥候補画像を第3欠陥候補画像823として例示する。
 第3欠陥候補画像823では、ゆすらせ比較処理によって撮像画像811のうち参照画像812と比べて暗い領域が第3欠陥候補領域711i、721iとして抽出されている。このうち、第3欠陥候補領域711iは、撮像画像811に存在する第1欠陥711に対応する真の欠陥である一方、第3欠陥候補領域721iは、撮像画像811には存在しないものの、参照画像812において第2欠陥721(すなわち、周囲よりも明るく写る欠陥)として存在するために、ゆすらせ比較処理によって参照画像812よりも暗い領域として抽出されてしまった、いわゆる偽の欠陥である。このように、ゆすらせ比較処理では、参照画像中に欠陥領域が含まれると、それに起因して撮像画像には含まれない欠陥領域をノイズとして抽出することがある。
 図7を参照する。ゆすらせ比較処理および2値化処理によって第3欠陥候補領域711i、721iが取得されると、面積フィルタ部556により、面積が予め定められた値よりも小さい第3欠陥候補領域が削除され、残りの第3欠陥候補領域を示す画像が最終的な第3欠陥候補画像(正確には、第3欠陥候補領域を示す画像データである第3欠陥候補データ923)として取得される。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の第3欠陥候補データ923が取得される。
 図14を参照する。第1欠陥候補データ921および第3欠陥候補データ923が取得されると、次に欠陥候補限定工程S143が実行され、第1欠陥候補データ921および第3欠陥候補データ923に基づいて、第1欠陥データ931が取得される。
 図8に示すように、欠陥候補限定工程S143が開始されると、第1欠陥候補データ921および第3欠陥候補データ923が、論理積演算部582に入力される。ここで、論理積演算部582に入力される第1欠陥候補データ921は、所定の第1の撮像部3が所定の第1の照明条件のもとで取得した1個の撮像画像および当該撮像画像に対応する参照画像から生成されたデータである。そして、同じ論理積演算部582に入力される第3欠陥候補データ923は、第1の撮像部3が第1の照明条件のもとで取得した同じ撮像画像および当該撮像画像に対応する参照画像から生成されたデータである。
 そして、論理積演算部582とは異なる論理積演算部583には、別の撮像画像および当該撮像画像に対応する参照画像から生成された第1欠陥候補データ921および第3欠陥候補データ923が入力される。ここで、論理積演算部583に入力される第1欠陥候補データ921は、論理積演算部582のものと同じ第1の撮像部3が、論理積演算部582のものと異なる第2の照明条件のもとで取得した1個の撮像画像および当該撮像画像に対応する参照画像から生成されたデータである。そして、同じ論理積演算部583に入力される第3欠陥候補データ923は、第1の撮像部3が第2の照明条件のもとで取得した撮像画像および当該撮像画像に対応する参照画像から生成されたデータである。
 そして、領域選択部584には、第1欠陥候補データ921と第3欠陥候補データ923との各組み合わせから得られる論理積画像のデータが入力される。換言すれば、各論理積画像は、それぞれ同じ撮像部が異なる照明条件のもとで取得した撮像画像および参照画像から生成される画像である。論理積演算部582で得られる第1の論理積画像は、第1の撮像部3により第1の照明条件のもとで取得した画像に基づいて生成され、論理積演算部583で得られる第2の論理積画像は、第1の撮像部3により第2の照明条件のもとで取得した画像に基づいて生成される。
 各論理積画像は、第1欠陥候補領域と第3欠陥候補領域とから生成される第1欠陥領域を示す画像である。
 図20は、図18の第1欠陥候補領域711d、722dと図19の第3欠陥候補領域711i、721iとから生成される第1欠陥領域731を示す第1欠陥画像831を例示する図である。
 第1欠陥候補領域711d、722dは、撮像画像のいわゆる自己比較により抽出した比較画像811cにおける第1欠陥候補領域711c、722cを、参照画像のいわゆる自己比較により抽出した比較画像812cにおける第1マスク領域722cでマスクすることで得られるため、参照画像812に含まれる欠陥に起因するノイズを検出する可能性が低い。しかし、処理時間の都合上、正確な位置合わせを行っていないことによる偽欠陥(図20では、第1欠陥候補領域722d)を検出するおそれがある。
 一方、第3欠陥候補領域711i、721iは、撮像画像811と参照画像812との位置合わせを行った後に、これらの画像の差分画像から得られるため、欠陥の存在を示す信頼性が高い。しかし、第3欠陥候補領域は、参照画像812に含まれる欠陥を偽欠陥(図20では第3欠陥候補領域721i)として検出するおそれがある。
 そこで、本実施形態では、第1欠陥候補画像821と第3欠陥候補画像823との論理積画像を求めることにより、信頼性を向上した第1欠陥領域731を示す第1欠陥画像831を得る。
 領域選択部584では、複数の第1欠陥画像831を重ねた場合に、所定数以上の第1欠陥領域が重なる領域を、第1欠陥領域として維持し、所定数未満の領域を第1欠陥領域から除外する。ここで、「重なる領域」は、重なる複数の領域における画素値の論理和であってもよく、当該画素値の論理積であってもよい。本実施の形態では重なる領域の数が2以上の場合に第1欠陥領域として維持する。領域選択部584により、第1欠陥領域731を示す複数の第1欠陥画像831から、限定された第1欠陥領域を示す1つの第1欠陥画像が取得され、これに対応する第1欠陥データ931が領域選択部584から出力される。これにより、複数の照明状態にて取得された複数の撮像画像から、対応する参照画像を参照しつつ参照画像に対して暗い領域が第1欠陥領域として抽出される。
 領域選択部584から出力された第1欠陥データ931は、欠陥取得部52から記憶部53へ出力されて、記憶部53にて記憶される。
 以上により、撮像画像における第1欠陥の存在を取得する第1欠陥取得工程S14が終了する。
 第1欠陥取得工程S14と並行して、撮像画像における第2欠陥の存在を取得する第2欠陥取得工程S15が実行される。第2欠陥は、撮像画像のうち参照画像に対して明るく現れる欠陥である。第2欠陥取得工程S15が第1欠陥取得工程S14と異なるところは、参照画像や撮像画像内部の他の領域に比して撮像画像のうち明るい領域を検出するために、膨張処理工程と収縮処理工程の順序が逆である点、減算や除算の順序が逆である点であり、その他の部分では第1欠陥取得工程S14と共通するため、共通部分については説明を適宜省略する。
 以下、図9から図23までを適宜参照しつつ、第2欠陥取得工程S15について説明する。
 第2欠陥取得工程S15が開始すると、まず、第2欠陥候補取得工程S151が実行される。第2欠陥候補取得工程S151では、まず、第2欠陥取得部522により1つの撮像画像が選択され、当該撮像画像に対応する参照画像が選択される。図9に示すように、第2欠陥候補取得部561では、撮像画像の撮像画像データ911がフィルタ処理部562に入力され(撮像画像データ入力工程S301)、参照画像の参照画像データ912がフィルタ処理部562に入力される(参照画像データ入力工程S311)。
 図17を参照する。前処理工程S302、S312は、前処理工程S201、S211(図16)と同様に行われる。次に、収縮処理部564が、プリアライメント済みの撮像画像および参照画像に対して収縮処理を行う収縮処理工程S303、S313を実行する。
 図10に示すように、第2欠陥候補取得部561では、プリアライメント部563から撮像画像データ911および参照画像データ912が収縮処理部564に入力され、撮像画像および参照画像に収縮処理が行われる。ここでの収縮処理は、多値画像における明るい領域を収縮させる処理であり、暗い領域に対する膨張処理でもある。これにより、明るい小さな領域が消滅する。収縮処理では、例えば公知の最小値フィルタが用いられ、画素値の低い(すなわち、暗い)1ピクセルの画素が、3ピクセル×3ピクセルに膨張される。
 図21は、第2欠陥候補取得工程S151における処理の内容を示す画像例であり、入力される撮像画像811および参照画像812は、図18と同様の画像である。
 収縮処理により、図21の収縮画像811eおよび収縮画像812eが生成される。収縮画像811eおよび収縮画像812eでは、暗い領域である第1欠陥711eおよびパターン部分722eが膨張された状態で確認される一方、小さな明るい領域は消滅する。
 なお、本発明の実施に関しては、最小値フィルタのカーネルサイズは3ピクセル×3ピクセルに限られず、他の各種のサイズを採用してもよい。
 図17を参照する。次に、膨張処理部565が、収縮処理済みの撮像画像および参照画像に対して膨張処理を行う膨張処理工程S304、S314を実行する。
 図10に示すように、収縮処理済みの撮像画像および参照画像のデータは、膨張処理部565に入力され、撮像画像および参照画像に膨張処理が行われる。ここでの膨張処理は、多値画像における明るい領域を膨張させる処理である。膨張処理では、例えば収縮処理で用いた最小値フィルタと同サイズの最大値フィルタが用いられ、膨張していた暗い領域がほぼ元の大きさに戻される。
 これにより、図21に示す膨張画像811fおよび膨張画像812fが生成される。膨張画像811fおよび膨張画像812fでは、暗い領域である第1欠陥711fおよびパターン部分722fがほぼ元の大きさに戻った状態で確認される。収縮処理および膨張処理によって、元の撮像画像および参照画像において大きな明るい領域はほぼ元の状態が維持され、小さな明るい領域は消滅する。なお、図21の画像例においては、明るい領域はすべて収縮処理により消滅する。
 図17を参照する。次に、比較部566が、膨張処理済みの撮像画像および参照画像に対して比較処理を行う比較処理工程S305、S315を実行する。
 図10に示すように、膨張処理済みの撮像画像および参照画像のデータは、比較部566に入力され、比較部566は、まず撮像画像と、当該撮像画像を収縮・膨張処理した膨張画像との差および比の少なくとも一方に基づいて比較画像を生成し(比較処理工程S305)、これと並行して、参照画像と、当該参照画像を収縮・膨張処理した膨張画像との差および比の少なくとも一方に基づいて比較画像を生成する(比較処理工程S315)。
 比較処理工程S305、S315における処理は、比較処理工程S205、S215と閾値として用いる基準値や、比に基づいて比較画像を生成する際の分子分母の順が異なる点以外は、共通するため、共通する点については適宜説明を省略する。
 比較処理工程S305の具体例の一つとして、差(例えば、減算処理)によって比較画像を取得する。具体的には、撮像画像の各画素の値から、当該撮像画像を収縮・膨張処理した膨張画像の当該撮像画像と重なる領域における画素の値を減算することで、両画像の差分を示す差画像が取得される。そして、当該差画像のうち、画素の絶対値が所定の閾値よりも大きい領域を、第2欠陥候補領域として抽出した比較画像を取得する。
 一般的に表現すれば、比較処理工程S305では、撮像画像において、当該撮像画像を収縮・膨張処理した膨張画像よりも明度が高く、かつ、明度の差の絶対値が第3基準値以上である領域が第2欠陥候補領域として比較画像に表現される。第3基準値は正の値である。さらに換言すれば、撮像画像において当該撮像画像を収縮・膨張処理した膨張画像よりも明度が所定値以上高い領域が第2欠陥候補領域として比較画像に表現される。画像がモノクロである場合は、画素値を明度と捉えてもよく、カラー画像の場合は、色成分毎の画素値に対して所定の演算を行うことにより求められる値が明度として扱われる。
 また、比較処理工程S305の他の具体例として、第2欠陥候補領域は、撮像画像の各画素の値と当該撮像画像を収縮・膨張処理した膨張画像の対応する画素の値との比から求められてもよい。具体的には、撮像画像の対応する画素の値を当該撮像画像を収縮・膨張処理した膨張画像の各画素の値で除算することにより、比画像の画素の値が求められる。予め1よりも大きい第3基準値が準備されており、比画像において第3基準値以上の値を有する画素により構成される領域が第2欠陥候補領域として抽出され、当該第2欠陥候補領域を含む比較画像が取得される。
 もちろん、撮像画像を収縮・膨張処理した膨張画像の画素の値を当該撮像画像の対応する各画素の値で除算することにより、比画像の画素の値が求められてもよい。この場合、比画像において1よりも小さい第3基準値以下の値を有する画素により構成される領域が第2欠陥候補領域として抽出され、当該第2欠陥候補領域を含む比較画像が取得される。
 比較処理工程S315は、参照画像と、当該参照画像を収縮・膨張処理した膨張画像との差および比の少なくとも一方に基づいて比較画像を生成する。差画像または比画像の取得については、撮像画像についての比較処理工程S305と同様の処理を行う。比較処理工程S315では、比較処理工程S305と同様の処理により、第2欠陥候補領域に代えて、参照画像のうち明るい領域を第2マスク領域として抽出する。
 比較処理工程S315の具体例の一つとして、差(例えば、減算処理)によって比較画像を取得する。具体的には、参照画像の各画素の値から、当該参照画像を収縮・膨張処理した膨張画像の当該参照画像と重なる領域における画素の値を減算することで、両画像の差分を示す差画像が取得される。そして、当該差画像のうち、画素の絶対値が所定の閾値よりも大きい領域を、第2マスク領域として抽出した比較画像を取得する。
 また、比較処理工程S315の他の具体例として、第2マスク領域は、参照画像の各画素の値と当該参照画像を収縮・膨張処理した膨張画像の対応する画素の値との比から求められてもよい。
 以上の処理により、図21に示す比較画像811gおよび比較画像812gが取得される。比較画像811gでは、撮像画像811よりも明るい領域として第2欠陥候補領域712g、721gが抽出されている。また、比較画像812gでは、参照画像812よりも明るい領域として第2マスク領域712g、721gが抽出されている。なお、721gは第2欠陥(真の欠陥)に対応し、712gはパターン部分(偽の欠陥)に対応する。
 以上に説明した、撮像画像データ入力工程S301と、前処理工程S302と、収縮処理工程S303と、膨張処理工程S304と、比較処理工程S305とが、本実施形態における第2欠陥候補領域検出工程S1511を構成する。なお、前処理工程S302は、撮像画像の状態や検査条件によっては省略することができる。
 また、以上に説明した、参照画像データ入力工程S311と、前処理工程S312と、収縮処理工程S313と、膨張処理工程S314と、比較処理工程S315とが、本実施形態における第2マスク領域検出工程S1512を構成する。なお、前処理工程S312は、参照画像の状態や検査条件によっては省略することができる。
 図17を参照する。次に、比較部566が、撮像画像に基づく比較画像に対して欠陥候補除外処理を行う欠陥候補除外工程S1513を実行する。
 欠陥候補除外工程S1513では、撮像画像の比較画像における第2欠陥候補領域の一部領域を、第2マスク領域に基づいて、第2欠陥候補から除外した第2欠陥候補画像を生成する。より具体的には、欠陥候補除外工程S1413と同様に、比較部566において生成された撮像画像に基づく比較画像の第2欠陥候補領域のうち、参照画像に基づく比較画像の第2マスク領域と所定条件以上重なるものを、第2欠陥候補から除外した第2欠陥候補画像を生成する。
 次に、2値化部567および面積フィルタ部568が、第2欠陥候補画像に対して後処理を行う後処理工程S1514を実行し、最終的な第2欠陥候補画像(正確には、第2欠陥候補領域を示す画像データである第2欠陥候補データ922)が取得される。後処理工程S1514は、後処理工程S1414と同様の処理であるため、説明を省略する。
 以上の処理により、図21に示す第2欠陥候補画像822が取得される。第2欠陥候補画像822では、比較画像811gで抽出された第2欠陥候補領域712gが、比較画像812gとの差分をとることで除外され、第2欠陥候補領域721hのみが残留している。これにより、本来は欠陥ではないパターン部分712に起因する過検出を抑制することができる。
 また、比較画像812gにおいて、参照画像812に含まれる第2欠陥721が第2マスク領域721gとして残っていたとしても、第2欠陥候補画像822に影響することは防止される。第2欠陥候補領域721hは、比較画像811gの第2欠陥候補領域712g、721gのうちから抽出されるため、参照画像812のみで生じる第2欠陥721に起因して第2欠陥候補画像822にノイズ(すなわち、偽欠陥)が生じることはない。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の第2欠陥候補データ922が取得される。
 図15を参照する。次に、第4欠陥候補取得部571が、第4欠陥候補取得工程S152を実行する。
 図11に示すように、第4欠陥候補取得工程S152が開始されると、まず第2欠陥候補取得工程S151にて選択された1つの撮像画像と、当該撮像画像に対応する参照画像が選択される。そして、第4欠陥候補取得部571において、撮像画像の撮像画像データ911がフィルタ処理部572に入力され、参照画像の参照画像データ912がフィルタ処理部572に入力される。
 次に、フィルタ処理部572およびプリアライメント部573が、撮像画像および参照画像に対してフィルタ処理およびプリアライメント処理を行う。これらの処理は、第2欠陥候補取得工程S151における前処理工程S302、S312と同様であるため、説明を省略する。
 続いて、ゆすらせ比較部574が、前処理済みの撮像画像および参照画像を用いて、ゆすらせ比較処理を行い、2値化部575がゆすらせ比較処理済みの画像に対し2値化処理を行うことで、第4欠陥候補画像を生成する。ゆすらせ比較部574では、参照画像をプリアライメント済みの位置から、上下左右に少しずつ移動しながら、撮像画像と参照画像との差異を示す評価値が求められる。評価値としては、例えば、両画像が重なる領域における画素の値の(符号付きの)差の絶対値の和が求められる。そして、評価値が最小となる位置における両画像の画素の値の符号付き差分を示す画像が生成される。符号付き差分画像は、2値化部575により所定の値にて2値化され、第4欠陥候補領域を示す第4欠陥候補画像が生成される。
 実際には、処理を簡素化するために、符号付き差分画像は求められない。具体的には、撮像画像の各画素の値から参照画像の対応する画素の値が減算され、値が負の場合に0とすることにより、差分画像の画素の値が求められる。予め正の値が準備されており、差分画像において当該正の値以上の値を有する画素により構成される領域が第4欠陥候補領域として取得される。
 一般的に表現すれば、撮像画像において参照画像よりも明度が高く、かつ、明度の差の絶対値が第4基準値以上である領域が第4欠陥候補領域として取得される。第4基準値は正の値である。さらに換言すれば、撮像画像において参照画像よりも明度が所定値以上高い領域が第4欠陥候補領域として取得される。画像がモノクロである場合は、画素値を明度と捉えてもよく、カラー画像の場合は、色成分毎の画素値に対して所定の演算を行うことにより求められる値が明度として扱われる。
 第4欠陥候補領域は、参照画像の各画素の値と撮像画像の対応する画素の値との比から求められてもよい。具体的には、撮像画像の各画素の値を参照画像の対応する画素の値で除算することにより、比画像の画素の値が求められる。予め1よりも大きい第4基準値が準備されており、比画像において第4基準値以上の値を有する画素により構成される領域が第4欠陥候補領域として取得される。もちろん、参照画像の各画素の値を撮像画像の対応する画素の値で除算することにより、比画像の画素の値が求められてもよい。この場合、比画像において1よりも小さい第4基準値以下の値を有する画素により構成される領域が第4欠陥候補領域として取得される。
 第4基準値は定数でなくてもよい。第4基準値は参照画像および/または撮像画像の明度または画素値の関数でもよい。第4基準値は、参照画像および撮像画像の明度または画素値の差および比を用いて定められてもよく、さらに他の演算が利用されてもよい。
 図22は、第4欠陥候補取得工程S152における処理の内容を示す画像例である。入力される撮像画像811および参照画像812は、図21にて例示した画像と同様である。ゆすらせ比較部574によるゆすらせ比較処理および2値化部575による2値化処理が実行された結果、生成される第4欠陥候補画像を第4欠陥候補画像824として例示する。
 第4欠陥候補画像824では、ゆすらせ比較処理によって撮像画像811のうち参照画像812と比べて明るい領域が第4欠陥候補領域721jとして抽出されている。
 図10を参照する。ゆすらせ比較処理および2値化処理によって第4欠陥候補領域721jが取得されると、面積フィルタ部576により、面積が予め定められた値よりも小さい第4欠陥候補領域が削除され、残りの第4欠陥候補領域を示す画像が最終的な第4欠陥候補画像(正確には、第4欠陥候補領域を示す画像データである第4欠陥候補データ924)として取得される。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の第4欠陥候補データ924が取得される。
 図15を参照する。第2欠陥候補データ922および第4欠陥候補データ924が取得されると、次に欠陥候補限定工程S153が実行され、第2欠陥候補データ922および第4欠陥候補データ924に基づいて、第2欠陥データ932が取得される。
 図12に示すように、欠陥候補限定工程S153が開始されると、第2欠陥候補データ922および第4欠陥候補データ924が、論理積演算部592、593に入力される。入力される第2欠陥候補データ922および第4欠陥候補データ924と、論理積演算部592、593との関係(すなわち、撮像部と照明条件の関係)は、欠陥候補限定工程S143における関係と同様であるため、説明を省略する。
 領域選択部594には、第2欠陥候補データ922と第4欠陥候補データ924との各組み合わせから得られる論理積画像のデータが入力される。
 図23は、図21の第2欠陥候補領域721hと図22の第4欠陥候補領域721jとから生成される第2欠陥領域732を示す第2欠陥画像832を例示する図である。
 欠陥候補除外工程S1513では、第2欠陥候補画像822と第4欠陥候補画像824との論理積画像を求めることにより、信頼性を向上した第2欠陥領域732を示す第2欠陥画像832を得ることができる。
 領域選択部594では、複数の第2欠陥画像832を重ねた場合に、所定数以上の第2欠陥領域が重なる領域を、第2欠陥領域として維持し、所定数未満の領域を第2欠陥領域から除外する。ここで、「重なる領域」は、重なる複数の領域の論理和であってもよく、論理積であってもよい。本実施の形態では重なる領域の数が2以上の場合に第2欠陥領域として維持する。領域選択部594により、第2欠陥領域732を示す複数の第2欠陥画像832から、限定された第2欠陥領域を示す1つの第2欠陥画像が取得され、これに対応する第2欠陥データ932が領域選択部594から出力される。これにより、複数の照明状態にて取得された複数の撮像画像から、対応する参照画像を参照しつつ参照画像に対して明るい領域が第2欠陥領域として抽出される。
 領域選択部594から出力された第2欠陥データ932は、欠陥取得部52から記憶部53へ出力されて、記憶部53にて記憶される。
 以上により、撮像画像における第2欠陥の存在を取得する第2欠陥取得工程S15が終了する。
 以上の処理により、1つの撮像部3から見た対象領域70において、欠陥が存在する場合の欠陥の位置が検出される。
 コンピュータ12の表示部には、1つの撮像画像が表示され、対象領域70上に、第1欠陥領域および第2欠陥領域がそれぞれ異なる色が付いた領域として併せて表示される。なお、本願発明の実施に関してはこれに限られず、表示部において第1欠陥領域および第2欠陥領域のいずれか一方を表示し、ユーザの入力に基づいて他方を表示できるよう切り替え可能に表示されても良い。
 1つの撮像部3により取得される撮像画像の最小数は2であるが、好ましくは3以上である。すなわち、光照射部4は互いに異なる3以上の照明状態とすることができ、例えば、対象物9に3以上の方向から光を照射することができ、撮像制御部51の制御により、3以上の照明状態の間に撮像部3が画像を取得する。好ましい照明状態が既知の場合は、その情報に基づいて取得された3以上の撮像画像の少なくとも1つが処理対象の撮像画像として選択されてもよい。3以上の撮像画像を準備することにより、より適切な欠陥検出を容易に行うことができる。
 一般的には、上記説明における第1欠陥候補および第2欠陥候補は「欠陥候補」と表現することができ、第1欠陥候補領域および第2欠陥候補領域は「欠陥候補領域」と表現することができ、第1マスク領域および第2マスク領域は「マスク領域」と表現することができ、第1欠陥候補画像および第2欠陥候補画像は「欠陥候補画像」と表現することができる。
 上記説明において、第1欠陥候補取得部541および第2欠陥候補取得部561の少なくとも一方が、本願発明における「自己比較欠陥候補取得部」に相当する。また、上記説明において、第1欠陥候補取得部541が本願発明における「自己比較欠陥候補取得部」に相当する場合、第3欠陥候補取得部551が本願発明における「他画像比較欠陥候補取得部」に相当し、欠陥候補限定部581が本願発明における「欠陥候補限定部」に相当する。また、上記説明において、第2欠陥候補取得部561が本願発明における「自己比較欠陥候補取得部」に相当する場合、第4欠陥候補取得部571が本願発明における「他画像比較欠陥候補取得部」に相当し、欠陥候補限定部591が本願発明における「欠陥候補限定部」に相当する。
 上記説明において、撮像工程S13が本願発明における「撮像工程」に相当し、第1欠陥候補取得工程S141および第2欠陥候補取得工程S151の少なくとも一方が、本願発明における「自己比較欠陥候補取得工程」に相当する。また、上記説明において、第1欠陥候補取得工程S141が本願発明における「自己比較欠陥候補取得工程」に相当する場合、第3欠陥候補取得工程142が本願発明における「他画像比較欠陥候補取得工程」に相当し、欠陥候補限定工程S143が本願発明における「欠陥候補限定工程」に相当する。また、上記説明において、第2欠陥候補取得工程S151が本願発明における「自己比較欠陥候補取得部」に相当する場合、第4欠陥候補取得工程S152が本願発明における「他画像比較欠陥候補取得工程」に相当し、欠陥候補限定工程S153が本願発明における「欠陥候補限定工程」に相当する。
 欠陥検出方法において、第1欠陥取得工程S14における第3欠陥候補取得工程S142および欠陥候補限定工程S143を省略し、第1欠陥候補取得工程S141にて取得された第1欠陥候補領域を第1欠陥領域として取得してもよい。この場合においても、第1欠陥候補取得工程S141において第1欠陥候補領域のうち、第1マスク領域と所定条件以上重なるものを、第1欠陥候補から除外したうえで、第1欠陥候補領域に基づいて撮像画像における欠陥の存在を取得するため、過検出を抑制することができる。
 同様に、第2欠陥取得工程S15における第4欠陥候補取得工程S152および欠陥候補限定工程S153を省略し、第2欠陥候補取得工程S151にて取得された第2欠陥候補領域を第2欠陥領域として取得してもよい。この場合においても、第2欠陥候補取得工程S151において第2欠陥候補領域のうち、第2マスク領域と所定条件以上重なるものを、第2欠陥候補から除外したうえで、第2欠陥候補領域に基づいて撮像画像における欠陥の存在を取得するため、過検出を抑制することができる。
 この場合において、欠陥検出装置1は、特に第3欠陥候補取得部551、第4欠陥候補取得部571、欠陥候補限定部581および591を設けず、第1欠陥候補取得部541が出力する第1欠陥候補データ921を第1欠陥データ931として取得してもよいし、第2欠陥候補取得部561が出力する第2欠陥候補データ922を第2欠陥データ932として取得してもよい。
 また、欠陥検出方法において、第1欠陥取得工程S14における第1マスク領域検出工程S1412および欠陥候補除外工程S1413を省略し、第1欠陥候補領域検出工程S1411にて取得された第1欠陥候補領域を第1欠陥候補領域として取得してもよい。すなわち、第1マスク領域による第1欠陥候補領域の限定を行わずに、第1欠陥候補データ921を取得してもよい。この場合においても、第1欠陥候補取得工程S141において検出された当該第1欠陥候補領域のうち、第3欠陥候補領域と所定条件以上重なる領域を、第1欠陥候補領域として維持し、当該第1欠陥候補領域に基づいて撮像画像における欠陥の存在を取得するため、過検出を抑制することができる。
 同様に、第2欠陥取得工程S15における第2マスク領域検出工程S1512および欠陥候補除外工程S1513を省略し、第2欠陥候補領域検出工程S1511にて取得された第2欠陥候補領域を第2欠陥領域として取得してもよい。すなわち、第2マスク領域による第2欠陥候補領域の限定を行わずに、第2欠陥候補データ922を取得してもよい。この場合においても、第2欠陥候補取得工程S151において第2欠陥候補領域のうち、第4欠陥候補領域と所定条件以上重なるものを、第2欠陥候補領域として維持し、当該第2欠陥候補領域に基づいて撮像画像における欠陥の存在を取得するため、過検出を抑制することができる。
 図24は、コンピュータ12がプログラム80に従って演算処理を実行することにより実現される機能の他の例を示す図である。図24において、撮像制御部51と、欠陥取得部52と、記憶部53とが、コンピュータ12が実現する機能に相当する。これらの機能の全部または一部は専用の電気回路により実現されてもよい。また、複数のコンピュータによりこれらの機能が実現されてもよい。
 図24の例の各構成要素は、欠陥取得部52を除いて図4と同様である。欠陥取得部52は、第1暗欠陥候補取得部621と、第2暗欠陥候補取得部622と、第1明欠陥候補取得部623と、第2明欠陥候補取得部624とを含む。なお、「暗欠陥」は、画像中に暗く現れる欠陥を意味する。「明欠陥」は、画像中に明るく現れる欠陥を意味する。図25は、第1暗欠陥候補取得部621の構成を示す図である。第1暗欠陥候補取得部621は、2つのフィルタ処理部631と、プリアライメント部632と、ゆすらせ比較部633と、2値化部634と、面積フィルタ部635とを含む。第1暗欠陥候補取得部621により、第1暗欠陥候補領域を示す画像データである第1暗欠陥候補データ951が取得される。第1暗欠陥候補領域は、撮像画像において参照画像に対して暗い領域である。
 図26は、第2暗欠陥候補取得部622の構成を示す図である。図26において、プリアライメント部632から上流側は、第1暗欠陥候補取得部621と共通である。第2暗欠陥候補取得部622は、プリアライメント部632から続いて、膨張処理部641と、収縮処理部642と、比較部643と、2値化部644と、面積フィルタ部645とを含む。第2暗欠陥候補取得部622により、第2暗欠陥候補領域を示す画像データである第2暗欠陥候補データ952が取得される。第2暗欠陥候補領域は、撮像画像において参照画像に対して暗い領域である。後述するように、第1暗欠陥候補領域を取得する手法は、第2暗欠陥候補領域を取得する手法とは異なる。
 図27は、第2明欠陥候補取得部624の構成を示す図である。図27において、プリアライメント部632から上流側は、第1暗欠陥候補取得部621と共通である。第2明欠陥候補取得部624は、プリアライメント部632から続いて、収縮処理部651と、膨張処理部652と、比較部653と、2値化部654と、面積フィルタ部655とを含む。第2明欠陥候補取得部624により、後述の明暗逆領域を示す画像データである明暗逆領域データ953が取得される。
 高速に処理を行う場合は、多数の第1暗欠陥候補取得部621、第2暗欠陥候補取得部622、第1明欠陥候補取得部623および第2明欠陥候補取得部624が欠陥取得部52に設けられ、複数の撮像画像に対して処理が並行して行われる。
 図28は、欠陥取得部52において、第1暗欠陥候補データ951および第2暗欠陥候補データ952から、暗欠陥候補領域を示す画像データである暗欠陥候補データ954を取得する構成を示す図である。この構成は、複数の論理積演算部661と、領域選択部662とを含む。図29は、欠陥取得部52において、明暗逆領域データ953を用いて暗欠陥候補データ954が示す暗欠陥候補領域を限定する構成を示す図である。この構成は、論理和演算部663と、候補限定部664とを含む。
 図30は、欠陥検出装置1の動作の流れを示す図である。図30におけるステップS11~S13は、図13のステップS11~S13と同様である。
 以下、表現を簡素化するために、画像データに対する処理を、単に画像に対する処理として表現する場合がある。また、1つの撮像部3に注目した処理のみを説明する。他の撮像部3に対しても同様の処理が行われる。欠陥検出装置1では、暗欠陥の存在と明欠陥の存在とを検出することができるが、以下の説明では、暗欠陥に注目して説明する。また、「暗欠陥候補領域」とは、画像中において欠陥の存在を示す候補として暗く現れる領域を指す。
 ステップS11~S13が実行された後、まず、1つの撮像画像が選択され、当該撮像画像に対応する参照画像が選択される。図25に示すように、第1暗欠陥候補取得部621では、撮像画像の撮像画像データ911および参照画像の参照画像データ912がそれぞれフィルタ処理部631に入力される。
 2つのフィルタ処理部631では、撮像画像および参照画像に対してメディアンフィルタやガウスフィルタ等のノイズを低減するフィルタ処理がそれぞれ行われる。フィルタ処理済みの撮像画像および参照画像は、プリアライメント部632に出力される。プリアライメント部632では、所定のパターンを利用したパターンマッチングにより、参照画像の撮像画像に対する相対的な位置および角度のずれ量が特定される。そして、両画像の間における位置および角度のずれ量だけ、参照画像を撮像画像に対して平行移動および回転することにより、参照画像のおよその位置および角度が撮像画像に合わせられる。これにより、両画像に対するプリアライメントが行われる。
 ゆすらせ比較部633では、参照画像をプリアライメント済みの位置から、上下左右に少しずつ移動しながら、撮像画像と参照画像との差異を示す評価値が求められる。評価値としては、例えば、両画像が重なる領域における画素の値の(符号付きの)差の絶対値の和が求められる。そして、評価値が最小となる位置における両画像の画素の値の符号付き差分を示す画像が取得される。符号付き差分画像は、所定の値にて二値化され、第1暗欠陥候補領域を示す第1暗欠陥候補画像が取得される。
 実際には、処理を簡素化するために、符号付き差分画像は求められない。具体的には、参照画像の各画素の値から撮像画像の対応する画素の値が減算され、値が負の場合に0とすることにより、差分画像の画素の値が求められる。予め正の値が準備されており、差分画像において当該正の値以上の値を有する画素により構成される領域が第1暗欠陥候補領域として取得される。一般的に表現すれば、第1撮像画像において第1参照画像よりも明度が低く、かつ、明度の差の絶対値が第1基準値以上である領域が第1暗欠陥候補領域として取得される。第1基準値は正の値である。さらに換言すれば、撮像画像において参照画像よりも明度が所定値以上低い領域が第1暗欠陥候補領域として取得される。画像がモノクロである場合は、画素値を明度と捉えてもよく、カラー画像の場合は、色成分毎の画素値に対して所定の演算を行うことにより求められる値が明度として扱われる。
 第1暗欠陥候補領域は、参照画像の各画素の値と撮像画像の対応する画素の値との比から求められてもよい。具体的には、参照画像の各画素の値を撮像画像の対応する画素の値で除算することにより、比画像の画素の値が求められる。予め1よりも大きい第1基準値が準備されており、比画像において第1基準値以上の値を有する画素により構成される領域が第1暗欠陥候補領域として取得される。もちろん、撮像画像の各画素の値を参照画像の対応する画素の値で除算することにより、比画像の画素の値が求められてもよい。この場合、比画像において1よりも小さい第1基準値以下の値を有する画素により構成される領域が第1暗欠陥候補領域として取得される。
 第1基準値は定数でなくてもよい。第1基準値は参照画像および/または撮像画像の明度または画素値の関数でもよい。第1基準値は、参照画像および撮像画像の明度または画素値の差および比を用いて定められてもよく、さらに他の演算が利用されてもよい。第1基準値が様々に定められてよい点は、後述の第2および第3基準値についても同様である。第1ないし第3基準値は同じ値である必要はなく、算出方法も異なってもよい。一般的に表現すれば、撮像画像において、明度が、参照画像の明度よりも低く、かつ、予め定められた条件を満たす値よりも低い領域が第1暗欠陥候補領域として取得される。「予め定められた条件」は、各撮像画像に対して個別に設定されてもよい。さらに、複数の「予め定められた条件」が、1つの撮像画像に用いられてもよい。例えば、撮像画像中のエッジのように、撮像毎に画素値が変化しやすい位置では、欠陥候補の領域として検出されにくいように第1基準値が設定されてよい。上記説明は、以下の第2暗欠陥候補領域、第1明欠陥候補領域領域、第2明欠陥候補領域に関しても同様である。
 図31Aは撮像画像811を例示する図である。図31Bは参照画像812を例示する図である。以下、対象物9の表面のうち、撮像画像に現れる領域を「対象領域70」と呼ぶ。撮像部3と対象領域70とは一対一に対応し、各撮像部3は常に同じ対象領域70の画像を取得する。図31Aおよび図31Bでは、対象領域70を楕円にて抽象的に示している。両画像の差分画像(または、比画像、以下同様)を2値化することにより、図31Cに示す第1暗欠陥候補領域751を示す第1暗欠陥候補画像851が取得される。上記処理により、対象領域70中にて参照画像812よりも撮像画像811の方が暗い領域であって所定の条件を満たす領域が第1暗欠陥候補領域751として取得される。本実施の形態では、第1暗欠陥候補領域751では画素の値は「1」であり、他の領域では画素の値は「0」である。
 第1暗欠陥候補領域751が取得されると、面積フィルタ部635により、面積が予め定められた値よりも小さい第1暗欠陥候補領域751が削除され、残りの第1暗欠陥候補領域751を示す画像が最終的な第1暗欠陥候補画像851(正確には、第1暗欠陥候補領域751を示す画像データである第1暗欠陥候補データ951)として取得される。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の第1暗欠陥候補画像851が取得される(ステップS54)。
 図26に示すように、第2暗欠陥候補取得部622では、プリアライメント部632から撮像画像データ911および参照画像データ912が膨張処理部641に入力され、撮像画像および参照画像に膨張処理が行われる。ここでの膨張処理は、多値画像における明るい領域を膨張させる処理である。これにより、小さな暗い領域が消滅する。撮像画像および参照画像のデータは、さらに収縮処理部642に入力され、撮像画像および参照画像に収縮処理が行われる。ここでの収縮処理は、多値画像における明るい領域を収縮させる処理である。これにより、明るい領域がほぼ元の大きさに戻される。その結果、元の撮像画像および参照画像において大きな暗い領域はほぼ元の状態が維持され、小さな暗い領域は消滅する。
 図32Aは、図31Aの撮像画像811に対して膨張および収縮処理を行った後の画像813を例示する図である。図32Bは、図31Bの参照画像812に対して膨張および収縮処理を行った後の画像814を例示する図である。いずれの画像においても、元の画像の小さな暗い領域が消滅する。比較部643はこれらの画像の差分画像データを生成する。差分画像は2値化部644にて第2基準値にて2値化される。差分画像を生成して2値化する処理は、ゆすらせを行わないという点を除いて図25のゆすらせ比較部633および2値化部634と同様である。また、差分画像ではなく比画像を用いてよい点も同様である。これにより、図32Cに示すように、対象領域70中にて参照画像812よりも撮像画像811の方が暗い領域であって所定の条件を満たす領域が第2暗欠陥候補領域752として取得される。本実施の形態では、第2暗欠陥候補領域752では画素の値は「1」であり、他の領域では画素の値は「0」である。
 第2暗欠陥候補領域752が取得されると、面積フィルタ部645により、面積が予め定められた値よりも小さい第2暗欠陥候補領域752が削除され、残りの第2暗欠陥候補領域752を示す画像が最終的な第2暗欠陥候補画像852(正確には、第2暗欠陥候補領域752を示す画像データである第2暗欠陥候補データ952)として取得される。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の第2暗欠陥候補画像852が取得される(ステップS55)。
 図28に示すように、同じ撮像画像および対応する参照画像から生成された第1暗欠陥候補データ951および第2暗欠陥候補データ952は、論理積演算部661に入力される。領域選択部662には、第1暗欠陥候補画像851と第2暗欠陥候補画像852との各組み合わせから得られる論理積画像のデータが入力される。各論理積画像は、第1暗欠陥候補領域と第2暗欠陥候補領域とから生成される暗欠陥候補領域を示す画像である。図33は、図31Cの第1暗欠陥候補領域751と図32Cの第2暗欠陥候補領域752とから生成される暗欠陥候補領域754を示す暗欠陥候補画像854を例示する図である。
 第1暗欠陥候補領域は、撮像画像と参照画像との位置合わせを行った後に、これらの画像の差分画像から得られるため、欠陥の存在を示す信頼性が高い。しかし、小さな第1暗欠陥候補領域は、ノイズ等の何らかの原因で生じた可能性がある。一方、第2暗欠陥候補領域752は、撮像画像および参照画像に対して小さな暗い領域を削除する微小領域除去処理を行った後に、これらの差分画像から得られるため、小さな偽欠陥を検出する可能性が低い。しかし、処理時間の都合上、正確な位置合わせを行っていないことによる偽欠陥を検出する虞がある。そこで、本実施の形態では、第1暗欠陥候補画像と第2暗欠陥候補画像との論理積画像を求めることにより、信頼性を向上した暗欠陥候補領域を示す暗欠陥候補画像を得ている。
 領域選択部662では、複数の暗欠陥候補画像を重ねた場合に、所定数以上の暗欠陥候補領域が重なる領域が暗欠陥候補領域として維持される。ここで、「重なる領域」は、重なる複数の領域の論理和であってもよく、論理積であってもよい。本実施の形態では重なる領域の数が2以上の場合に暗欠陥候補領域として維持される。領域選択部662により、暗欠陥候補領域を示す複数の暗欠陥候補画像から、限定された暗欠陥候補領域を示す1つの暗欠陥候補画像が取得される(ステップS56)。以上の処理により、複数の照明状態にて取得された複数の撮像画像から、対応する参照画像を参照しつつ参照画像に対して暗い領域が暗欠陥候補領域として取得される。
 領域選択部662により暗欠陥候補領域が限定されるため、実際には、論理積演算部661に代えて、論理和演算部を用いることも可能である。いずれの場合であっても、第1暗欠陥候補領域および第2暗欠陥候補領域に基づいて暗欠陥候補領域を取得することにより、暗欠陥候補領域の信頼性を向上することができる。暗欠陥候補領域として維持される場合の重なる領域の数は3以上でもよく、1以上でもよい。重なる領域の数が1以上に設定される場合は、全ての暗欠陥候補領域が維持され、領域選択部662は、単に複数の暗欠陥候補画像の論理和画像を1つの暗欠陥候補画像として生成する。
 一方、第2明欠陥候補取得部624では、図27に示すように、第2暗欠陥候補取得部622の場合に対して明暗を入れ替えた処理により、明暗逆領域を示す明暗逆領域画像のデータを取得する。
 具体的には、第2明欠陥候補取得部624では、プリアライメント部632から撮像画像データ911および参照画像データ912が収縮処理部651に入力され、撮像画像および参照画像に収縮処理が行われる。ここでの収縮処理は、多値画像における明るい領域を収縮させる処理であり、暗い領域に対する膨張処理でもある。これにより、小さな明るい領域が消滅する。撮像画像および参照画像のデータは、さらに膨張処理部652に入力され、撮像画像および参照画像に膨張処理が行われる。ここでの膨張処理は、多値画像における明るい領域を膨張させる処理であり、暗い領域を収縮させる処理でもある。これにより、暗い領域がほぼ元の大きさに戻される。その結果、元の撮像画像および参照画像において大きな明るい領域はほぼ元の状態が維持され、小さな明るい領域は消滅する。
 比較部653はこれらの画像の差分画像データを生成する。差分画像は2値化部654にて第3基準値にて2値化される。差分画像ではなく比画像が用いられてよい。本実施の形態では、明暗逆領域では画素の値は「1」であり、他の領域では画素の値は「0」である。
 明暗逆領域が取得されると、面積フィルタ部655により、面積が予め定められた値よりも小さい明暗逆領域が削除され、残りの明暗逆領域を示す画像が最終的な明暗逆領域画像(正確には、明暗逆領域を示す画像データである明暗逆領域データ953)として取得される。
 撮像部3にて取得された複数の撮像画像は、処理対象として順次選択され、撮像画像の数に等しい数の明暗逆領域画像が取得される(ステップS57)。以上の処理により、複数の照明状態にて取得された複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ当該参照画像に対して明るい領域が明暗逆領域として取得される。
 図29に示すように複数の明暗逆領域データ953は、論理和演算部663に入力され、明暗逆領域画像の論理和画像のデータが生成される。図34Aおよび図34Bは、明暗逆領域753を示す明暗逆領域画像853を例示する図である。図34Cはこれらの画像の論理和画像855を示す。明暗逆領域画像の実際の数は、1つの撮像部3にて取得される撮像画像の数以下であり、好ましくは2以上である。
 論理和画像のデータは、候補限定部664に入力される。候補限定部664では、暗欠陥候補領域のうち、論理和画像中のいずれの明暗逆領域とも重ならない暗欠陥候補領域が、欠陥候補から除外される。これにより、暗欠陥候補領域がさらに限定される。図35は、図33の暗欠陥候補画像854と、図34Cの論理和画像855とを重ねて示す図である。右の暗欠陥候補領域754は、明暗逆領域753と重なるため欠陥候補として維持される。左の暗欠陥候補領域754は、いずれの明暗逆領域753とも重ならないため欠陥候補から除外される(ステップS58)。
 なお、論理和画像を求めることなく、暗欠陥候補画像854を各明暗逆領域画像853と順次重ねて暗欠陥候補領域754と明暗逆領域753との重なりの有無が確認されてもよい。
 暗欠陥候補領域754と明暗逆領域753との予め定められた面積以上の重なりのみが、重なりの存在として検出されてもよい。この場合、明暗逆領域753との重なりが予め定められた面積未満の暗欠陥候補領域754が欠陥候補から除外される。また、暗欠陥候補領域754と明暗逆領域753との重なりが、暗欠陥候補領域754の面積に対して予め定められた割合未満の場合に、当該暗欠陥候補領域754が欠陥候補から除外されてもよい。このように、暗欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものが欠陥候補から除外される。換言すれば、暗欠陥候補領域のうち、いずれかの明暗逆領域と所定条件以上重なるものが暗欠陥候補として維持される。
 その後、必要に応じて所定面積以下の暗欠陥候補領域を削除する等の処理により、暗欠陥候補領域に基づいて最終的な暗欠陥領域が取得される。すなわち、暗欠陥の存在が取得される(ステップS59)。以上の処理により、1つの撮像部3から見た対象領域70において、欠陥が存在する場合の欠陥の位置が検出される。
 コンピュータ12の表示部には、1つの撮像画像が表示され、対象領域70上に、暗欠陥領域が表示される。
 対象物9の表面に凹状または凸状の欠陥が存在する場合、偏った光を照射すると撮像画像中に欠陥が明るく現れたり、暗く現れたりする。しかし、暗い領域のみを用いて欠陥を検出しようとすると、不要な油や塗料等による表面の汚れも欠陥として検出されてしまう。そこで、明暗逆領域画像を用いることにより、表面の色に起因する暗い領域をノイズとして除去し、欠陥の過検出が抑制される。特に、欠陥の存在による明暗の出現は複雑であるため、複数の明暗逆領域画像を用いることにより、欠陥候補から表面の色に起因するものを高い精度にて除くことができる。
 1つの撮像部3により取得される撮像画像の最小数は2であるが、好ましくは3以上である。すなわち、光照射部4は互いに異なる3以上の照明状態とすることができ、例えば、対象物9に3以上の方向から光を照射することができ、撮像制御部51の制御により、3以上の照明状態の間に撮像部3が画像を取得する。好ましい照明状態が既知の場合は、その情報に基づいて取得された3以上の撮像画像の少なくとも1つが処理対象の撮像画像として選択されてもよい。3以上の撮像画像を準備することにより、より適切な欠陥検出を容易に行うことができる。
 既述のように、欠陥検出装置1は、明欠陥を検出する機能も有する。明欠陥の検出では、暗欠陥の検出とは明暗を逆転させる点を除いてステップS54~S59と同様である。第1明欠陥候補取得部623の構成は、演算順序や基準値が異なるという点を除いて図25の第1暗欠陥候補取得部621と同様である。すなわち、第1明欠陥候補取得部623は、撮像画像と参照画像とを位置合わせした上で差分画像を求め、差分画像を2値化する。これにより、第1明欠陥候補領域を示す第1明欠陥候補画像を取得する。第2明欠陥候補取得部624は、撮像画像と参照画像とに収縮および膨張処理を行って差分画像を取得し、差分画像を2値化する。これにより、第2明欠陥候補領域を示す第2明欠陥候補画像を取得する。
 図28に示す構成により、複数組の第1明欠陥候補画像および第2明欠陥候補画像から明欠陥候補領域を示す明欠陥候補画像が生成される。一方、第2暗欠陥候補取得部622は、明暗逆領域取得部として機能し、第2暗欠陥候補画像を明暗逆領域画像として取得する。そして、複数の明暗逆領域画像の論理和画像が生成される。
 明欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものが欠陥候補から除外され、明欠陥候補領域が限定される。その後、明欠陥候補画像を用いて明欠陥の有無を示す明欠陥画像が生成される。上記処理により、明るい色の汚れ等により明欠陥が過検出されることが抑制される。
 暗欠陥領域と明欠陥領域とは、例えば、1つの撮像画像の上に異なる色が付いた領域としてディスプレイに表示される。
 暗欠陥の検出および明欠陥の検出が行われる場合、情報量の削減による処理速度向上の観点からは、暗欠陥候補領域を限定するために、明欠陥の検出に利用される第2明欠陥候補領域を明暗逆領域として利用することが好ましい。明欠陥候補領域を限定するために、暗欠陥の検出に利用される第2暗欠陥候補領域を明暗逆領域として利用することが好ましい。すなわち、暗欠陥候補領域および明欠陥候補領域の一方を取得する際の明暗逆領域を取得する工程が、暗欠陥候補領域および明欠陥候補領域の他方を取得する工程に含まれることが好ましい。しかし、演算時間が許容されるのであれば、明暗逆領域としてさらに好ましいものを利用することが考えられる。
 暗欠陥候補領域または明欠陥候補領域を求める際の2値化の閾値である基準値は、過検出を抑制しつつ検出漏れも抑制する最適な値に設定されている。一方、明暗逆領域は、汚れ等の表面の色やノイズ等に起因する偽欠陥の検出を抑制するために利用される。そのため、明暗逆領域を求める際の2値化の閾値である基準値は、明暗逆領域とすべきか疑わしいものまで明暗逆領域とする値に設定することにより、真欠陥が汚れ等として除外されることが抑制される。
 したがって、暗欠陥候補領域の取得の際に第2明欠陥候補取得部624で利用される基準値(上記説明における第3基準値)を、明欠陥候補領域の取得の際に第2明欠陥候補取得部624で利用される基準値よりも小さくすることにより、より精度の高い暗欠陥候補領域を得ることが可能となる。明欠陥候補領域を取得する場合においても、第2暗欠陥候補取得部622で利用される基準値を、暗欠陥候補領域の取得の際に第2暗欠陥候補取得部622で利用される基準値(上記説明における第2基準値)よりも小さくすることにより、より好ましい明欠陥候補領域を得ることが可能となる。
 このように、明暗逆領域を取得する際の2値化の基準値は、第2暗欠陥候補領域または第2明欠陥候補領域を取得する際の2値化の基準値と異なってよく、好ましくは、明暗逆領域を取得する際の2値化の基準値は、第2暗欠陥候補領域または第2明欠陥候補領域を取得する際の2値化の基準値よりも緩い。明暗逆領域の面積は、第2暗欠陥候補領域または第2明欠陥候補領域の面積よりも大きい。
 上記説明では、暗欠陥の検出と明欠陥の検出とを区別して説明したが、欠陥検出装置1における欠陥候補とは暗欠陥候補および明欠陥候補の一方または双方である。一般的には、上記説明における暗欠陥候補および明欠陥候補は「欠陥候補」と表現することができ、暗欠陥候補領域および明欠陥候補領域は「欠陥候補領域」と表現することができ、暗欠陥候補画像および明欠陥候補画像は「欠陥候補画像」と表現することができる。第1暗欠陥候補領域および第1明欠陥候補領域は「第1欠陥候補領域」と表現することができ、第2暗欠陥候補領域および第2明欠陥候補領域は「第2欠陥候補領域」と表現することができる。
 上記実施の形態では、欠陥取得部52は、欠陥検出に利用される撮像画像から、対応する参照画像を参照しつつ当該参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得する。また、欠陥取得部52は、欠陥検出に利用される撮像画像から、対応する参照画像を参照しつつ当該参照画像に対して暗い領域および明るい領域の他方を他の欠陥候補領域として取得する。そして、処理を効率よく行う場合は、上記欠陥候補領域に対応する明暗逆転領域が、上記他の欠陥候補領域を取得する際に取得される。また、処理効率にこだわらずに欠陥検出精度を向上する場合は、上記欠陥候補領域に対応する明暗逆転領域が、上記他の欠陥候補領域の取得における基準値とは異なる基準値を利用して取得される。
 上記実施の形態にて第1欠陥候補領域を取得する手法を第1の手法と表現し、第2欠陥候補領域を取得する方法を第2の手法と表現した場合、第1の手法と第2の手法とは互いに異なるのであれば、これらの手法として様々なものが利用可能である。これにより、過検出または検出漏れを効率よく抑制することができる。
 また、1つの手法のみで欠陥候補領域が求められてもよい。例えば、上記実施の形態にて第2欠陥候補領域を求めず、領域選択部662にて、複数の第1欠陥候補画像の第1欠陥候補領域のうち、所定数以上重なるものが欠陥候補領域として取得されてもよい。あるいは、上記実施の形態にて第1欠陥候補領域を求めず、領域選択部662にて、複数の第2欠陥候補画像の第2欠陥候補領域のうち、所定数以上重なるものが欠陥候補領域として取得されてもよい。
 上記実施の形態では、欠陥検出に利用される撮像画像は1つのみでもよい。明暗逆領域画像を取得する際に利用される撮像画像の数は好ましくは2以上である。撮像を効率よく行うためには、欠陥検出に利用される少なくとも1つの撮像画像は、明暗逆領域を取得するために複数の照明状態にて取得された複数の撮像画像に含まれることが好ましい。
 実質的に同じ処理が行われるのであれば、処理順序は適宜変更可能である。上記実施の形態にて説明した処理順序は一例にすぎない。例えば、第1暗欠陥候補領域を取得する工程と、第2暗欠陥候補領域を取得する工程と、明暗逆領域を取得する工程とは、任意の順序または並行して行われてよい。暗欠陥を検出する処理と明欠陥を検出する処理とは任意の順序または並行して行われてもよい。欠陥候補領域はそのまま欠陥領域として扱われてもよい。
 参照画像は、撮像画像から生成されてもよい。すなわち、いわゆる自己比較にて欠陥候補領域が取得されてもよい。例えば、撮像画像に対して明るい領域を膨張する処理を行ってから収縮する処理を行うことにより、暗い欠陥が消滅した参照画像が取得される。撮像画像に対して明るい領域を収縮する処理を行ってから膨張する処理を行うことにより、明るい欠陥が消滅した参照画像が取得される。
 上記欠陥検出装置1では様々な変形が可能である。
 光源部4a,4b,4cおよび撮像部3の配置および数は適宜変更されてよい。光照射部4による照明状態は様々に変更されてよい。複数の光源部のうち2つずつが点灯されてもよいし、3つずつが点灯されてもよい。光照射部4では光源部が移動することにより状明状態が変更されてもよい。
 コンピュータ12は、専用のハードウェアであってもよく、部分的に専用のハードウェアが用いられてもよい。高速に外観検査を行う場合は、コンピュータや専用のハードウェアによる並列処理が行われることが好ましい。
 実質的に同じ処理が行われるのであれば、処理順序は適宜変更可能である。上記実施の形態にて説明した処理順序は一例にすぎない。
 欠陥検出装置1は、パターンが形成される各種基板やフィルム等、他の対象物の表面における欠陥の検出に利用されてよい。欠陥検出装置1は、梨地状の領域(金属の表面には限定されない。)を表面に有することにより過検出が生じやすい対象物の検査に特に適している。
 上記実施の形態および各変形例における構成は、相互に矛盾しない限り適宜組み合わされてよい。
 発明を詳細に描写して説明したが、既述の説明は例示的であって限定的なものではない。したがって、本発明の範囲を逸脱しない限り、多数の変形や態様が可能であるといえる。
1 欠陥検出装置
2 保持部
3 撮像部(3a 上方撮像部、3b  斜方撮像部、3c 側方撮像部)
4 光照射部(4a 上方光源部、4b 斜方光源部、4c 側方光源部)
8 記録媒体
9 対象物
11 本体
12 コンピュータ
51 撮像制御部
52 欠陥取得部
53 記憶部
70 対象領域
80 プログラム
124 固定ディスク
125 ディスプレイ
126 入力部(126a キーボード、126b マウス)
127 読取装置
128 通信部
521 第1欠陥取得部
522 第2欠陥取得部
541 第1欠陥候補取得部
544 膨張処理部
545 収縮処理部
546 比較部
551 第3欠陥候補取得部
554 比較部
561 第2欠陥候補取得部
564 収縮処理部
565 膨張処理部
566 比較部
571 第4欠陥候補取得部
574 比較部
581 欠陥候補限定部
582,583 論理積演算部
584 領域選択部
591 欠陥候補限定部
592,593 論理積演算部
711 第1欠陥
721 第2欠陥
751  第1暗欠陥候補領域
752  第2暗欠陥候補領域
753  明暗逆領域
754  暗欠陥候補領域
811  撮像画像
812  参照画像
S12 撮像工程
S14 第1欠陥取得工程
S141  第1欠陥候補取得工程
S1411 第1欠陥候補領域検出工程
S1412 第1マスク領域検出工程
S1413 欠陥候補除外工程
S142  第3欠陥候補取得工程
S143  欠陥候補限定工程
S15 第2欠陥取得工程
S151  第2欠陥候補取得工程
S1511 第2欠陥候補領域検出工程
S1512 第2マスク領域検出工程
S1513 欠陥候補除外工程
S152  第3欠陥候補取得工程
S153  欠陥候補限定工程
S203、S213、S304、S314 膨張処理工程
S204、S214、S303、S313 収縮処理工程
S205、S215、S305、S315 比較処理工程
S54~S59  ステップ

Claims (18)

  1.  対象物の表面の欠陥を検出する欠陥検出装置であって、
     互いに異なる複数の偏った照明状態にて、対象物に光を照射することができる光照射部と、
     前記対象物の表面の対象領域の画像を撮像画像として取得する撮像部と、
     前記光照射部による照明状態と、前記撮像部による画像の取得とを制御する撮像制御部と、
     欠陥検出に利用される少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得し、複数の照明状態にて取得された複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を明暗逆領域として取得し、前記欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で、前記欠陥候補領域に基づいて欠陥の存在を取得する欠陥取得部と、
    を備える。
  2.  請求項1に記載の欠陥検出装置であって、
     欠陥検出に利用される前記少なくとも1つの撮像画像が、前記複数の照明状態にて取得された前記複数の撮像画像に含まれる。
  3.  請求項1または2に記載の欠陥検出装置であって、
     前記欠陥取得部が、欠陥検出に利用される前記少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を他の欠陥候補領域として取得し、前記欠陥候補領域に対応する前記明暗逆転領域が、前記他の欠陥候補領域を取得する際に取得される。
  4.  請求項1ないし3のいずれかに記載の欠陥検出装置であって、
     前記欠陥取得部が、欠陥検出に利用される前記少なくとも1つの撮像画像から、第1の手法にて第1欠陥候補領域を取得し、前記第1の手法とは異なる第2の手法にて第2欠陥候補領域を取得し、前記第1欠陥候補領域および前記第2欠陥候補領域に基づいて前記欠陥候補領域を取得する。
  5.  請求項4に記載の欠陥検出装置であって、
     前記第1の手法が、撮像画像と参照画像との位置合わせを行った後に、これらの画像の差分画像から前記第1欠陥候補領域を取得する手法であり、
     前記第2の手法が、撮像画像および参照画像に対して微小領域除去処理を行った後にこれらの画像の差分画像から前記第2欠陥候補領域を取得する手法である。
  6.  対象物の表面の欠陥を検出する欠陥検出方法であって、
     a)互いに異なる複数の偏った照明状態のそれぞれにて対象物に光が照射されている間に、撮像部により前記対象物の表面の対象領域の画像を取得することにより、複数の撮像画像を取得する工程と、
     b)欠陥検出に利用される少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得する工程と、
     c)複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を明暗逆領域として取得する工程と、
     d)前記欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で、前記欠陥候補領域に基づいて欠陥の存在を取得する工程と、
    を備える。
  7.  請求項6に記載の欠陥検出方法であって、
     欠陥検出に利用される前記少なくとも1つの撮像画像が、前記複数の照明状態にて取得された前記複数の撮像画像に含まれる。
  8.  請求項6または7に記載の欠陥検出方法であって、
     e)欠陥検出に利用される前記少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を他の欠陥候補領域として取得する工程をさらに備え、
     前記c)工程が、前記e)工程に含まれる。
  9.  コンピュータに、対象物の表面の対象領域の複数の画像から前記対象領域における欠陥を検出させるプログラムであって、前記プログラムの前記コンピュータによる実行は、前記プログラムに、
     a)互いに異なる複数の偏った照明状態において取得された前記対象領域の複数の撮像画像および対応する複数の参照画像を準備する工程と、
     b)欠陥検出に利用される少なくとも1つの撮像画像から、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の一方を欠陥候補領域として取得する工程と、
     c)複数の撮像画像のそれぞれから、対応する参照画像を参照しつつ前記参照画像に対して暗い領域および明るい領域の他方を明暗逆領域として取得する工程と、
     d)前記欠陥候補領域のうち、いずれの明暗逆領域とも所定条件以上重ならないものを欠陥候補から除外した上で、前記欠陥候補領域に基づいて欠陥の存在を取得する工程と、
    を実行させる。
  10.  対象物の表面の欠陥を検出する欠陥検出装置であって、
     対象物を撮像して撮像画像を取得する撮像部と、
     前記撮像画像に対応する参照画像を記憶する記憶部と、
     前記撮像画像における欠陥の存在を取得する欠陥取得部と、
    を備え、
     前記欠陥取得部は、
     前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較欠陥候補領域を取得する自己比較欠陥候補取得部と、
     前記撮像画像と前記参照画像との位置合わせを行った後に、前記一方処理が膨張処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を他画像比較欠陥候補領域として取得し、前記一方処理が収縮処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を前記他画像比較欠陥候補領域として取得する他画像比較欠陥候補取得部と、
     前記自己比較欠陥候補取得部から出力される前記自己比較欠陥候補領域と、前記他画像比較欠陥候補取得部から出力される前記他画像比較欠陥候補領域とが重なる領域を、欠陥候補領域として取得する、欠陥候補限定部と、
    を有する。
  11.  請求項10に記載の欠陥検出装置であって、
     前記自己比較欠陥候補取得部は、
     前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較マスク領域をさらに検出し、
     前記自己比較欠陥候補領域のうち、前記自己比較マスク領域と重なる領域を、前記自己比較欠陥候補領域から除外したうえで、前記自己比較欠陥候補領域を前記欠陥候補限定部に出力する。
  12.  対象物の表面の欠陥を検出する欠陥検出方法であって、
     a)撮像部にて対象物を撮像して撮像画像を取得する撮像工程と、
     b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較欠陥候補領域を取得する自己比較欠陥候補取得工程と、
     c)前記撮像画像に対応する参照画像が準備されており、前記撮像画像と前記参照画像との位置合わせを行った後に、前記一方処理が膨張処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を他画像比較欠陥候補領域として取得し、前記一方処理が収縮処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を前記他画像比較欠陥候補領域として取得する他画像比較欠陥候補取得工程と、
     d)前記自己比較欠陥候補取得工程により取得される前記自己比較欠陥候補領域と、前記他画像比較欠陥候補取得工程により取得される前記他画像比較欠陥候補領域とが重なる領域を、欠陥候補領域として取得する、欠陥候補限定工程と、
    を備える。
  13.  コンピュータに、対象物の表面の対象領域の複数の画像から前記対象領域における欠陥を検出させるプログラムであって、前記プログラムの前記コンピュータによる実行は、前記プログラムに、
     a)前記対象領域を撮像して取得される撮像画像および対応する参照画像を準備する工程と、
     b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、自己比較欠陥候補領域を取得する自己比較欠陥候補取得工程と、
     c)前記撮像画像と前記参照画像との位置合わせを行った後に、前記一方処理が膨張処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を他画像比較欠陥候補領域として取得し、前記一方処理が収縮処理である場合には、これらの画像の差分画像または比画像の少なくとも一方に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を前記他画像比較欠陥候補領域として取得する他画像比較欠陥候補取得工程と、
     d)前記自己比較欠陥候補取得工程により取得される前記自己比較欠陥候補領域と、前記他画像比較欠陥候補取得工程により取得される前記他画像比較欠陥候補領域とが重なる領域を、欠陥候補領域として取得する、欠陥候補限定工程と、
    を実行させる。
  14.  対象物の表面の欠陥を検出する欠陥検出装置であって、
     対象物を撮像して撮像画像を取得する撮像部と、
     前記撮像画像に対応する参照画像を記憶する記憶部と、
     前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、欠陥候補領域を検出し、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、マスク領域を検出し、前記欠陥候補領域のうち、前記マスク領域と重なる領域を、欠陥候補から除外したうえで、前記欠陥候補領域に基づいて前記撮像画像における欠陥の存在を取得する欠陥取得部と、
    を備える。
  15.  請求項14に記載の欠陥検出装置であって、
     欠陥取得部は、前記撮像画像における第1欠陥および当該第1欠陥とは異なる第2欠陥の存在を取得し、
     前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理を施した後に収縮処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第1欠陥候補領域を検出し、前記参照画像の各画素の値と、前記参照画像に対し、膨張処理を施した後に収縮処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第1マスク領域を検出し、前記第1欠陥候補領域のうち、前記第1マスク領域と重なる領域を、第1欠陥候補から除外したうえで、前記第1欠陥候補領域に基づいて前記撮像画像における第1欠陥の存在を取得する第1欠陥取得部と、
     前記撮像画像の各画素の値と、前記撮像画像に対し、収縮処理を施した後に膨張処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第2欠陥候補領域を検出し、前記参照画像の各画素の値と、前記参照画像に対し、収縮処理を施した後に膨張処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、第2マスク領域を検出し、前記第2欠陥候補領域のうち、前記第2マスク領域と重なる領域を、第2欠陥候補から除外したうえで、前記第2欠陥候補領域に基づいて前記撮像画像における第2欠陥の存在を取得する第2欠陥取得部と、
    を有する。
  16.  請求項15に記載の欠陥検出装置であって、
     前記第1欠陥取得部は、前記撮像画像と前記参照画像との位置合わせを行った後に、これらの画像の差分画像に基づいて前記参照画像に対して前記撮像画像の方が暗い領域を第3欠陥候補領域として取得し、前記第1欠陥候補領域のうち、前記第3欠陥候補領域と重ならない領域を、第1欠陥候補から除外したうえで、前記第1欠陥候補領域に基づいて前記撮像画像における第1欠陥の存在を取得し、
     前記第2欠陥取得部は、前記撮像画像と前記参照画像との位置合わせを行った後に、これらの画像の差分画像に基づいて前記参照画像に対して前記撮像画像の方が明るい領域を第4欠陥候補領域として取得し、前記第2欠陥候補領域のうち、前記第4欠陥候補領域と重ならない領域を、第2欠陥候補から除外したうえで、前記第2欠陥候補領域に基づいて前記撮像画像における第2欠陥の存在を取得する。
  17.  対象物の表面の欠陥を検出する欠陥検出方法であって、
     a)撮像部にて対象物を撮像して撮像画像を取得する撮像工程と、
     b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、欠陥候補領域を検出する欠陥候補領域検出工程と、
     c)前記撮像画像に対応する参照画像が準備されており、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、マスク領域を検出するマスク領域検出工程と、
     d)前記欠陥候補領域のうち、前記マスク領域と重なる領域を、欠陥候補から除外したうえで、前記欠陥候補領域に基づいて前記撮像画像における欠陥の存在を取得する欠陥候補除外工程と、
    を備える。
  18.  コンピュータに、対象物の表面の対象領域の複数の画像から前記対象領域における欠陥を検出させるプログラムであって、前記プログラムの前記コンピュータによる実行は、前記プログラムに、
     a)前記対象領域を撮像して取得される撮像画像および対応する参照画像を準備する工程と、
     b)前記撮像画像の各画素の値と、前記撮像画像に対し、膨張処理および収縮処理のうち一方処理を施し、さらに膨張処理および収縮処理のうち前記一方処理とは異なる他方処理を施して得られる画像の前記撮像画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、欠陥候補領域を検出する欠陥候補領域検出工程と、
     c)前記撮像画像に対応する参照画像が準備されており、前記参照画像の各画素の値と、前記参照画像に対し、前記一方処理を施し、さらに前記他方処理を施して得られる画像の前記参照画像に対応する画素の値と、の差または比の少なくとも一方に基づいて、マスク領域を検出するマスク領域検出工程と、
     d)前記欠陥候補領域のうち、前記マスク領域と重なる領域を、欠陥候補から除外したうえで、前記欠陥候補領域に基づいて前記撮像画像における欠陥の存在を取得する欠陥候補除外工程と、
    を実行させる。
PCT/JP2017/001604 2016-02-19 2017-01-18 欠陥検出装置、欠陥検出方法およびプログラム WO2017141611A1 (ja)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP17752875.9A EP3418726A4 (en) 2016-02-19 2017-01-18 DEFECT DETECTION DEVICE, DEFECT DETECTION METHOD AND PROGRAM
US15/998,664 US11216936B2 (en) 2016-02-19 2017-01-18 Defect detection device, defect detection method, and program
US17/536,290 US20220084183A1 (en) 2016-02-19 2021-11-29 Defect detection device, defect detection method, and program

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
JP2016029422A JP6688629B2 (ja) 2016-02-19 2016-02-19 欠陥検出装置、欠陥検出方法およびプログラム
JP2016-029422 2016-02-19
JP2016052074A JP6811540B2 (ja) 2016-03-16 2016-03-16 欠陥検出装置、欠陥検出方法およびプログラム
JP2016-052075 2016-03-16
JP2016052075A JP6812118B2 (ja) 2016-03-16 2016-03-16 欠陥検出装置、欠陥検出方法およびプログラム
JP2016-052074 2016-03-16

Related Child Applications (2)

Application Number Title Priority Date Filing Date
US15/998,664 A-371-Of-International US11216936B2 (en) 2016-02-19 2017-01-18 Defect detection device, defect detection method, and program
US17/536,290 Continuation US20220084183A1 (en) 2016-02-19 2021-11-29 Defect detection device, defect detection method, and program

Publications (1)

Publication Number Publication Date
WO2017141611A1 true WO2017141611A1 (ja) 2017-08-24

Family

ID=59624994

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2017/001604 WO2017141611A1 (ja) 2016-02-19 2017-01-18 欠陥検出装置、欠陥検出方法およびプログラム

Country Status (4)

Country Link
US (2) US11216936B2 (ja)
EP (1) EP3418726A4 (ja)
TW (1) TWI626440B (ja)
WO (1) WO2017141611A1 (ja)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021054059A1 (ja) * 2019-09-20 2021-03-25 株式会社Screenホールディングス 撮像装置
CN116071363A (zh) * 2023-03-27 2023-05-05 山东中济鲁源机械有限公司 一种自动化型钢智能生产监测系统

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6671309B2 (ja) * 2017-03-13 2020-03-25 株式会社Screenホールディングス 検査装置および検査方法
JP6874864B2 (ja) * 2018-01-29 2021-05-19 日本電気株式会社 画像処理装置、画像処理方法及びプログラム
US10957035B2 (en) * 2018-11-30 2021-03-23 Kla Corporation Defect classification by fitting optical signals to a point-spread function
WO2020188730A1 (ja) * 2019-03-19 2020-09-24 日本電気株式会社 検品装置、検品方法、及び非一時的なコンピュータ可読媒体
JP2020153730A (ja) * 2019-03-19 2020-09-24 株式会社豊田中央研究所 摩耗量計測装置および摩耗量計測方法
US11948292B2 (en) 2019-07-02 2024-04-02 MakinaRocks Co., Ltd. Systems and methods for detecting flaws on panels using images of the panels
JP7264751B2 (ja) * 2019-07-08 2023-04-25 株式会社ニューフレアテクノロジー 検査装置及び検査方法
JP2022103691A (ja) * 2020-12-28 2022-07-08 京セラドキュメントソリューションズ株式会社 画像処理装置、画像処理方法、および画像処理プログラム
JP2022103690A (ja) * 2020-12-28 2022-07-08 京セラドキュメントソリューションズ株式会社 画像処理装置、画像処理方法、および画像処理プログラム
CN115641337B (zh) * 2022-12-23 2023-04-07 中科慧远视觉技术(北京)有限公司 一种线状缺陷检测方法、装置、介质、设备及系统
CN115690102B (zh) * 2022-12-29 2023-04-18 摩尔线程智能科技(北京)有限责任公司 缺陷检测方法、装置、电子设备、存储介质和程序产品
TWI833534B (zh) * 2022-12-30 2024-02-21 致茂電子股份有限公司 晶圓研磨製程之缺陷檢測系統及方法
CN116958125B (zh) * 2023-09-18 2023-12-26 惠州市鑫晖源科技有限公司 基于图像处理的电竞主机电源元件缺陷视觉检测方法
CN117871415A (zh) * 2024-03-11 2024-04-12 天津大学四川创新研究院 一种基于平行光源的曝光式结构性瑕疵检测系统和方法

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62140009A (ja) 1985-12-13 1987-06-23 Dainippon Screen Mfg Co Ltd パタ−ン欠陥検出方法およびその装置
JPS63124945A (ja) * 1986-11-14 1988-05-28 Oki Electric Ind Co Ltd パタ−ン欠陥検出方法
JPH02156144A (ja) 1988-12-08 1990-06-15 Mitsubishi Rayon Co Ltd シート状物の欠陥検査装置
JPH04319649A (ja) * 1991-04-19 1992-11-10 Matsushita Electric Ind Co Ltd スルーホール検査装置
JP2001041900A (ja) * 1997-11-07 2001-02-16 Yuki Gijutsu Sogo:Kk シート包装検査装置
JP2002116153A (ja) 2000-10-11 2002-04-19 Koyo Seiko Co Ltd 外観検査装置
JP2002250700A (ja) * 2001-02-23 2002-09-06 Matsushita Electric Works Ltd パターン検査方法およびその装置
JP2005037203A (ja) 2003-07-18 2005-02-10 Seiwa Electric Mfg Co Ltd 棒状物体の検査装置及び検査方法
JP2012027810A (ja) * 2010-07-27 2012-02-09 National Printing Bureau 機能性検査装置
JP2012112915A (ja) * 2010-11-29 2012-06-14 Hitachi High-Technologies Corp 欠陥検査方法および欠陥検査装置
WO2014034526A1 (ja) * 2012-08-28 2014-03-06 住友化学株式会社 欠陥検査装置および欠陥検査方法
JP2015137921A (ja) 2014-01-22 2015-07-30 大日本印刷株式会社 外観検査装置、外観検査方法、およびプログラム
JP2015161622A (ja) * 2014-02-28 2015-09-07 大日本印刷株式会社 外観検査装置、外観検査方法、およびプログラム

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6356761A (ja) 1986-08-28 1988-03-11 Toshiba Corp 形状検査装置
JPS6441977A (en) 1987-08-07 1989-02-14 Hitachi Ltd Flaw detecting method
JPH0833342B2 (ja) 1988-11-15 1996-03-29 日産自動車株式会社 金属組識の検査方法
US5214712A (en) 1990-09-11 1993-05-25 Matsushita Electric Industrial Co., Ltd. Pattern inspection system for inspecting defect of land pattern for through-hole on printed board
US5848189A (en) * 1996-03-25 1998-12-08 Focus Automation Systems Inc. Method, apparatus and system for verification of patterns
WO1998058241A1 (fr) 1997-06-17 1998-12-23 Yuki Engineering System, Ltd Dispositif de controle de conditionnement feuille
US6396945B1 (en) 1997-12-25 2002-05-28 Nec Corporation Image defect detection apparatus and method
JP3344338B2 (ja) 1997-12-25 2002-11-11 日本電気株式会社 画像の欠陥検出装置及びその欠陥検出方法
JPH11224892A (ja) 1998-02-05 1999-08-17 Nippon Inter Connection Systems Kk テープキャリアの欠陥検出装置および欠陥検出方法
JP2002140695A (ja) 2000-11-01 2002-05-17 Omron Corp 検査方法およびその装置
US7065239B2 (en) * 2001-10-24 2006-06-20 Applied Materials, Inc. Automated repetitive array microstructure defect inspection
JP2007310162A (ja) 2006-05-18 2007-11-29 Lasertec Corp 検査装置及び検査方法とその検査方法を用いたパターン基板の製造方法
JP2010223621A (ja) 2009-03-19 2010-10-07 Sumitomo Metal Ind Ltd 管状品の内表面検査方法
JP2013242256A (ja) 2012-05-22 2013-12-05 Ricoh Elemex Corp 検査データ取得方法及び外観検査装置
US8977035B2 (en) * 2012-06-13 2015-03-10 Applied Materials Israel, Ltd. System, method and computer program product for detection of defects within inspection images
JP6119663B2 (ja) 2014-04-25 2017-04-26 Jfeスチール株式会社 表面欠陥検出方法及び表面欠陥検出装置
US10180401B2 (en) 2013-12-27 2019-01-15 Jfe Steel Corporation Surface defect detecting method and surface defect detecting apparatus
TWI495867B (zh) 2014-07-22 2015-08-11 Machvision Inc Application of repeated exposure to multiple exposure image blending detection method

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62140009A (ja) 1985-12-13 1987-06-23 Dainippon Screen Mfg Co Ltd パタ−ン欠陥検出方法およびその装置
JPS63124945A (ja) * 1986-11-14 1988-05-28 Oki Electric Ind Co Ltd パタ−ン欠陥検出方法
JPH02156144A (ja) 1988-12-08 1990-06-15 Mitsubishi Rayon Co Ltd シート状物の欠陥検査装置
JPH04319649A (ja) * 1991-04-19 1992-11-10 Matsushita Electric Ind Co Ltd スルーホール検査装置
JP2001041900A (ja) * 1997-11-07 2001-02-16 Yuki Gijutsu Sogo:Kk シート包装検査装置
JP2002116153A (ja) 2000-10-11 2002-04-19 Koyo Seiko Co Ltd 外観検査装置
JP2002250700A (ja) * 2001-02-23 2002-09-06 Matsushita Electric Works Ltd パターン検査方法およびその装置
JP2005037203A (ja) 2003-07-18 2005-02-10 Seiwa Electric Mfg Co Ltd 棒状物体の検査装置及び検査方法
JP2012027810A (ja) * 2010-07-27 2012-02-09 National Printing Bureau 機能性検査装置
JP2012112915A (ja) * 2010-11-29 2012-06-14 Hitachi High-Technologies Corp 欠陥検査方法および欠陥検査装置
WO2014034526A1 (ja) * 2012-08-28 2014-03-06 住友化学株式会社 欠陥検査装置および欠陥検査方法
JP2015137921A (ja) 2014-01-22 2015-07-30 大日本印刷株式会社 外観検査装置、外観検査方法、およびプログラム
JP2015161622A (ja) * 2014-02-28 2015-09-07 大日本印刷株式会社 外観検査装置、外観検査方法、およびプログラム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3418726A4

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021054059A1 (ja) * 2019-09-20 2021-03-25 株式会社Screenホールディングス 撮像装置
CN116071363A (zh) * 2023-03-27 2023-05-05 山东中济鲁源机械有限公司 一种自动化型钢智能生产监测系统
CN116071363B (zh) * 2023-03-27 2023-06-16 山东中济鲁源机械有限公司 一种自动化型钢智能生产监测系统

Also Published As

Publication number Publication date
TW201734442A (zh) 2017-10-01
TWI626440B (zh) 2018-06-11
US11216936B2 (en) 2022-01-04
US20210027440A1 (en) 2021-01-28
EP3418726A1 (en) 2018-12-26
US20220084183A1 (en) 2022-03-17
EP3418726A4 (en) 2019-03-20

Similar Documents

Publication Publication Date Title
WO2017141611A1 (ja) 欠陥検出装置、欠陥検出方法およびプログラム
TWI598581B (zh) 檢查裝置及檢查方法
JP6370177B2 (ja) 検査装置および検査方法
KR101832081B1 (ko) 표면 결함 검출 방법 및 표면 결함 검출 장치
JP6531184B2 (ja) 欠陥検出装置および欠陥検出方法
JP4739044B2 (ja) 外観検査装置
JP6812118B2 (ja) 欠陥検出装置、欠陥検出方法およびプログラム
EP3447725B1 (en) Apparatus for inspecting appearance of article and method for inspecting appearance of article using same
JP6811540B2 (ja) 欠陥検出装置、欠陥検出方法およびプログラム
CN111833350A (zh) 机器视觉检测方法与系统
JP4216485B2 (ja) パターン検査方法およびその装置
JP6688629B2 (ja) 欠陥検出装置、欠陥検出方法およびプログラム
JP4967132B2 (ja) 対象物表面の欠陥検査方法
JP2006138768A (ja) 印刷物の検査方法
JP2005128635A (ja) 画像処理装置
JP2016217877A (ja) 欠損検査装置、及び欠損検査方法

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: 17752875

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2017752875

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2017752875

Country of ref document: EP

Effective date: 20180919