Inspection device, inspection method, and program
Patent Information
- Application Number
- PCT/JP2025/008275
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-07
- Filing Date
- 2025-03-06
- Publication Date
- 2025-10-02
AI Technical Summary
Existing inspection methods require significant user effort to prepare a template image free from defects, as users must visually inspect and replace images with defects, which is time-consuming and prone to errors.
An inspection device and method that generates a template image by identifying and excluding defective pixels from multiple original images based on user-designated defect areas, using pixel clusters with specific criteria to ensure accuracy and reduce manual effort.
Reduces the effort required to prepare a template image by automating the exclusion of defects, improving inspection accuracy and efficiency by minimizing the impact of user errors.
Smart Images

Figure JP2025008275_02102025_PF_FP_ABST
Abstract
Description
Inspection device, inspection method, and program
[0001] The present disclosure relates to an inspection device, an inspection method, and a program.
[0002] Conventionally, techniques have been developed for inspecting whether or not an object has defects based on an inspection image showing the object. For example, Japanese Patent Laid-Open Publication No. 2022-131467 (Patent Document 1) discloses an inspection device that compares an image showing a non-defective label (hereinafter referred to as a "template image") with an inspection image showing the label to be inspected to determine whether the label to be inspected is non-defective. The template image is registered in advance. Japanese Patent Laid-Open Publication No. 2015-175706 (Patent Document 2) discloses registering an image obtained by averaging a predetermined number of images as a template image.
[0003] JP 2022-131467 A JP 2015-175706 A
[0004] If a template image contains a defect, the defective object may be determined to be a non-defective product. Therefore, the user must prepare a template image that does not contain any defects. For example, when generating a template image from a predetermined number of images, as in the technology disclosed in Patent Document 2, the user visually inspects all of the predetermined number of images. If some of the images contain defects, the user must prepare new images that show non-defective products and replace the images containing defects with the newly prepared images. The user must also visually inspect the newly prepared images. For example, when inspecting labels as disclosed in Patent Document 1, the user must prepare new images that do not have ink in unintended locations due to ink splatter or other causes.
[0005] The present disclosure has been made in consideration of the above circumstances, and its purpose is to provide an inspection device, an inspection method, and a program that can reduce the effort required to prepare a template image.
[0006] An inspection device according to one aspect of the present disclosure inspects an object for defects based on an inspection image depicting the object. The inspection device includes a generation unit that generates a template image depicting a non-defective product, and a determination unit that determines whether each pixel in the inspection image is a defective pixel or a non-defective pixel based on a comparison result between the inspection image and the template image. The generation unit identifies, for each pixel, a set of pixel values of multiple original images that are the basis for the template image. In response to receiving designation of a specific region in a specific original image among the multiple original images, the generation unit invalidates elements corresponding to one or more pixels and validates elements that do not correspond to one or more pixels in the set corresponding to each of the pixels included in the specific region. The generation unit generates the template image so that each pixel has a representative value of the set corresponding to each pixel.
[0007] According to this disclosure, if a specific original image among multiple original images contains a defect, the user simply designates the area containing the defect as the specific area. This prevents the defect in the specific original image from affecting the template image. The user does not need to prepare a new original image to replace the specific original image. This reduces the effort required to prepare a template image.
[0008] In the above disclosure, the generation unit presents pixel clusters in a target original image among the plurality of original images that have different characteristics as candidates for a specific region compared to the remaining original images other than the target original image among the plurality of original images.
[0009] According to this disclosure, the user can easily specify a specific area by checking the candidates.
[0010] In the above disclosure, the pixel block includes a first pixel of interest that satisfies a first condition, which is that a difference between the value of the first pixel of interest and a representative value of the values of pixels corresponding to the first pixel of interest in a plurality of original images exceeds a first threshold.
[0011] According to this disclosure, a pixel having a value significantly different from a representative value obtained from multiple original images is identified as a first pixel of interest. The first pixel of interest is likely to be a defective pixel. Therefore, the inspection device can present pixel clusters that are likely to contain defective pixels as candidates.
[0012] In the above disclosure, the pixel block includes a second pixel of interest that satisfies a second condition, which is that in a difference image between the original image of interest and a composite image obtained by combining a plurality of original images, the difference in value between the pixel corresponding to the second pixel of interest and its surrounding pixels exceeds a second threshold value.
[0013] According to this disclosure, a pixel having edge characteristics in the differential image is identified as a second pixel of interest. The second pixel of interest is likely to be a defective pixel. Therefore, the inspection device can present pixel clusters that are likely to include defective pixels as candidates.
[0014] In the above disclosure, the pixel block further includes a third pixel of interest that satisfies a third condition, where a feature quantity representing a variation in values of pixels corresponding to the third pixel of interest in the plurality of original images exceeds a third threshold.
[0015] According to this disclosure, a pixel with a large variation in brightness among multiple original images is identified as a third pixel of interest. A pixel with a large variation in brightness among multiple original images is likely to indicate a defect in one of the original images. Therefore, the generation unit can narrow down pixel clusters that include the third pixel of interest and then identify pixel clusters that include the first pixel of interest or the second pixel of interest as candidates. This allows the inspection device to present areas that are more likely to include defects as candidates.
[0016] In the above disclosure, the generation unit presents an enlarged image of the candidate in response to a user input, allowing the user to easily check the details of the candidate.
[0017] In the above disclosure, the generator, in response to user input, presents an enlarged image of a region corresponding to a candidate in one of the remaining original images.
[0018] According to this disclosure, the user can easily confirm the differences between the candidate in the target original image and the corresponding areas in the remaining original images.
[0019] In the above disclosure, the generating unit outputs an error notification in response to the presence of at least one pixel designated as a specific region in all of the plurality of original images.
[0020] According to this disclosure, the user can consider adding a new original image or the like in response to the error notification.
[0021] An inspection method according to one aspect of the present disclosure inspects an object for defects based on an inspection image depicting the object. The inspection method includes generating a template image depicting a non-defective product and determining whether each pixel in the inspection image is a defective pixel or a non-defective pixel based on a comparison result between the inspection image and the template image. The generating step includes identifying, for each pixel, a set of pixel values of multiple original images from which the template image is derived. The generating step includes, in response to a designation of a specific region in a specific original image among the multiple original images, invalidating elements corresponding to one or more pixels in a set corresponding to each of one or more pixels included in the specific region and validating elements that do not correspond to the one or more pixels. The generating step further includes generating the template image so that each pixel has a representative value of the set corresponding to each pixel.
[0022] A program according to one aspect of the present disclosure causes a computer to execute the above-described inspection method. These disclosures also enable the inspection method and program to reduce the effort required to prepare a template image.
[0023] The inspection device, inspection method, and program according to the present disclosure can reduce the effort required to prepare a template image.
[0024] 2 is a diagram showing an example of a system including an inspection device according to an embodiment; FIG. 3 is a flowchart showing an example of a processing flow of the inspection device; FIG. 4 is a diagram showing an example of a processing of step S12 shown in FIG. 2; FIG. 5 is a diagram showing an example of a specific original image; FIG. 6 is a diagram showing an example of a processing of step S13 shown in FIG. 2; FIG. 7 is a diagram showing an example of a processing of step S14 shown in FIG. 2; FIG. 8 is a schematic diagram showing an example of a hardware configuration of an inspection device; and FIG. 9 is a diagram showing an example of a presentation of specific region candidates.
[0025] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The present invention will be described in detail with reference to the accompanying drawings, in which the same or corresponding parts in the drawings are designated by the same reference numerals and the description thereof will not be repeated.
[0026] <Application Example> One application example of the present invention will be described with reference to FIGS. 1 to 6. FIG. 1 is a diagram showing an example of a system including an inspection device according to an embodiment. The system 1 shown in FIG. 1 includes an inspection device 100, a label printer 200, a camera 300, and a programmable logic controller (PLC) 400. The system 1 is responsible for inspection on a line 4 that affixes labels 2 printed by the label printer 200 to packaging boxes 3. The camera 300 photographs the labels 2 affixed to the packaging boxes 3 and passes the inspection image obtained to the inspection device 100. The labels 2 are an example of an "object" in this disclosure.
[0027] The inspection device 100 inspects whether or not there is a defect in the label 2 based on the inspection image showing the label 2. Defects include, for example, ink splatter, bleeding, smearing, color misalignment, etc. The inspection device 100 outputs the inspection result to the PLC 400. The inspection result indicates whether or not there is a defect in the label 2.
[0028] If the inspection result indicates "no defects," the PLC 400 determines that the label 2 is a non-defective product and controls line 4 to ship the packaging box 3. If the inspection result indicates "defective," the PLC 400 determines that the label 2 is a defective product and controls line 4 to eject the packaging box 3.
[0029] The inspection device 100 includes, as components related to the inspection process based on the inspection image, a generation unit 11 and a determination unit 12. The generation unit 11 operates in a preparation phase of the inspection process based on the inspection image. The determination unit 12 operates in an operation phase of the inspection process based on the inspection image.
[0030] The details of the processing of the inspection device 100 will be described with reference to Figures 2 to 6. Figure 2 is a flowchart showing an example of the processing flow of the inspection device. As shown in Figure 2, first, in step S1, which is a preparation phase, the generation unit 11 of the inspection device 100 generates a template image showing a non-defective product.
[0031] In step S2, which is the next operational phase, the determination unit 12 of the inspection device 100 determines whether each pixel in the inspection image, which shows the label 2 to be inspected, is a defective pixel or a non-defective pixel, based on the comparison result between the inspection image showing the label 2 to be inspected and the template image. If a defective pixel is present, the determination unit 12 outputs an inspection result indicating "defective." If no defective pixel is present, the determination unit 12 outputs an inspection result indicating "no defect." Alternatively, the determination unit 12 may output an inspection result indicating "defective" if the number of defective pixels exceeds a predetermined threshold. The determination unit 12 may output an inspection result indicating "no defect" if the number of defective pixels is equal to or less than a predetermined threshold.
[0032] As shown in FIG. 2, step S1 includes steps S11 to S14. In step S11, the generation unit 11 receives a plurality of original images that are the basis for the template image. The plurality of original images are prepared in advance as images that are assumed to show good labels 2. However, a user may mistakenly register an image that shows a defective label 2 as an original image. The plurality of original images are obtained by capturing images of the label 2 using the camera 300 or another camera. For example, the user sets some or all of the plurality of images stored in the storage of the inspection device 100 as the plurality of original images.
[0033] In the next step S12, the generation unit 11 identifies a set of pixel values for each pixel of the multiple original images. Hereinafter, the set of pixel values will be referred to as a "pixel value set."
[0034] FIG. 3 is a diagram showing an example of the processing of step S12 shown in FIG. 2. As shown in FIG. 3, the generation unit 11 identifies a pixel value set 6 for each pixel in p original images 5 (5_1 to 5_p). The pixel value set 6 corresponding to pixel (xi, yi) is a collection of values V1(i, j) to Vp(i, j) of pixel (xi, yi) in each of the original images 5_1 to 5_p. Each of the values V1(i, j) to Vp(i, j) constitutes an element of the pixel value set 6 corresponding to pixel (xi, yi). In FIG. 3, the value Vk(i, j) represents the luminance of pixel (xi, yi) in original image 5_k.
[0035] In the next step S13, in response to receiving the designation of a specific area in a specific original image among the multiple original images 5, the generation unit 11 invalidates elements corresponding to the specific pixels in the pixel value set 6 corresponding to each specific pixel included in the specific area and enables elements that do not correspond to the specific pixels.
[0036] FIG. 4 is a diagram showing an example of a specific original image. The specific original image 5a shown in FIG. 4 includes a label 2 and a defect 7. The defect 7 in the specific original image 5a is inappropriate for generating a template image. Therefore, the user designates the area of the specific original image 5a that includes the defect 7 as a specific area 50. For example, the user may designate the specific area 50 by operating the input device 160 (see FIG. 7 ), which will be described later.
[0037] FIG. 5 is a diagram showing an example of the processing of step S13 shown in FIG. 2. In the example shown in FIG. 5, original image 5_3 is designated as the specific original image, and a region in original image 5_3 that includes pixel (x0, y0) is designated as the specific region. Therefore, in pixel value set 6 corresponding to pixel (x0, y0), generation unit 11 invalidates element 8a indicating value V3(0, 0) of original image 5_3 and validates the other elements. Furthermore, original image 5_2 is designated as the specific original image, and a region in original image 5_2 that includes pixel (xi, yj) is designated as the specific region. Therefore, in pixel value set 6 corresponding to pixel (xi, yj), generation unit 11 invalidates element 8b indicating value V2(i, j) of original image 5_2 and validates the other elements.
[0038] In the next step S14, the generation unit 11 generates the template image so that each pixel has a representative value of the pixel value set 6. The representative value includes, for example, the mean value, the median value, the intermediate value, etc.
[0039] 6 is a diagram showing an example of the processing of step S14 shown in FIG. 2. In the example shown in FIG. 6, the generation unit 11 calculates, for each pixel value set 6, the average value of the elements 8 included in the pixel value set 6. Elements that are invalidated in step S13 are ignored in step S14 and are not used in calculating the average value. In other words, the generation unit 11 calculates the average value of the elements 8 that are valid. The generation unit 11 generates the template image 9 so that the value of pixel (xi, yi) has the average value Vave(i, j) of the pixel value set 6 corresponding to pixel (xi, yi).
[0040] According to this embodiment, in pixel value set 6 corresponding to each of one or more pixels included in specific region 50, elements 8 corresponding to the one or more pixels are invalidated. As a result, the values of one or more pixels included in specific region 50 do not affect template image 9. In other words, defects 7 do not have any effect on template image 9. By using such a template image 9, the accuracy of inspecting the quality of an object is improved.
[0041] When a specific original image 5a among the multiple original images 5 contains a defect 7, the user simply designates the area containing the defect 7 as the specific area 50, and there is no need to prepare a new original image 5 in place of the specific original image 5a. This reduces the effort required to prepare the template image 9.
[0042] <Hardware Configuration of Inspection Device> The inspection device 100 is typically a computer having a general-purpose architecture, and executes a pre-installed program (instruction code) to perform the inspection process according to this embodiment. Such a program is typically distributed in a state stored on various recording media, or is installed in the inspection device 100 via a network, etc.
[0043] When using such a general-purpose computer, an OS (Operating System) for executing basic computer processing may be installed in addition to the application for executing the inspection processing according to the present embodiment. In this case, the program according to the present embodiment may execute processing by calling necessary modules from among program modules provided as part of the OS in a predetermined sequence at a predetermined timing. In other words, the program according to the present embodiment itself may not include the above-mentioned modules, and may execute processing in cooperation with the OS. The program according to the present embodiment may also be in a form that does not include some of these modules.
[0044] Furthermore, the program according to the present embodiment may be provided by being incorporated into a part of another program. In this case, the program itself does not include the modules included in the other program to be combined as described above, and executes processing in cooperation with the other program. In other words, the program according to the present embodiment may be in a form incorporated into such other program. Note that some or all of the functions provided by the execution of the program may be implemented as dedicated hardware circuits.
[0045] Fig. 7 is a schematic diagram showing an example of the hardware configuration of an inspection device. As shown in Fig. 7, the inspection device 100 includes a CPU (Central Processing Unit) 110, which is an example of a processor, a main memory 112, a storage 114, a camera interface 116, an input interface 118, a display controller 120, a communication interface 124, and a data reader / writer 126. These components are connected to each other via a bus 128 so as to be able to communicate data with each other.
[0046] The CPU 110 loads the programs 115 installed in the storage 114 into the main memory 112 and executes them in a predetermined order to perform various calculations. The main memory 112 typically includes a volatile storage device such as a dynamic random access memory (DRAM), and stores images acquired from the camera 300 in addition to the programs 115 read from the storage 114. Furthermore, the storage 114 stores various types of data, as will be described later. The storage 114 includes, for example, a hard disk drive, a solid state drive, or the like.
[0047] The generating unit 11 and the determining unit 12 shown in FIG. 1 are realized by the CPU 110 executing the program 115 .
[0048] The camera interface 116 mediates data transmission between the CPU 110 and the camera 300. That is, the camera interface 116 is connected to the camera 300. The camera interface 116 issues an image capture command to the camera 300 in accordance with an internal command generated by the CPU 110. The image capture command may be output in response to a detection signal from a photoelectric sensor. Alternatively, the image capture command may be output in response to an external command from the PLC 400.
[0049] The camera interface 116 includes an image buffer 116a for temporarily storing images received from the camera 300. In the example shown in Fig. 7, the camera 300 is externally attached to the inspection device 100. However, the camera 300 may also be built into the inspection device 100.
[0050] The input interface 118 mediates data transmission between the CPU 110 and the input device 160. That is, the input interface 118 accepts input information entered by a user into the input device 160. The input interface 118 is used to specify a specific original image and a specific region.
[0051] The display controller 120 is connected to the display 150 and controls the screen of the display 150 so as to notify the user of the processing results of the CPU 110 and the like.
[0052] The display 150 displays the original images 5. While checking each original image 5, the user operates the input interface 118 to specify a specific original image 5a and a specific region 50.
[0053] The communication interface 124 mediates data transmission between the CPU 110 and an external device (for example, the PLC 400). The communication interface 124 typically includes an Ethernet (registered trademark) or a Universal Serial Bus (USB).
[0054] Data reader / writer 126 mediates data transmission between CPU 110 and memory card 106, which is a recording medium. That is, memory card 106 stores and distributes programs to be executed by inspection device 100, and data reader / writer 126 reads the programs from memory card 106. In addition, data reader / writer 126 writes images received from camera 300 and / or processing results in inspection device 100 to memory card 106 in response to internal commands from CPU 110. Note that memory card 106 includes general-purpose semiconductor storage devices such as SD (Secure Digital), magnetic storage media such as flexible disks, and optical storage media such as CD-ROMs (Compact Disk Read Only Memory).
[0055] <Another Processing Example of the Generator> (First Processing Example) The user verifies the presence or absence of defects in each original image 5 and designates an area containing the defect as a specific area 50. If the original image 5 has a large number of pixels, it takes the user a considerable amount of time to verify the presence or absence of defects in each original image 5. Therefore, the generator 11 may perform the following processing to support the designation of the specific area 50.
[0056] The generation unit 11 may present, as a candidate for the specific region 50 (hereinafter referred to as a "candidate specific region"), a pixel block having different characteristics in a target original image among the multiple original images 5 compared with the remaining original images other than the target original image among the multiple original images 5. The target original image is specified by the user. Alternatively, the generation unit 11 may sequentially select one original image from the multiple original images 5 as the target original image.
[0057] The specific region candidate is a region in the original image of interest that has different characteristics compared to the remaining original image 5. In other words, the specific region candidate is likely to contain a defect. Therefore, the user can check the specific region candidate and determine whether or not to designate the specific region candidate as the specific region 50.
[0058] FIG. 8 is a diagram showing an example of a presentation of a specific region candidate. As shown in FIG. 8, the generation unit 11 displays the target original image 5b on the display 150. The generation unit 11 displays a frame 60 representing a specific region candidate extracted from the target original image 5b, superimposed on the target original image 5b. In the example shown in FIG. 8, two frame lines 60 are displayed. The user can check the specific region candidate within the frame lines 60 and specify the specific region. For example, if the user confirms that a defect is found within the frame lines 60, the user can specify the specific region candidate represented by the frame lines 60 as the specific region.
[0059] The generation unit 11 may present an enlarged image of the specific region candidate in response to a user input so that the user can easily check the specific region candidate represented by the frame line 60. In the example shown in Fig. 8 , the generation unit 11 displays a window 80 including an enlarged image 70 of the specific region candidate represented by the frame line 60_1 of the two frame lines 60. This makes it easy for the user to check the details of the specific region candidate represented by the frame line 60_1.
[0060] Furthermore, the generation unit 11 may present an enlarged image of a region in one of the remaining original images 5 corresponding to the candidate specific region in response to a user input, so that the user can easily confirm the differences between the target original image 5b and the remaining original images 5. For example, in the example shown in FIG. 8 , the generation unit 11 includes an icon 82 for switching the enlarged image in the window 80. The generation unit 11 selects one of the remaining original images 5 in response to an operation of the icon 82. The generation unit 11 switches the selected original image 5 each time the icon 82 is operated. The generation unit 11 displays an enlarged image of a region in the selected original image 5 corresponding to the candidate specific region in the target original image 5b in the window 80. This makes it easier for the user to confirm the differences between the target original image 5b and the remaining original images 5.
[0061] Next, a specific example of a method for determining specific region candidates will be described. The generation unit 11 regards the target original image 5b as a collection of multiple pixel blocks. Each of the multiple pixel blocks has a predetermined size. For example, if the target original image 5b has a size of M×N and the size of the pixel block is m×n, the generation unit 11 regards the target original image 5b as a collection of (M / m)×(N / n) pixel blocks.
[0062] For example, the generation unit 11 determines, from among the multiple pixel blocks in the target original image 5b, a pixel block that includes a first target pixel that satisfies a first condition as a specific region candidate. The first condition is that the difference between the value of the first target pixel and a representative value of the pixel values corresponding to the first target pixel in the multiple original images 5 exceeds a first threshold. The representative value is, for example, the average value, median value, or intermediate value. The intermediate value is the average value of the maximum and minimum values of the pixel corresponding to the first target pixel in the multiple original images 5. The first threshold is determined in advance.
[0063] As a result, a pixel in the target original image 5b that has a value that is significantly different from the representative value obtained from the multiple original images 5 is identified as the first target pixel. The first target pixel is likely to be a defective pixel. Therefore, a pixel block including the first target pixel is determined as a candidate for a specific region.
[0064] Alternatively, the generation unit 11 may determine, as a specific region candidate, a pixel cluster including a second pixel of interest that satisfies the second condition from among the multiple pixel clusters in the target original image 5b. The second condition is that, in a difference image between the target original image 5b and a composite image obtained by combining the multiple original images 5, the difference in value between the pixel corresponding to the second pixel of interest and its surrounding pixels exceeds a second threshold. Each pixel in the composite image represents a representative value of the values of corresponding pixels in the multiple original images 5. The representative value is, for example, the mean value, median value, or intermediate value. The intermediate value is the average value of the maximum and minimum values of corresponding pixels in the multiple original images 5. The second threshold is determined in advance.
[0065] As a result, a pixel having edge characteristics in the difference image is identified as a second pixel of interest. The second pixel of interest is likely to be a defective pixel. Therefore, a pixel block including the second pixel of interest is determined as a candidate for a specific region.
[0066] Alternatively, the generation unit 11 may determine, as a specific region candidate, a pixel block that includes a first pixel of interest that satisfies the first condition and a third pixel of interest that satisfies the third condition. Alternatively, the generation unit 11 may determine, as a specific region candidate, a pixel block that includes a second pixel of interest that satisfies the second condition and a third pixel of interest that satisfies the third condition. Note that the third pixel of interest may be the same as or different from the first pixel of interest. Similarly, the third pixel of interest may be the same as or different from the second pixel of interest.
[0067] The third condition is that a feature representing the variation in pixel values corresponding to the third pixel of interest in the multiple original images 5 exceeds a third threshold. The third threshold is determined in advance. The feature representing the variation in pixel values is, for example, the difference between the maximum and minimum values, the standard deviation, or the variance. As a result, a pixel with a large variation in luminance among the multiple original images 5 is identified as the third pixel of interest. A pixel with a large variation in luminance among the multiple original images 5 is likely to indicate a defect in one of the original images 5. Therefore, the generation unit 11 narrows down the pixel blocks included in the target original image 5b to pixel blocks including the third pixel of interest that satisfy the third condition. Then, the generation unit 11 may identify a pixel block including the first pixel of interest or the second pixel of interest from the narrowed-down pixel blocks as a specific region candidate. As a result, a region that is more likely to include a defect is identified as a specific region candidate.
[0068] 6, the value of each pixel in the template image 9 is a representative value of the corresponding pixel value set 6. Therefore, if all elements 8 in the pixel value set 6 corresponding to a certain pixel are invalidated in step S13, the template image 9 will not have a value for that pixel. If such a template image 9 is used, it will be impossible to accurately determine whether the label 2 appearing in the inspection image is good or bad.
[0069] Therefore, the generation unit 11 may output an error notification indicating that the template image 9 cannot be generated in response to the presence of at least one pixel designated as a specific region in all of the multiple original images 5. The error notification is displayed on the display 150. The error notification includes, for example, a message prompting the user to add a new original image 5. This allows the user to consider adding a new original image 5, etc.
[0070] <Example of Processing by the Determination Unit> As described above, the determination unit 12 determines whether each pixel in the inspection image is a defective pixel or a non-defective pixel based on the comparison result between the inspection image and the template image. The luminance of a pixel that has a defect such as ink skipping, bleeding, fading, or color shift (which may include, for example, pigment ink, dye ink, or conductive ink) differs from the luminance of a pixel that does not have a defect. Therefore, the determination unit 12 performs a first determination process, for example, as disclosed in Patent Document 2. That is, the determination unit 12 calculates the difference between the inspection image and the template image for each pixel. The determination unit 12 determines a pixel whose absolute value of the difference exceeds a predetermined threshold as a defective pixel, and determines a pixel whose difference is equal to or less than the predetermined threshold as a non-defective pixel.
[0071] Furthermore, the determination unit 12 may perform a second determination process disclosed in Patent Document 2. If a pixel determined to be a defective pixel in the first determination process exists, the determination unit 12 determines whether a pixel in the template image corresponding to the defective pixel is an edge pixel. For example, the determination unit 12 calculates the edge strength of the pixel in the template image corresponding to the defective pixel, and determines that the pixel corresponding to the defective pixel is an edge pixel if the calculated edge strength is equal to or greater than a predetermined value. The determination unit 12 performs the following second determination process on a pixel determined to be a defective pixel in the first determination process and whose corresponding pixel in the template image is determined to be an edge pixel.
[0072] The determination unit 12 compares the value of a pixel determined to be a defective pixel in the first determination process with a threshold (hereinafter referred to as the "variation determination threshold") defined using a statistical value indicating the degree of variation among the elements 8 included in the pixel value set 6 corresponding to the pixel. The statistical value is, for example, a standard deviation. The variation determination threshold is, for example, a value obtained by multiplying the standard deviation by a coefficient. For example, the determination unit 12 calculates the difference between the value of the pixel determined to be a defective pixel in the first determination process and the value of a pixel corresponding to the defective pixel in the template image. If the calculated difference is equal to or less than the variation determination threshold, the determination unit 12 re-determines that the pixel determined to be a defective pixel in the first determination process is not a defective pixel. On the other hand, if the calculated difference exceeds the variation determination threshold, the determination unit 12 determines that the pixel determined to be a defective pixel in the first determination process is also a defective pixel in the second determination process.
[0073] Note that, as a result of step S13 described above, the number of elements 8 remaining in pixel value set 6 may be one. If pixel value set 6 corresponding to a pixel determined to be a defective pixel in the first determination process includes only one element 8, determination unit 12 omits the second determination process.
[0074] In the above description, the label 2 is given as an example of an "object" in the present disclosure. However, the "object" in the present disclosure is not limited to the label 2. For example, the "object" in the present disclosure may include paper products, metal parts, plastic parts, glass parts, electronic parts, and intermediate products thereof.
[0075] <Additional Notes> As described above, the present embodiment includes the following disclosures.
[0076] (Configuration 1) An inspection device (100) for inspecting whether or not a defect exists in an object (2) based on an inspection image showing the object (2), comprising: a generation unit (11, 110) for generating a template image (9) showing a non-defective product; and a determination unit (12, 110) for determining whether each pixel of the inspection image is a defective pixel or a non-defective pixel based on a comparison result between the inspection image and the template image (9), wherein the generation unit (11, 110) specifies, for each pixel, a set (6) of pixel values of a plurality of original images (5) that are the basis of the template image (9), and, in response to receiving designation of a specific region (50) in a specific original image (5a) of the plurality of original images (5), in the set (6) corresponding to each of one or more pixels included in the specific region (50), invalidates elements (7) corresponding to the one or more pixels and validates elements (7) that do not correspond to the one or more pixels, An inspection device (100) generates the template image (9) so that each pixel has a representative value of the set (6) corresponding to each pixel.
[0077] (Configuration 2) The inspection device (100) according to Configuration 1, wherein the generation unit (11, 110) presents pixel clusters having different characteristics in a target original image (5b) among the plurality of original images (5) as candidates for the specific region, by comparing the target original image (5b) with the remaining original images among the plurality of original images (5) other than the target original image (5b).
[0078] (Configuration 3) The inspection device (100) according to Configuration 2, wherein the pixel block includes a first pixel of interest that satisfies a first condition, and the first condition is that a difference between the value of the first pixel of interest and a representative value of pixel values corresponding to the first pixel of interest in the plurality of original images (5) exceeds a first threshold value.
[0079] (Configuration 4) The inspection device (100) according to Configuration 2, wherein the pixel block includes a second pixel of interest that satisfies a second condition, and the second condition is that in a difference image between the original image of interest (5b) and a composite image obtained by combining the plurality of original images (5), a difference in value between a pixel corresponding to the second pixel of interest and surrounding pixels exceeds a second threshold value.
[0080] (Configuration 5) The inspection device (100) according to Configuration 3 or 4, wherein the pixel block further includes a third pixel of interest that satisfies a third condition, and the third condition is that a feature representing the variation in values of pixels corresponding to the third pixel of interest in the plurality of original images (5) exceeds a third threshold value.
[0081] (Configuration 6) The inspection device (100) according to any one of configurations 2 to 5, wherein the generation unit (11, 110) presents the enlarged image (70) of the candidate in response to a user input.
[0082] (Configuration 7) The inspection device (100) according to Configuration 6, wherein the generator (11, 110) presents an enlarged image of a region corresponding to the candidate in one of the remaining original images in response to a user input.
[0083] (Configuration 8) The inspection device (100) according to any one of Configurations 1 to 7, wherein the generation unit (11, 110) outputs an error notification in response to the presence of at least one pixel designated as the specific region (50) in all of the plurality of original images (5).
[0084] (Configuration 9) An inspection method for inspecting whether or not a defect exists in an object (2) based on an inspection image depicting the object (2), the inspection method comprising: generating a template image (9) depicting a non-defective product; and determining whether each pixel of the inspection image is a defective pixel or a non-defective pixel based on a comparison result between the inspection image and the template image (9), wherein the generating step includes: identifying, for each pixel, a set (6) of pixel values of multiple original images (5) that are the basis of the template image (9); and, in response to designation of a specific area (50) in a specific original image (5a) among the multiple original images (5), in the set (6) corresponding to each of one or more pixels included in the specific area (50), invalidating elements (7) corresponding to the one or more pixels and validating elements (7) that do not correspond to the one or more pixels; and generating the template image (9) so that the value of each pixel has a representative value of the set (6) corresponding to each pixel.
[0085] (Configuration 10) A program that causes a computer to execute an inspection method for inspecting whether or not a defect exists in an object based on an inspection image depicting the object, the inspection method comprising: generating a template image (9) depicting a non-defective product; and determining whether each pixel of the inspection image is a defective pixel or a non-defective pixel based on a comparison result between the inspection image and the template image (9), wherein the generating includes: identifying, for each pixel, a set (6) of pixel values of multiple original images (5) that are the basis of the template image (9); and, in response to designation of a specific area (50) in a specific original image (5a) among the multiple original images (5), invalidating elements (7) corresponding to the one or more pixels in the set (6) and validating elements (7) that do not correspond to the one or more pixels; and generating the template image (9) so that the value of each pixel has a representative value of the set (6) corresponding to each pixel.
[0086] Although the embodiments of the present invention have been described, the embodiments disclosed herein should be considered to be illustrative and not restrictive in all respects. The scope of the present invention is defined by the claims, and it is intended to include all modifications within the meaning and scope of the claims.
[0087] 1 System, 2 Label, 3 Packing box, 4 Line, 5 Original image, 5a Specific original image, 5b Target original image, 6 Pixel value set, 7 Defect, 8, 8a, 8b Element, 9 Template image, 11 Generation unit, 12 Judgment unit, 50 Specific area, 60 Border line, 70 Enlarged image, 80 Window, 82 Icon, 100 Inspection device, 106 Memory card, 110 CPU, 112 Main memory, 114 Storage, 115 Program, 116 Camera interface, 116a Image buffer, 118 Input interface, 120 Display controller, 124 Communication interface, 126 Data reader / writer, 128 Bus, 150 Display, 160 Input device, 200 Label printer, 300 Camera, 400 PLC.
Claims
1. An inspection device that inspects whether or not there are defects in an object based on an inspection image depicting the object, comprising: a generation unit that generates a template image depicting a non-defective product; and a determination unit that determines whether each pixel of the inspection image is a defective pixel or a non-defective pixel based on the results of comparing the inspection image with the template image, wherein the generation unit identifies, for each pixel, a set of pixel values of multiple original images that are the basis of the template image, and, in response to receiving designation of a specific area in a specific original image among the multiple original images, invalidates elements that correspond to the one or more pixels in the set corresponding to each of the one or more pixels included in the specific area and enables elements that do not correspond to the one or more pixels, and generates the template image so that the value of each pixel has a representative value of the set corresponding to each of the pixels.
2. The inspection device according to claim 1, wherein the generation unit presents pixel clusters in a target original image among the plurality of original images that have different characteristics compared to the remaining original images other than the target original image among the plurality of original images as candidates for the specific region.
3. The inspection device of claim 2, wherein the pixel block includes a first pixel of interest that satisfies a first condition, and the first condition is that the difference between the value of the first pixel of interest and a representative value of pixel values corresponding to the first pixel of interest in the multiple original images exceeds a first threshold value.
4. The inspection device of claim 2, wherein the pixel block includes a second pixel of interest that satisfies a second condition, and the second condition is that in a difference image between the original image of interest and a composite image obtained by combining the multiple original images, the difference in value between the pixel corresponding to the second pixel of interest and surrounding pixels exceeds a second threshold value.
5. An inspection device as described in claim 3 or 4, wherein the pixel block further includes a third pixel of interest that satisfies a third condition, and the third condition is that a feature representing the variation in values of pixels corresponding to the third pixel of interest in the multiple original images exceeds a third threshold.
6. The inspection device according to any one of claims 2 to 5, wherein the generation unit presents an enlarged image of the candidate in response to a user input.
7. The inspection device according to claim 6, wherein the generator presents an enlarged image of a region corresponding to the candidate in one of the remaining original images in response to a user input.
8. An inspection device according to any one of claims 1 to 7, wherein the generation unit outputs an error notification in response to the presence of at least one pixel designated as the specific region in all of the plurality of original images.
9. An inspection method for inspecting whether or not there is a defect in an object based on an inspection image depicting the object, comprising: generating a template image depicting a non-defective product; and determining whether each pixel of the inspection image is a defective pixel or a non-defective pixel based on a comparison result between the inspection image and the template image, wherein the generating step includes: specifying, for each pixel, a set of pixel values of multiple original images that are the basis of the template image; and, in response to designation of a specific area in a specific original image among the multiple original images, invalidating elements corresponding to the one or more pixels in the set corresponding to each of the one or more pixels included in the specific area and validating elements that do not correspond to the one or more pixels; and generating the template image so that each pixel has a representative value of the set corresponding to each of the pixels.
10. A program that causes a computer to execute an inspection method for inspecting whether or not there are defects in an object based on an inspection image depicting the object, the inspection method comprising: generating a template image depicting a non-defective product; and determining whether each pixel of the inspection image is a defective pixel or a non-defective pixel based on the results of comparing the inspection image with the template image, wherein the generating step includes: identifying, for each pixel, a set of pixel values of multiple original images that are the basis of the template image; and, in response to designation of a specific area in a specific original image among the multiple original images, invalidating elements corresponding to the one or more pixels in the set corresponding to each of the one or more pixels included in the specific area and validating elements that do not correspond to the one or more pixels; and generating the template image so that each pixel has a representative value of the set corresponding to each of the pixels.