Image processing device, image processing method, and program

The image processing device uses photometric stereo and virtual light sources to generate normal maps and simulate brightness distribution, effectively addressing the challenge of detecting linear features on industrial product surfaces, ensuring accurate detection regardless of feature direction or lighting conditions.

JP2024138852APending Publication Date: 2024-10-09CANON KK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
JP2023049562
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2024-10-09

AI Technical Summary

Technical Problem

Existing visual inspection techniques struggle to detect linear features, such as scratches and other minute irregularities, on industrial product surfaces, particularly when these features extend in arbitrary directions and are obscured by shadows or specular reflections, due to the discrete arrangement of light sources.

Method used

An image processing device that generates a normal map using photometric stereo and simulates brightness distribution with virtual light sources to detect linear features by setting lighting directions perpendicular to the direction of the features, allowing for accurate detection regardless of the feature direction.

Benefits of technology

Enables precise detection of linear features in any direction on an object surface, even when features are minute or obscured by shadows or specular reflections, by utilizing virtual light sources to simulate lighting conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024138852000001_ABST
    Figure 2024138852000001_ABST
Patent Text Reader

Abstract

To enable detection of linear features of an object surface in any directions.SOLUTION: An image processing device 101 disclosed herein is configured to generate an image of a target object under lighting provided by a virtual light source, and detect linear features of the target object from the image.SELECTED DRAWING: Figure 5
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present disclosure relates to techniques for detecting surface features of an object. [Background technology]

[0002] A technique for detecting unevenness on an inspection surface is known as an appearance inspection technique for industrial products. Patent Document 1 discloses a technique in which a plurality of light sources constituting a multi-lamp lighting system are turned on one by one, an image of the inspection surface is taken for each light, and the unevenness on the inspection surface is detected based on the plurality of images obtained by the image capture. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Japanese Patent Application Publication No. 2019-191105 Summary of the Invention [Problem to be solved by the invention]

[0004] In the visual inspection of industrial products, it is sometimes necessary to detect linear features on the inspection surface, such as scratches or other minute irregularities that extend linearly on the inspection surface (hereinafter referred to as "linear irregularities"). According to the technology described in Patent Document 1, multiple lighting fixtures can be used to irradiate light from various directions. Therefore, even if the irregularities are minute, linear irregularities can be detected if light is irradiated perpendicular to the direction in which the linear irregularities extend. However, with the technology described in Patent Document 1, because the multiple light sources are arranged discretely, linear irregularities whose extension direction is not perpendicular to the light from any of the multiple light sources may not be detected. Therefore, an object of the present disclosure is to provide a process for detecting linear features in any direction on the surface of an object. [Means for solving the problem]

[0005] The image processing device according to the present disclosure includes a generation means for generating an image of a target object using lighting with a virtual light source, and a detection means for detecting linear features of the target object based on the image. [Effects of the Invention]

[0006] According to the present disclosure, linear features in any direction on the surface of an object can be detected. [Brief explanation of the drawings]

[0007] [Figure 1] 1A and 1B are diagrams illustrating an example of the configuration and appearance of an inspection system. [Figure 2] FIG. 1 is a diagram illustrating an example of the arrangement of a light source and an imaging device in an inspection system. [Figure 3] 10A and 10B are diagrams for explaining an example of the principle of detecting linear concaves and convexes. [Figure 4] FIG. 1 is a diagram illustrating an example of the arrangement of a light source and an imaging device in an inspection system. [Figure 5] 1 is a block diagram showing an example of a functional configuration of an image processing device according to a first embodiment. [Figure 6] 4 is a flowchart showing an example of a processing flow in the image processing device according to the first embodiment. [Figure 7] FIG. 10 is a block diagram showing an example of the functional configuration of an image processing device according to a second embodiment. [Figure 8] 10 is a flowchart showing an example of a processing flow in an image processing device according to a second embodiment. [Figure 9] FIG. 10 is a diagram illustrating an example of an arrangement of virtual light sources according to the second embodiment. [Figure 10] FIG. 10 is a diagram for explaining an example of a change in the posture of an object to be inspected. [Figure 11] FIG. 10 is a block diagram showing an example of the functional configuration of an image processing device according to a third embodiment. [Figure 12] 11 is a flowchart showing an example of a processing flow in an image processing device according to a third embodiment. [Figure 13]FIG. 10 is a block diagram showing an example of the functional configuration of an image processing device according to a fourth embodiment. [Figure 14] FIG. 10 is a diagram for explaining an example of processing by the image processing device according to the fourth embodiment. [Figure 15] FIG. 10 is a diagram for explaining an example of processing by the image processing device according to the fourth embodiment. DETAILED DESCRIPTION OF THE INVENTION

[0008] Hereinafter, embodiments of the present disclosure will be described with reference to the drawings. Note that the following embodiments do not limit the present disclosure, and not all of the combinations of features described in the embodiments are necessarily required as the solutions of the present disclosure. Hereinafter, identical configurations will be described using the same reference numerals. Furthermore, each process (step) in a flowchart will be described using a reference numeral prefixed with "S."

[0009] <Hardware configuration of image processing device> In the image processing of the present disclosure, a normal map of the inspection surface of an object to be inspected (hereinafter referred to as the "object") is first obtained. Here, the object is, for example, an industrial product such as a home appliance or a cosmetic product. Then, linear features on the inspection surface are detected based on the obtained normal map. Here, linear features on the inspection surface are, for example, irregularities that extend linearly on the inspection surface (hereinafter referred to as "linear irregularities"). The detected linear irregularities (linear features) are, for example, unintentional irregularities such as scratches, or irregularities that are intentionally formed by embossing or the like. The normal map of the inspection surface may be obtained by any known method. In the following embodiments, the normal map is described as being obtained using photometric stereo as an example, but the method of obtaining the normal map is not limited thereto. For example, the normal map may be obtained by acquiring shape information of the inspection surface using a light-section method and generating the normal map based on the acquired shape information.

[0010] FIG. 1(a) is a block diagram showing an example of the configuration of an inspection system 1 according to the present disclosure. The inspection system 1 includes an image processing device 101, multiple light sources 102, an image capture device 103, a display 111, a mouse 112, and a keyboard 113. FIG. 1(a) also shows an example of the hardware configuration of the image processing device 101 according to the present disclosure. The image processing device 101 includes a RAM 105, a CPU 106, a ROM 107, and an interface 108. These are communicatively connected to each other via an internal bus 109. The processing described in the flowcharts described below is stored in the ROM 107 as program code. This program code is loaded into the RAM 105 and executed by the CPU 106. The light sources 102, the image capture device 103, the display 111, the mouse 112, and the keyboard 113 are communicatively connected to the image processing device 101 via the interface 108 and an external bus 110. The display 111 presents information to a user, and the mouse 112 and the keyboard 113 accept input from the user. The light source 102 and the image capture device 103 will be described in detail later.

[0011] FIG. 1(b) is a diagram showing an example of the appearance of an inspection system 1 according to the present disclosure, showing an example of the appearance when the inspection system 1 is viewed from the side. FIG. 1(c) is a diagram showing an example of the arrangement of the light sources 102 and the image capture device 103 according to the present disclosure, showing an example of the arrangement of the light sources 102 and the image capture device 103 when the inspection system 1 is viewed from above. A dome-shaped multi-light illumination is formed by multiple light sources 102 (light sources 102-0 to 102-7), and the on / off control of each light source is performed by an image processing device 101. The image capture device 103 is formed by a digital still camera or the like, and the timing of capturing images by the image capture device 103 is controlled by the image processing device 101. Note that, hereinafter, the inspection system 1 will be described as including eight light sources 102, light sources 102-0 to 102-7. However, the number of light sources 102 may be three or more, and is not limited to eight.

[0012] The image processing device 101 individually controls the on / off of the light sources 102-0 to 102-7 to irradiate light onto the inspection surface of the target object (hereinafter referred to as the "inspection object") 104. The image processing device 101 controls the exposure, focus, imaging timing, etc. of the imaging device 103 to cause the imaging device 103 to image the inspection surface. Specifically, the image processing device 101 individually turns on the eight light sources 102 in the order of light source 102-0, light source 102-1, ..., light source 102-7, and causes the imaging device 103 to image the inspection surface each time a light source 102 is turned on. In this way, the image processing device 101 acquires eight pieces of captured image data obtained by the imaging. For example, first, the image processing device 101 acquires captured image data obtained by imaging when only the light source 102-0 is turned on. Next, the image processing device 101 acquires captured image data obtained by imaging when only the light source 102-1 is turned on as the second captured image data. The image processing device 101 generates a normal map by photometric stereo based on the acquired eight frames of captured image data, and detects unevenness of the inspection surface based on the generated normal map.

[0013] <Generating normal maps using photometric stereo> A method for generating a normal map using photometric stereo will be described below. Here, an example will be described in which there are eight light sources 102. Note that the number of light sources 102 is not limited to eight, as long as it is three or more. Photometric stereo assumes Lambert's cosine law, and assumes that the reflected luminance of the inspection surface is proportional to the dot product of the vector indicating the direction of the light source and the normal vector. In other words, photometric stereo assumes that the following equation (1) holds true at each position (x, y) on the inspection surface. Note that in the following description, the inspection surface is assumed to exist on an xy plane consisting of the x-axis and y-axis, and the direction perpendicular to the xy plane is referred to as the z-axis (hereinafter referred to as the "vertical axis").

[0014]

number

[0015] In equation (1), I i is the reflected luminance at the position (x, y) when only the light source 102-i (i is an arbitrary integer from 0 to 7) is turned on. i can be calculated using the captured image data. i =(L ix ,L iy ,L iz ) is a unit vector (hereinafter referred to as "light source vector") indicating the direction of the light source 102-i from the position (x, y) at the position (x, y). FIG. 1(b) illustrates an example of a light source vector indicating the direction of the light source 102-4 from a certain position on the inspection surface. N ρ =(ρN x ,ρN y ,ρN z ) T is the normal vector N=(N x ,N y ,N z ) T is a pseudo-normal vector obtained by multiplying the normal vector N by the albedo (reflectance) ρ at the position (x, y). Note that T represents the transpose of a vector, and the normal vector N is expressed by a unit vector. FIG. 1(b) shows an example of a normal vector at a certain position on the inspection surface. Equation (1) is valid for any light source 102, and can be summarized as the following equation (2).

[0016]

number

[0017] Furthermore, if the vector on the left side of equation (2) is denoted as I and the 8-row, 3-column matrix on the right side is denoted as L, the following equation (3) is obtained. Hereinafter, I will be referred to as the luminance vector, and L will be referred to as the light source matrix. I=LN ρ ··· Equation (3)

[0018] Here, the luminance vector I can be calculated from the eight captured image data, and the light source matrix L can be calculated from the results of measurements carried out in advance. Therefore, Equation (3) can be expressed as the pseudo-normal vector N ρ It can be said that the three components of the above equations are unknowns. If the number of light sources 102 is three, the light source matrix L is a square matrix with 3 rows and 3 columns. If L is a regular matrix, the inverse matrix L of L is -1 This L -1 Applying this to the brightness vector I gives us the pseudo-normal vector N, which is the unknown in equation (3). ρ The solution can be found.

[0019] On the other hand, when the number of light sources 102 is four or more, Equation (3) becomes an overdetermined simultaneous equation. In this case, as shown in the following Equation (4), the pseudo-inverse matrix (L T L) -1 L T Applying to the luminance vector I, we can find the least squares solution of equation (3). N ρ =(L T L) -1 L T I Equation (4)

[0020] In this case, for the albedo ρ, the pseudo-normal vector N ρ Since this corresponds to the length of the ρ=|N ρ | Equation (5)

[0021] Also, the normal vector N is a pseudo-normal vector N ρ is a unit vector whose length is normalized to 1. Therefore, the normal vector N can be calculated by the following equation (6). N=(1 / ρ)N ρ ...Equation (6)

[0022] By performing the calculations of equations (4) to (6) for each position (x, y), a normal map showing the spatial distribution of normal vectors on the inspection surface can be obtained. At this time, an albedo map (reflectance map) showing the spatial distribution of albedo on the inspection surface can also be obtained using equation (5).

[0023] <Confirmation of the problem of this disclosure> FIG. 2 is a diagram showing an example of the arrangement of the light source 102 and the imaging device 103 in an inspection system 1 having a dome-shaped multi-light illumination. Specifically, FIG. 2(a) shows an example of the arrangement of the light source 102 and the imaging device 103 when the inspection system 1 is viewed from the side, and FIGS. 2(b) to 2(h) show an example of the arrangement of the light source 102 when the inspection system 1 is viewed from above. Note that in FIGS. 2(b) to 2(h), the imaging device 103 is omitted from the illustration because it overlaps with the inspection object 104. The inspection system 1 will be described as having eight light sources 102, light sources 102-0 to 102-7. In the technology described in Patent Document 1, first, the light sources 102-0 to 102-7 are turned on one by one, and an image of the inspection surface of the inspection object 104 is taken each time the light sources are turned on. Next, the presence or absence of irregularities on the inspection surface is inspected based on the plurality of captured image data obtained by the imaging. In the technology described in Patent Document 1, the captured image data is directly used for inspection, and therefore the normal map described above is not generated.

[0024] Visual inspection of industrial products may require the detection of minute linear irregularities, such as scratches. According to the technology described in Patent Document 1, a multi-lamp system can illuminate the surface from various directions. Therefore, as shown in FIGS. 2(c) to 2(f), even minute linear irregularities can be detected by irradiating the surface with light perpendicular to the direction of the linear irregularities. In FIGS. 2(c) to 2(f), the light source 102 indicated by a hollow rectangle indicates an on-state light source 102, while the light source 102 indicated by a solid rectangle indicates an off-state light source 102. In FIGS. 2(c) to 2(f), the arrows extending from the on-state light source 102 toward the inspection object 104 indicate the direction of light emitted from the light source 102.

[0025] The principle of linear irregularity detection will be described with reference to Fig. 3. Fig. 3 is a diagram for explaining an example of the principle of linear irregularity detection. Specifically, Fig. 3(a) shows the arrangement of the light source 102 and the imaging device 103 when the inspection system 1 is viewed from the side in a state in which the light source 102-0 shown in Fig. 2(c) is turned on. Also, Figs. 3(b) to 3(d) are diagrams showing normal vectors at each position on the inspection surface. A cross section 301 shows a cross section of an inspection object 104 having linear irregularities. Also, Figs. 3(a) to 3(d) show light source vectors corresponding to the light source 102-0.

[0026] As shown in FIG. 3(b), in a flat region on the inspection surface, the angle between the light source vector and the normal vector is medium. According to Lambert's cosine law, the smaller the angle between the light source vector and the normal vector, the greater the reflected luminance. Therefore, the reflected luminance of a flat region on the inspection surface is medium. On the other hand, as shown in FIG. 3(c), among the slopes formed by linear irregularities, the slope on the opposite side of the lit light source (light source 102-0) has a smaller angle between the light source vector and the normal vector, resulting in a higher reflected luminance. Conversely, as shown in FIG. 3(d), in a slope on the same side as the lit light source (light source 102-0), the angle between the light source vector and the normal vector is larger, resulting in a lower reflected luminance.

[0027] FIG. 3(e) is a diagram showing an example of the luminance distribution of the inspection surface obtained in the state shown in FIG. 3(a). For the sake of explanation, FIG. 3(e) shows the luminance distribution superimposed on the inspection surface of the inspection object 104. In the luminance distribution shown in FIG. 3(e), areas with high reflected luminance are shown in white, areas with medium reflected luminance are shown in gray, and areas with low reflected luminance are shown in black. Thus, when an inspection surface having linear irregularities is illuminated with light and imaged, shadows due to the irregularities appear in the captured image. The intensity (contrast) of this shadow is strongest when light is illuminated perpendicular to the direction of linear irregularities such as scratches. Therefore, as shown in FIGS. 2(c) to 2(f), linear irregularities can be detected by illuminating the surface with light perpendicular to the direction of linear irregularities, even if the irregularities are minute.

[0028] However, as shown in FIG. 2( g), if there is no light source 102 that irradiates light in a direction perpendicular to the direction of the linear irregularities, it is not possible to irradiate the inspection surface with light perpendicular to the direction of the linear irregularities when imaging the inspection surface. In this case, the shadows caused by the irregularities are weaker than when light is irradiated perpendicularly, and fine linear irregularities may not be detected. This problem would be largely resolved if light sources 102 were arranged at fine intervals, such as 1°, to irradiate the light. However, this would require a large number of light sources 102, such as 180 or 360, making this method impractical. In other words, the technology described in Patent Document 1, because the light sources are arranged discretely, may not be able to detect linear irregularities extending in any direction if the linear irregularities are very fine.

[0029] Furthermore, if the inspection object has a three-dimensional shape, a shadow will be generated on the inspection surface. FIG. 4 is a diagram showing an example of the arrangement of the light source 102 and the image capture device 103 in the inspection system 1 having a dome-shaped multi-light illumination. Specifically, FIG. 4(a) shows the arrangement of the light source 102 and the image capture device 103 when the inspection system 1 is viewed from the side, and FIGS. 4(b) to 4(f) show the arrangement of the light source 102 when the inspection system 1 is viewed from above. Note that in FIGS. 4(b) to 4(f), the image capture device 103 is omitted because it overlaps with the inspection object 104. Also, in FIGS. 4(c) to 4(f), the light source 102 indicated by a hollow rectangle indicates a light source 102 that is turned on, and the light source 102 indicated by a black rectangle indicates a light source 102 that is turned off. Also, in FIGS. 4(c) to 4(f), multiple arrows extending from the turned-on light source 102 toward the inspection object 104 indicate the direction of light emitted from the light source 102.

[0030] As shown in FIG. 4(a), when the outer frame of the inspection object 104 is higher than the inspection surface, a shadow (shown in gray in the figure) is generated on the inspection surface, as shown in FIGS. 4(c) to 4(f). In the technology described in Patent Document 1, multiple captured image data obtained by capturing images under the illumination of the light sources 102 that constitute the multi-lamp lighting are directly used for inspection, and therefore linear irregularities cannot be properly detected in areas where shadows are generated on the inspection surface. In other words, with the technology described in Patent Document 1, when the inspection object has a three-dimensional shape, there may be areas that cannot be inspected.

[0031] <Summary and effects of this disclosure> In the present disclosure, multiple captured image data obtained by capturing images under the illumination of light sources 102 constituting multi-lamp lighting are not directly used for inspection, but a normal map of the inspection surface is obtained based on the captured image data using photometric stereo or the like. Then, relighting using a predetermined virtual light source (hereinafter referred to as "lighting") is performed to simulate the luminance distribution of the inspection surface based on the normal map, and linear irregularities are detected based on the luminance distribution.

[0032] Specifically, for example, when detecting the linear irregularities shown in FIG. 2(g), the image processing device 101 first sets a virtual light source 201 in a direction perpendicular to the direction in which the linear irregularities extend, as shown in FIG. 2(h). Next, the image processing device 101 uses a normal map to simulate the luminance distribution of the inspection surface when light is irradiated from the position of the virtual light source 201. Specifically, the light source vector L in Equation (1) i Similarly, the unit vector indicating the direction of the virtual light source 201 from the inspection surface (hereinafter referred to as the "lighting direction") is defined as the virtual light source vector L'. v Then, assuming Lambert's cosine law, the virtual light source vector L' vand each normal vector in the normal map for each position (x, y), the luminance distribution of the inspection surface is simulated to obtain lighting image data. At this time, the albedo (reflectance) at each position (x, y) on the inspection surface may be taken into consideration. Based on the lighting image data obtained in this way, the image processing device 101 detects linear features (linear irregularities) on the inspection surface.

[0033] That is, the image processing device 101 sets a virtual light source 201 so that the lighting direction is perpendicular to the extension direction of the linear unevenness to be detected, and detects the linear unevenness based on data of a lighting image obtained by lighting using the virtual light source 201. If the extension direction of the linear unevenness to be detected is the vertical direction as shown in FIG. 2(c), the image processing device 101 sets the virtual light source 201 at the position of light source 102-0 or 102-4. If the extension direction of the linear unevenness to be detected is the horizontal direction as shown in FIG. 2(e), the image processing device 101 sets the virtual light source 201 at the position of light source 102-2 or 102-6. In this way, the image processing device 101 sets the virtual light source 201 at a position corresponding to the extension direction of the linear unevenness to be detected. Here, the extension direction of the linear unevenness to be detected differs depending on the type or shape of the inspection object 104 to be inspected. Therefore, the position at which the virtual light source 201 is set may be determined depending on the type or shape of the inspection object 104 to be inspected. The type or shape of the inspection object 104 may be set by a user when inspecting the inspection object 104, or may be automatically identified using known image classification techniques.

[0034] In a dome-type multi-light illumination device as shown in FIG. 2, the actual light sources are arranged discretely, but the virtual light source can be set at any position. For example, even if there is no light source 102 in a direction perpendicular to the extension direction of the linear irregularities as shown in FIG. 2(g), if there is a virtual light source 201, the virtual light source 201 can be set in a direction perpendicular to the extension direction of the linear irregularities as shown in FIG. 2(h). In this way, it is possible to simulate the luminance distribution of the inspection surface when light is irradiated from a direction perpendicular to the extension direction of the linear irregularities. Therefore, even if the linear irregularities are minute, they can be detected with high accuracy.

[0035] According to photometric stereo, a normal map can be generated with at least three actual light sources 102. When simulating a luminance distribution using a normal map, as in the present disclosure, the number of virtual light sources can be easily increased. Therefore, it is possible to set a large number of virtual light sources, such as 180 or 360, and generate lighting images at fine intervals, such as 1° intervals. In other words, even if the number of actual light sources 102 is small, such as three or four, linear irregularities can be detected with the same accuracy as when a large number of light sources, such as 180 or 360, are actually used. As described above, according to the present disclosure, linear irregularities extending in any direction can be detected.

[0036] Furthermore, with photometric stereo, even when a shadow appears on the inspection surface, as shown in Figures 4(c) to 4(f), an accurate normal map can be generated by using, for example, the method disclosed in Japanese Patent Application Laid-Open No. 2012-122870. Specifically, when calculating the normal vector at each position (x, y) on the inspection surface using Equation (4), captured image data i corresponding to eight light sources 102-i that does not have a shadow at the position (x, y) is selected and used for each position (x, y). This allows an accurate normal map to be generated even when a shadow appears partially in each captured image data. Therefore, by using the normal map generated in this manner, linear irregularities can be detected in all regions of the inspection surface, even when the inspection object 104 has a three-dimensional shape, according to the present disclosure.

[0037] As with the case where a shadow is present on the inspection surface, when specular reflection occurs on the inspection surface, the technology disclosed in Patent Document 1 may result in regions on the inspection surface where linear irregularities cannot be detected. On the other hand, the method disclosed in the above-mentioned Japanese Patent Application Laid-Open No. 2012-122870 can generate an accurate normal map even when specular reflection occurs on the inspection surface. Therefore, by using the normal map generated in this manner, according to the present disclosure, linear irregularities can be detected in all regions on the inspection surface even when specular reflection occurs on the inspection surface.

[0038] Japanese Patent Application Laid-Open Publication No. 2015-232476 discloses a technique for detecting irregularities present on an inspection surface based on a height map obtained from a normal map. Japanese Patent Application Laid-Open Publication No. 2003-240539 discloses a technique for detecting the presence of unintended irregularities on an inspection surface based on a value obtained by calculating an angle between a normal line of an object to be inspected and a normal line of a non-defective product for each position on the inspection surface and adding up the angles across all pixels.

[0039] While these two techniques, like the present disclosure, detect unevenness based on a normal map, they do not detect unevenness by taking into account the degree of unevenness perceived by natural humans. Specifically, these two techniques do not consider the degree of shading caused by unevenness that can be seen when light is shone on the surface when detecting unevenness. As a result, they may judge unevenness that cannot be perceived visually as "uneven," or conversely, judge unevenness that can be perceived visually as "uneven." In contrast, the method of the present disclosure detects linear unevenness based on data from an image (lighting image) obtained by simulating a luminance distribution corresponding to the appearance of the inspection surface when illuminated by a virtual light source. Therefore, according to the present disclosure, linear unevenness can be detected by taking into account the degree of unevenness perceived visually by natural humans.

[0040] The method for simulating the luminance distribution of the inspection surface is not limited to the above-described method. For example, the luminance distribution of the inspection surface may be simulated by assuming other known physical models other than Lambert's cosine law, such as models that consider not only diffuse reflection but also specular reflection. In this case, the information, such as the normal map, albedo map, or shape information of the object to be inspected used in the physical simulation, may be acquired by any known method, not limited to the photometric stereo method described above. Furthermore, the image processing device 101 may use position information of the light source 102 or virtual light source 201 instead of the light source vector or virtual light source vector described above. Furthermore, the image processing device 101 may simulate a luminance distribution according to information indicating a virtual viewpoint or the position of the image capture device 103. Furthermore, the linear feature to be detected is not limited to linear irregularities. For example, the appearance of specular reflection due to gloss varies depending on the lighting direction. Therefore, linear gloss unevenness may be detected using the configuration of the present disclosure. Specifically, in this case, for example, the virtual viewpoint is set in the direction of specular reflection light when lighting is performed using a virtual light source. Furthermore, when the object to be inspected has eccentric reflectance characteristics, the present disclosure can also detect linear variations in eccentric reflectance. Furthermore, the linear feature may have a line orientation that varies depending on the location. For example, the configuration of the present disclosure can also detect linear irregularities that are circular, such as linear irregularities that occur along a circular frame. The following describes specific embodiments of the present disclosure.

[0041] [Embodiment 1] An image processing device 101 according to the first embodiment will be described with reference to Figs. 5 and 6. Fig. 5(a) is a block diagram showing an example of the functional configuration of the image processing device 101 according to the first embodiment. The image processing device 101 has, as its functional configuration, a light source control unit 500, an image acquisition unit 501, a normal map acquisition unit 502, a virtual light source vector setting unit 503, a correlation map generation unit 504, and a detection unit 505. The processing of each functional configuration is realized by the CPU 106 executing program code expanded in the RAM 105.

[0042] 6(a) is a flowchart showing an example of a processing flow in the image processing device 101 according to the first embodiment. First, in S601, the image acquisition unit 501 controls the imaging device 103 to capture an image of the inspection surface, and acquires captured image data obtained by the imaging. Specifically, the image acquisition unit 501 operates in conjunction with the light source control unit 500, and while the light source control unit 500 turns on the light source 102 in a predetermined order, causes the imaging device 103 to capture images multiple times, thereby acquiring multiple pieces of captured image data.

[0043] Next, in S602, normal map acquisition unit 502 generates and acquires a normal map according to equation (4) using the multiple captured image data acquired in S601. Next, in S603, virtual light source vector setting unit 503 sets a virtual light source vector that indicates the irradiation direction of light from the virtual light source. Specifically, for example, as shown in FIG. 2(h), virtual light source vector setting unit 503 sets virtual light source 201 between light source 102-0 and light source 102-1, and sets a virtual light source vector corresponding to the position of this virtual light source 201.

[0044] Next, in S604, the correlation map generation unit 504 generates a lighting image by simulating the luminance distribution of the inspection surface of the inspection object 104 based on the normal map acquired in S602 and the virtual light source vector set in S603. As will be described later, the lighting image is generated based on the similarity between the normal vector at each position on the inspection surface in the normal map and the virtual light source vector. That is, the luminance in the lighting image is not limited to physical luminance, but may also represent conceptual luminance. Therefore, hereinafter, the lighting image is referred to as a correlation map. Next, in S605, the detection unit 505 detects linear irregularities on the inspection surface based on the correlation map generated in S604. The detection unit 505 outputs information indicating the detection result (hereinafter referred to as "detection result information") to an external device (not shown), for example, via the interface 108 and the external bus 110. After S605, the image processing device 101 ends the processing of the flowchart shown in FIG. 6(a).

[0045] 5(b), 5(c), and 5(d) are diagrams illustrating an example of the internal configuration of the detection unit 505 according to the first embodiment. For example, the detection unit 505 includes a threshold processing unit 507 as shown in FIG. 5(c). When the detection unit 505 has the configuration shown in FIG. 5(c), the threshold processing unit 507 applies threshold processing to the correlation map. For example, when there are pixels in the correlation map that exceed a predetermined threshold, the detection unit 505 determines that linear irregularities exist on the inspection surface. Furthermore, for example, the detection unit 505 may include a filter processing unit 506 and a threshold processing unit 507 as shown in FIG. 5(d). When the detection unit 505 has the configuration shown in FIG. 5(d), the filter processing unit 506 applies filter processing to the correlation map before the threshold processing by the threshold processing unit 507. At this time, the filter processing uses filter coefficients whose weights are distributed in the direction of the linear irregularities to be detected, i.e., filter coefficients whose weights are distributed in a direction perpendicular to the lighting direction of the virtual light source, thereby improving the accuracy of determination in the threshold processing. 5(b), the detection unit 505 may be configured to perform only filtering without performing threshold processing. Note that the above-mentioned threshold may be input by a user operation, or may be held by the threshold processing unit 507.

[0046] Note that the method for detecting linear irregularities is not limited to these methods. For example, the detection unit 505 may input a correlation map into a trained model obtained by machine learning or the like to determine the presence or absence of linear irregularities on the inspection surface, classify the orientation of the linear irregularities, or classify the detected linear irregularities into concave or convex surfaces. Furthermore, for example, the detection unit 505 may acquire a difference image from reference data serving as a standard, and detect linear irregularities based on the acquired difference image. Here, the reference data is, for example, a correlation map generated in advance using the inspection object 104 whose inspection surface has been confirmed to be free of unintended irregularities such as defects.

[0047] According to the image processing device 101 configured as described above, by setting a virtual light source at an arbitrary position, linear unevenness can be detected in the same manner as when an actual light source 102 is placed at that position. Therefore, even if the linear unevenness is minute, linear unevenness extending in any direction can be detected. Note that the image processing device 101 may output, in addition to the detection result information, data such as the generated correlation map or a filtered image obtained by filtering the correlation map. By checking the data such as the correlation map or the filtered image, the user can confirm the linear unevenness detection process.

[0048] The details of the processing in S604 will be described with reference to Fig. 6(b). Fig. 6(b) is a flowchart showing an example of the processing flow performed by the correlation map generation unit 504 according to the first embodiment in S604. The correlation map generation unit 504 performs the processing of S607 for all pixels in the normal map. Specifically, in S606, the correlation map generation unit 504 performs the processing of S607 for pixel k in the normal map to be processed in S607, starting from pixel k at the start position. 開始 Next, in S607, the correlation map generation unit 504 calculates the similarity between the normal vector of pixel k in the normal map and the virtual light source vector, and sets the calculated similarity as the value of pixel k in the correlation map.

[0049] The similarity is an index that monotonically increases or decreases with the magnitude of the angle between the normal vector and the virtual light source vector. In this embodiment, the similarity increases as the angle decreases. Specifically, for example, the similarity I at pixel k is k is the normal vector (N x ,N y ,N z ) T and the virtual light source vector L´=(L´ vx ,L´ vy ,L´ vz ) T It is obtained by calculating the dot product with I k =N x L´ vx+N y L´ vy +N z L´ vz ··· Equation (7)

[0050] Also, the similarity I k As shown in the following equation (8), the albedo ρ at pixel k is added to the calculation result of equation (7). k As mentioned above, the albedo ρ k is obtained by equation (5). I k = ρ k (N x L´ vx +N y L´ vy +N z L´ vz )...Equation (8)

[0051] The similarity I obtained by Eq. (8) k corresponds to the luminance distribution of the inspection surface when Lambert's cosine law is assumed. Therefore, equation (8) can accurately simulate the unevenness that humans perceive visually. On the other hand, in equation (8), the albedo ρ k When is set to 1, equation (8) coincides with equation (7). That is, equation (7) corresponds to the luminance distribution when it is assumed that the inspection surface is completely white. Therefore, when the albedo of the inspection surface is not constant, that is, when there are differences in shade on the inspection surface, by using equation (7), it is possible to detect unevenness on the inspection surface without being affected by the differences in shade. Note that the albedo ρ in equation (8) k The same effect can be obtained by making k a constant for all pixels k.

[0052] Furthermore, if the irregularities in the detection target are minute and the inspection surface (xy plane) is almost flat, the vertical component (z component) of the normal vector will have a value close to 1 at any position on the inspection surface. Therefore, in equation (7) or equation (8), the contribution of the third term on the right hand side, which has the z component, will be large. As a result, even if the values ​​of each component of the normal vector change due to a change in the direction of the normal vector caused by irregularities on the inspection surface, the third term on the right hand side will be dominant, and the influence of the first or second term on the right hand side will be overshadowed. In such a case, by using the following equation (9) or (10), which deletes the third term on the right hand side from equations (7) and (8), the influence of the irregularities on the inspection surface can be reduced by 1. k This makes it easier for the linear irregularities to be reflected in the image, improving the accuracy of detecting linear irregularities. I k =N x L´ vx +N y L´ vy ··· Equation (9) I k =ρ k (N x L´ vx +N y L´ vy )...Equation (10)

[0053] In addition, in equations (7) and (8), L', which is the z component of the virtual light source vector, vz When is set to 0, Equations (7) and (8) become equal to Equations (9) and (10), respectively. That is, Equations (9) and (10) correspond to the luminance distribution when a virtual light source is set at the same height as the inspection surface, i.e., on the xy plane, and the inspection surface is illuminated from directly beside it. Therefore, when the irregularities to be detected are minute, the detection accuracy of linear irregularities is improved by setting the virtual light source at the same height as the inspection surface, i.e., on the xy plane. In this way, the detection accuracy of linear irregularities improves as the height at which the virtual light source is set decreases, so the detection sensitivity of linear irregularities can be adjusted by changing the height of the virtual light source.

[0054] In equations (7) to (10), if the angle between the normal vector and the virtual light source vector is large, the left sides may take negative values. For example, in FIG. 3(d), when determining the luminance distribution of the inspection surface when the light source vector is replaced with the virtual light source vector, the left sides of equations (7) to (10) may take negative values ​​for the slopes formed by the linear irregularities that are on the same side as the light source 102-0 that is turned on. On the other hand, the left sides take positive values ​​for the slopes on the opposite side of the light source 102-0. In this way, the signs are reversed between one slope and the other slope opposite it, resulting in a change in light and dark as shown in FIG. 3(e), which may reduce the detection accuracy of the linear irregularities in the detection unit 505.

[0055] That is, in order to improve the detection accuracy in the detection unit 505, it is desirable to use an index in which the sign of the similarity does not change. For example, negative values ​​are limited to values ​​equal to or greater than 0 so that the values ​​of equations (7) to (10) do not become negative. With reference to FIG. 6(c), an example in which a negative similarity value is changed to a positive value will be described. FIG. 6(c) is a flowchart showing an example of the processing flow performed in S607 by the correlation map generation unit 504 according to the first embodiment.

[0056] First, in S610, the correlation map generation unit 504 calculates the dot product of a vector obtained by projecting the normal vector onto the horizontal plane (xy plane) and a vector obtained by projecting the virtual light source vector onto the horizontal plane (xy plane) using equation (9). That is, the correlation map generation unit 504 calculates a value corresponding to the luminance when the inspection surface is lit from just beside it. Next, in S611, the correlation map generation unit 504 determines whether the value calculated in S610 is negative. If it is determined in S611 that the value is negative, in S612, the correlation map generation unit 504 inverts the signs of the horizontal components (x component and y component) of the normal vector.

[0057] After S612, or if it is determined in S611 that the value is not negative, in S613, the correlation map generation unit 504 calculates the luminance of the inspection surface using equation (7). That is, if the value calculated in S610 is negative, the correlation map generation unit 504 inverts the sign of the horizontal component (xy plane) of the normal vector and then calculates the dot product of the normal vector and the virtual light source vector. Because the virtual light source 201 is set at a position higher than the inspection surface, the third term on the right side of equation (7) is always 0 or greater. Therefore, the index calculated by the processing of the flowchart shown in FIG. 6(c) is always 0 or greater. As a result, the detection accuracy of linear irregularities in the detection unit 505 is improved compared to when an index calculated simply using equation (7) is used.

[0058] After S613, the image processing device 101 ends the processing of the flowchart shown in Fig. 6(c), and after the end, executes the processing of S608. In S608, the correlation map generating unit 504 sets the next pixel (for example, pixel k+1) to pixel k. Next, in S609, the correlation map generating unit 504 sets pixel k to the next pixel (for example, pixel k+1). 終了 In step S609, it is determined whether pixel k reaches pixel k. 終了 If it is determined that the pixel k has not reached the pixel k 終了 The processes from S607 to S609 are repeated until it is determined that pixel k has reached pixel k. 終了 If it is determined that the number of times has reached the limit, the image processing apparatus 101 ends the processing of the flowchart shown in FIG. 6B, and after the end, executes the processing of S605.

[0059] [Embodiment 2] In this embodiment, a form will be described in which a plurality of linear unevennesses having different extending directions are detected by setting a plurality of virtual light sources having different lighting directions. FIG. 7 is a block diagram showing an example of the functional configuration of an image processing device 101 (hereinafter simply referred to as "image processing device 101") according to embodiment 2. The image processing device 101 has, as its functional configuration, a light source control unit 500, an image acquisition unit 501, a normal map acquisition unit 502, a virtual light source vector setting unit 701, a plurality of correlation map generation units 504 (504A to 504D), and a detection unit 702. The processing of each functional configuration is realized by the CPU 106 executing program codes expanded in the RAM 105.

[0060] 8 is a flowchart showing an example of a processing flow in the image processing device 101 according to the second embodiment. Hereinafter, the processing contents of each functional configuration and the operation of the image processing device 101 will be described with reference to FIGS. 7 and 8. First, the image processing device 101 executes the processes of S601 and S602. After S602, in S803, the virtual light source vector setting unit 701 sets a plurality of virtual light source vectors (hereinafter referred to as a "set of virtual light source vectors") having mutually different lighting directions.

[0061] 9 is a diagram showing an example of the arrangement of virtual light sources 201 set by the image processing device 101 according to the second embodiment. Specifically, FIGS. 9(a), (c), (e), and (g) show an example of the arrangement of virtual light sources 201 when the inspection system 1 is viewed from the side. Also, FIGS. 9(b), (d), (f), and (h) to (n) show an example of the arrangement of virtual light sources 201 when the inspection system 1 is viewed from above. In FIGS. 9(c) to 9(n), virtual light sources 201 that are turned on are represented by hollow rectangles, and virtual light sources 201 that are not turned on are represented by solid rectangles. Specifically, when a correlation map is generated by any of the correlation map generation units 504A to 504D, the virtual light source vector setting unit 701 sets virtual light source vectors when the virtual light sources 201 shown by hollow rectangles are turned on one by one. More specifically, for example, the virtual light source vector setting unit 701 sets a set of virtual light source vectors when the inspection surface is illuminated from four directions using a virtual light source 201 set at the same height as the inspection surface of the inspection object 104, as shown in Figure 9(j).

[0062] By executing the processes from S804 to S808, image processing device 101 generates a plurality of correlation maps based on each virtual light source vector included in the set of virtual light source vectors, and detects linear unevenness extending in different directions based on each correlation map. Specifically, image processing device 101 repeatedly executes the processes from S805 to S808 according to the number of virtual light source vectors included in the set of virtual light source vectors set in S803.

[0063] More specifically, in S804, virtual light source vector setting unit 701 determines the start position θ of the virtual light source vector θ of interest. 開始Next, in S805, one of correlation map generation units 504A to 504D generates a correlation map corresponding to virtual light source vector θ. Specifically, the correlation map corresponding to virtual light source vector θ is generated by one of correlation map generation units 504A to 504D corresponding to virtual light source vector θ in the same manner as in S604. This makes linear irregularities extending in a direction perpendicular to the virtual light source vector θ of interest apparent. For example, if virtual light source vector θ corresponds to the case in which light from the virtual light source is irradiated from the right in FIG. 7, correlation map generation unit 504C generates a correlation map. At this time, the correlation map generated by correlation map generation unit 504C makes linear irregularities extending in the vertical (up and down) direction in FIG. 7 apparent.

[0064] Next, in S806, detection unit 702 detects linear irregularities extending in a direction perpendicular to virtual light source vector θ based on the correlation map generated in S805. Specifically, detection unit 702 applies a spatial filter to the correlation map generated in S805. Detection unit 702 includes multiple filter processing units 506 (506A to 506D), a maximum value calculation unit 703, and a threshold processing unit 507. Each filter processing unit 506A to 506D applies a spatial filter to the correlation map generated by the corresponding correlation map generation unit 504A to 504D. This detects linear irregularities extending in a direction perpendicular to virtual light source vector θ. For example, in FIG. 7, if virtual light source vector θ corresponds to the case where light from virtual light source 201 is irradiated from the right, correlation map generation unit 504C generates a correlation map, and filter processing unit 506C applies a spatial filter to the correlation map. This detects linear irregularities extending in the vertical (up and down) direction in FIG. 7.

[0065] In this case, as shown in FIG. 7 , the spatial filter uses filter coefficients whose weights are distributed in the direction of the linear irregularity to be detected, i.e., filter coefficients whose weights are distributed in the direction perpendicular to the lighting direction of the turned-on virtual light source 201. This improves the accuracy of the threshold processing in S810, which will be described later. The filter coefficients are generated by the filter processing units 506A to 506D based on the direction of the virtual light source vector set by the virtual light source vector setting unit 701. The filter coefficients may be generated in advance by a user or the like. In this embodiment, a directional linear pattern as shown in FIG. 7 is described as being used as the filter coefficients. However, an anisotropic Gaussian filter or a DoG (Difference of two Gaussian) filter may also be used. For example, the filter processing units 506A to 506D may include a means for acquiring an inspection scale, such as the length or width of the linear irregularity to be detected, and may generate spatial filters by determining filter coefficients based on the acquired inspection scale. This allows the image processing device 101 to detect linear irregularities of a desired scale. The inspection scale may be input by a user operation, or may be acquired by reading data of a previously prepared inspection scale, for example.

[0066] In S807, virtual light source vector setting unit 701 adds a step value corresponding to the number of virtual light source vectors included in the set of multiple virtual light source vectors set in S803 to the virtual light source vector θ, and sets a new virtual light source vector θ. Next, in S808, virtual light source vector setting unit 701 checks whether the virtual light source vector θ reaches the end condition of θ, 終了 In step S808, it is determined whether the virtual light source vector θ reaches θ 終了 If it is determined that the virtual light source vector θ does not reach θ 終了The processes from S805 to S808 are repeated until it is determined that the number of virtual light source vectors reaches 1. For example, when four virtual light source vectors are set as the set of virtual light source vectors, specifically when light is emitted sequentially from virtual light sources in four directions, namely, from above, to the upper right, to the right, and to the lower right in FIG. 9(i), the number of repetitions of S805 to S808 is four.

[0067] In S808, the virtual light source vector θ is θ 終了 If it is determined that the maximum value has reached the maximum value, the image processing device 101 executes the process of S809. In S809, the maximum value calculation unit 703 acquires maximum value image data based on the data of the four filter images output by the plurality of filter processing units 506A to 506D. Specifically, the maximum value calculation unit 703 compares the pixel values ​​corresponding to each position (x, y) on the inspection surface in each of the four filter images and sets the maximum value as the pixel value corresponding to each position (x, y), thereby acquiring maximum value image data. In this way, the linear irregularities for each virtual light source vector detected by the repeated process of S806 are integrated.

[0068] Next, in S810, the threshold processing unit 507 performs threshold processing on the data of the maximum value image generated in S809. As a result, linear irregularities on the inspection surface are detected. Specifically, the threshold processing unit 507 applies threshold processing to the data of the maximum value image similar to the processing performed by the threshold processing unit 507 in the detection unit 505 shown in FIG. 5(c). More specifically, for example, if there is a pixel in the data of the maximum value image that exceeds a predetermined threshold, the threshold processing unit 507 determines that linear irregularities are present on the inspection surface. Note that the image processing device 101 may include means for acquiring a threshold, and the threshold processing unit 507 may perform threshold processing based on the threshold acquired by that means.

[0069] The image processing device 101 configured as described above, as in the first embodiment, can detect linear irregularities extending in any direction even if the linear irregularities are minute. Furthermore, the image processing device 101 according to this embodiment can detect multiple linear irregularities extending in different directions by setting multiple virtual light sources 201 with different lighting directions. Furthermore, when applying filtering to the correlation map, the image processing device 101 according to this embodiment uses filter coefficients in which weights are distributed in a direction perpendicular to the lighting direction of the virtual light source 201. By using such filter coefficients, the image processing device 101 according to this embodiment can further emphasize or make more apparent linear irregularities extending in a predetermined direction that are apparent in the correlation map. As a result, the image processing device 101 according to this embodiment can reduce the number of linear irregularities that should be detected but are not detected, or the number of erroneous detections of linear irregularities that should not be detected, thereby improving the accuracy of linear irregularity detection.

[0070] [Modification 1 of Embodiment 2] Next, as a first modification of the second embodiment (hereinafter simply referred to as the "modification"), an example of a set of virtual light source vectors set by the virtual light source vector setting unit 701 will be described with reference to FIG. 9. As described above, FIGS. 9(a), (c), (e), and (g) are diagrams showing an example of the arrangement of the virtual light sources 201 when the inspection system 1 is viewed from the side. Meanwhile, FIGS. 9(b), (d), (f), and (h) to (n) are diagrams showing an example of the arrangement of the virtual light sources 201 when the inspection system 1 is viewed from above. In all of FIGS. 9(c) to (n), virtual light sources 201 that are turned on are represented by hollow rectangles, and virtual light sources 201 that are not turned on are represented by solid rectangles. Specifically, when generating a correlation map, the virtual light source vector setting unit 701 turns on the virtual light sources 201 represented by hollow rectangles one by one.

[0071] In the examples of FIGS. 9(c) and 9(d), the virtual light sources 201 to be turned on are set at equal intervals so that the angles formed by the two line segments connecting two adjacent virtual light sources 201 and the axis passing through the center of the inspection surface and perpendicular to the inspection surface are equal. By setting the virtual light sources 201 to be turned on so that the angles are equal, the detection sensitivity of linear irregularities in each direction can be made constant. If, as shown in FIG. 9(k), some of the virtual light sources 201, such as the virtual light sources 201 at the upper right and lower left in FIG. 9(k), are not turned on to make the intervals between the angles unequal, the detection sensitivity of linear irregularities in each direction will vary. Specifically, for example, in the case of FIG. 9(k), the virtual light sources 201 at the upper right and lower left in FIG. 9(k) are not turned on, so that linear irregularities extending from the upper left to the lower right in FIG. 9(k) are more difficult to detect than linear irregularities extending in other directions.

[0072] 9(c) and 9(d), the multiple virtual light sources 201 to be turned on are set to have the same height from the plane including the inspection surface. As described above, according to equations (9) and (10), the lower the height of the virtual light source 201, that is, the closer the position of the virtual light source 201 is to the plane including the inspection surface, the higher the detection sensitivity of the linear irregularities. Therefore, by making the heights of the virtual light sources 201 uniform as shown in FIGS. 9(c) and 9(d), the detection sensitivity in each direction can be made constant. If, as shown in FIG. 9(l), the virtual light sources 201 at the upper right and lower left in FIG. 9(l) are set at higher positions than the other virtual light sources 201, the linear irregularities extending from the upper left to the lower right in FIG. 9(l) will be more difficult to detect than the linear irregularities extending in other directions.

[0073] In the examples of FIGS. 9( g) and 9( h), multiple virtual light sources 201 are arranged at the same height as the inspection surface. Lighting the inspection surface from a direction parallel to the inspection surface in this manner maximizes the detection sensitivity of linear irregularities. The closer the virtual light source 201 is positioned to a plane including the inspection surface, the higher the detection sensitivity of linear irregularities. Therefore, if a user desires a high detection sensitivity, the virtual light source 201 may be positioned closer to the plane including the inspection surface. For example, when the detection sensitivity of linear irregularities is set high, the virtual light sources 201 in FIGS. 9( g) and 9( h) are used, and when it is set low, the virtual light sources 201 in FIGS. 9( c) and 9( d) are used. When it is set somewhere between these two levels, the virtual light sources 201 in FIGS. 9( e) and 9( f) are used.

[0074] Furthermore, the detection sensitivity of linear unevenness in each direction changes depending on the number of virtual light sources 201 to be set, i.e., the number of virtual light sources 201 to be turned on. Therefore, the higher the detection sensitivity desired by the user, the more virtual light sources 201 to be turned on. For example, when the detection sensitivity of linear unevenness is set high, the virtual light source 201 in FIG. 9(h) is used, and when it is set low, the virtual light source 201 in FIG. 9(i) is used.

[0075] Furthermore, the more virtual light sources 201 are set, i.e., the more virtual light sources 201 are turned on, the more correlation maps are generated in proportion to the number of virtual light sources 201, resulting in an increased processing load. Therefore, the faster the inspection speed desired by the user, the fewer virtual light sources 201 may be turned on. For example, when a slow inspection speed is set, the virtual light source 201 in FIG. 9( h) is used, and when a fast inspection speed is set, the virtual light source 201 in FIG. 9( j) is used. The virtual light sources 201 in FIG. 9( j) have the above-mentioned uneven angles. However, in FIG. 9( j ), one of the two virtual light sources 201 in FIG. 9( h ) that are opposed to an axis that passes through the center of the inspection surface and is perpendicular to the inspection surface is set. Therefore, when the virtual light source 201 in FIG. 9( j ) is set, an inspection substantially equivalent to the inspection when the virtual light source 201 in FIG. 9( h ) is set can be performed. This is because lighting from half (e.g., 180°) of the direction of the object to be inspected (e.g., 360°) can illuminate one of the two slopes of the linear irregularities extending in any direction on the inspection surface, as shown in Figures 3(a) to 3(d).

[0076] FIG. 9(o) shows an example of the inspection surface of the inspection object 104 on which a periodic linear uneven pattern is formed. As shown in FIG. 9(o), when the inspection surface of the inspection object 104 has a periodic linear uneven pattern formed thereon, different detection sensitivities may be set for the direction corresponding to the linear uneven pattern and other directions. For example, the detection sensitivity in the direction corresponding to the linear uneven pattern may be lowered so as not to detect the periodic linear uneven pattern. For example, the linear uneven pattern shown in FIG. 9(o) is formed by arranging multiple linear uneven patterns parallel to each other, extending from the upper left to the lower right in FIG. 9(o). Therefore, for example, as shown in FIG. 9(k), the upper right and lower left virtual light sources 201 may be turned off. Alternatively, for example, as shown in FIG. 9(l), the upper right and lower left virtual light sources 201 may be set at higher positions than the other virtual light sources 201. Conversely, when inspecting a periodic linear concave-convex pattern with emphasis, for example, as shown in Fig. 9(m), virtual light sources 201 at the upper right and lower left are set at positions lower than the other virtual light sources 201. Also, for example, as shown in Fig. 9(n), by increasing the number of virtual light sources 201 set at the upper right and lower left, the resolution in the height direction may be increased in the directions from the upper right and the lower left.

[0077] Furthermore, the linear irregularities to be detected may differ depending on the type of inspection object to be inspected. Therefore, the set of virtual light sources 201 may be switched depending on the type of inspection object based on a setting made by the user. FIG. 9(p) shows an example of a set of virtual light sources 201 set for each type of inspection object. For example, as shown in FIG. 9(p), the set of virtual light sources 201 shown in FIG. 9(n) is used for inspecting product A, the set of virtual light sources 201 shown in FIG. 9(h) is used for inspecting product B, and the set of virtual light sources 201 shown in FIG. 9(i) is used for inspecting product C. Note that the type of inspection object may be automatically identified using a known image classification technique, and the set of virtual light sources 201 may be switched based on the identified type of inspection object.

[0078] Furthermore, in industrial products to be inspected, defects due to linear irregularities along the outer frame of the inspection surface may occur. For example, if the inspection surface of an industrial product to be inspected has a circular frame, circular linear irregularities may occur along the frame. If the inspection surface has a rectangular frame, rectangular linear irregularities may occur along the frame. FIG. 9(q) shows an example of a set of virtual light sources 201 set for each shape of the inspection surface frame. In the inspection of such industrial products, for example, as shown in FIG. 9(q), the set of virtual light sources 201 is switched depending on the shape of the inspection surface frame. This allows for highly accurate detection of linear irregularities along the inspection surface frame, even if the shape of the inspection surface frame varies for each inspection object. If the inspection surface frame is circular, high resolution is required at all angles, so for example, the set of virtual light sources 201 shown in FIG. 9(h) is used. On the other hand, if the inspection surface frame is rectangular, lighting is required from directions perpendicular to the four sides of the frame, so for example, the set of virtual light sources 201 shown in FIG. 9(i) is used. Note that the shape of the frame of the inspection surface to be inspected may be set by the user. The image may be automatically identified using known image classification techniques.

[0079] Although this modification shows an example in which virtual light sources 201 are turned on one by one, multiple virtual light sources 201 may be turned on simultaneously. For example, by turning on all virtual light sources 201 simultaneously, it is possible to simulate a correlation map corresponding to the appearance of unevenness under uniform illumination. Furthermore, by turning on virtual light sources 201 at point-symmetric positions simultaneously, the alternation of light and dark as shown in FIG. 3(e) is alleviated, thereby improving the detection accuracy of linear unevenness in detection unit 702.

[0080] [Embodiment 3] As explained in the first modification of the second embodiment, in the visual inspection of industrial products, there is a need to detect linear irregularities with a characteristic direction, such as defects caused by linear irregularities along the frame of the inspection surface. In this case, if the frame of the inspection surface is rectangular, it is possible to detect linear irregularities along the rectangular frame by using, for example, a set of virtual light sources 201 shown in FIG. 9(i).

[0081] Meanwhile, in industrial production lines, the posture of an object to be inspected may change during visual inspection (hereinafter referred to as "posture fluctuation"). For example, the surface to be inspected may rotate around an axis perpendicular to the surface to be inspected. Fig. 10 is a diagram for explaining an example of posture fluctuation. Fig. 10(a) shows an example of a normal vector at point P on the surface to be inspected when there is no posture fluctuation due to rotation, and Fig. 10(b) shows an example of a normal vector at point P on the surface to be inspected when there is no posture fluctuation due to rotation, and err 10(b) shows an example of a normal vector at point P on the inspection surface when the boundary surface is rotated by θ. When a normal map is acquired by photometric stereo, if the posture of the inspection object changes, the resulting normal map 1001 will be tilted as the posture of the inspection object changes, as shown in FIG. 10(b). As a result, the angle between the normal vector and the virtual light source vector at point P will change. Here, as shown in FIG. 10(a), if the angle between the normal vector and the virtual light source vector when there is no posture change of the inspection object is θ, the normal map 1001 shown in FIG. 10(b) will be tilted by θ as the posture change occurs. err As a result, in the normal map 1001 shown in FIG. 10(b), the angle formed by the normal vector and the virtual light source vector at point P is θ+θ err becomes.

[0082] In this way, when the angle between the normal vector and the virtual light source vector changes due to a change in the posture of the object to be inspected, the virtual light source may not strike linear irregularities with a characteristic direction, such as linear irregularities along a rectangular frame, perpendicularly. As a result, the shadows cast by the linear irregularities on the correlation map become weaker than when the virtual light source strikes them perpendicularly, making it impossible to detect fine linear irregularities.

[0083] In this embodiment, a description will be given of a mode in which the amount of variation in the posture of the target object (hereinafter referred to as "posture variation parameter") is acquired, and the normal map is aligned based on the acquired posture variation parameter. FIG. 10(c) shows an example of a normal map that has been aligned by applying a rotation process to the normal map 1001 of FIG. 10(b). As shown in FIG. 10(c), the rotation angle θ of the normal map 1001 is changed by the rotation process. erris corrected to 0. However, simply aligning the normal map 1001 in this way does not correct the orientation of each normal vector included in the normal map 1001. Specifically, for example, as shown in FIG. 10(c), simply aligning the normal map 1001 causes the angle between the normal vector and the virtual light source vector at point P to be θ+θ err does not change from

[0084] Therefore, as shown in FIG. 10(d), the direction of each normal vector included in the normal map is corrected. As a result, the angle between each normal vector included in the normal map and the virtual light source vector is corrected to the angle when there is no posture change, as shown in FIG. 10(a). For example, in FIG. 10(d), the angle between the normal vector and the virtual light source vector at point P becomes equal to the angle between the normal vector and the virtual light source vector shown in FIG. 10(a). Furthermore, a correlation map from which the influence of posture change has been removed is generated based on the normal map after rotation processing for aligning the normal map and correction processing for the direction of each normal vector. By detecting linear irregularities using this correlation map, detection accuracy equivalent to that when there is no posture change can be achieved.

[0085] 11 is a block diagram showing an example of the functional configuration of an image processing device 101 according to the third embodiment (hereinafter simply referred to as "image processing device 101"). The image processing device 101 has, as its functional configuration, a light source control unit 500, an image acquisition unit 501, a normal map acquisition unit 502, a virtual light source vector setting unit 503, a correlation map generation unit 504, and a detection unit 505. In addition to the functional configuration, the image processing device 101 further has the above-mentioned posture variation acquisition unit 1101, a position adjustment unit 1102, and a normal vector correction unit 1103. The processing of each functional configuration is realized by the CPU 106 executing program codes expanded in the RAM 105.

[0086] FIG. 12 is a flowchart showing an example of a processing flow in the image processing device 101 according to the third embodiment. Hereinafter, with reference to FIGS. 11 and 12, the processing contents of each functional configuration of the image processing device 101 and the operation of the image processing device 101 will be described. First, the image processing device 101 executes the processes of S601 and S602. After S602, in S1201, the posture change acquisition unit 1101 acquires posture change parameters of the object to be inspected. For example, if the shape of the object to be inspected is rectangular, the posture change acquisition unit 1101 first identifies the coordinates of each of the four corners of the object to be inspected based on the captured image data acquired in S601. Next, the posture change acquisition unit 1101 calculates and acquires posture change parameters of the object to be inspected based on the correspondence between the identified coordinates of the four corners and the coordinates of the four corners when there is no posture change. In this embodiment, the description will be given assuming that a rotation angle around the z-axis (vertical axis) is acquired as the posture change parameter.

[0087] The method for acquiring the posture change parameters is not limited to the above-described method, and the posture change parameters may be acquired by other known sensing methods. The posture change parameters are not limited to the rotation angle around the z-axis (vertical axis), and the posture change acquisition unit 1101 may acquire the rotation angle around the x-axis, the rotation angle around the y-axis, or a combination of these rotation angles as the posture change parameters. The posture change parameters are not limited to the rotation angle around each axis, and the posture change acquisition unit 1101 may acquire the amount of translation in each axis direction as the posture change parameter.

[0088] Next, in S1202, the alignment unit 1102 aligns the position of the normal map acquired in S1201 based on the posture variation parameters acquired in S1201. Next, in S1203, the normal vector correction unit 1103 corrects the direction of each normal vector included in the aligned normal map output by the alignment unit 1102. After S1203, the image processing device 101 executes the processes from S603 to S605, and after the process of S605, ends the process of the flowchart shown in Fig. 12. Note that, in S604, the image processing device 101 according to this embodiment generates a correlation map based on the normal map after the normal vector correction unit 1103 corrected the direction of the normal vector.

[0089] According to the image processing device 101 configured as above, even if the posture of the object to be inspected changes, it is possible to obtain detection accuracy equivalent to that obtained when the first embodiment is applied under conditions where there is no posture change. Note that a change in the angle between the normal vector and the virtual light source vector due to posture change is corrected in the processing of S1203. Therefore, the alignment processing in S1202 is not essential. In other words, the same effect can be obtained even if a configuration is used in which the alignment unit 1102 is omitted.

[0090] [Embodiment 4] As described with reference to FIG. 7 , the image processing device 101 according to the second embodiment first generates a correlation map by lighting using a virtual light source and then visualizes linear irregularities extending in a direction perpendicular to the virtual light source vector. Furthermore, the image processing device 101 according to the second embodiment applies filtering to the correlation map using filter coefficients whose weights are distributed in a direction perpendicular to the virtual light source vector, i.e., in the direction of the linear irregularities visualized by the virtual light source. This further emphasizes or visualizes the linear irregularities visualized by lighting using the virtual light source, thereby improving the accuracy of linear irregularity detection. As described above, the image processing device 101 according to the second embodiment performs two-stage processing, consisting of a process for generating a correlation map by lighting using a virtual light source and a filter process for the correlation map. In contrast, a fourth embodiment will be described in which processing equivalent to the two-stage processing is performed in a single stage. The image processing device according to this embodiment reduces the processing load compared to the image processing device 101 according to the second embodiment, and makes it easier to implement a processing circuit such as an ASIC (application specific integrated circuit) or FPGA (field-programmable gate array) that corresponds to the processing of a program or program code in the CPU 106.

[0091] 13(a) is a block diagram showing an example of the functional configuration of an image processing device 101 according to the fourth embodiment. The image processing device 101 has, as its functional configuration, a light source control unit 500, an image acquisition unit 501, a normal map acquisition unit 502, a virtual light source vector setting unit 701, and a detection unit 1301. The processing of each functional configuration is realized by the CPU 106 executing program code expanded in the RAM 105. The processing content of each functional configuration of the image processing device 101 will be described later.

[0092] Fig. 14 is a diagram for explaining an example of processing by the image processing device 101 according to the fourth embodiment. Fig. 14(a) shows how the process of generating a correlation map by lighting with a virtual light source, which is one of the two-stage processes in the image processing device 101 according to the second embodiment, is performed using equation (7). That is, the correlation map is generated by pointwise convolution (hereinafter referred to as "convolution") of a normal map and a virtual light source vector. Fig. 14(b) shows how filtering is performed on the correlation map, which is one of the two-stage processes in the second embodiment. That is, the filtered image is generated by convolution of the correlation map and a spatial filter.

[0093] FIG. 14(c) shows an example of an equation expressing these two-stage processes. As shown in FIG. 14(c), a filtered image is generated by convolving a normal map with a virtual light source vector and then convolving with a spatial filter. The calculation of the equation shown in FIG. 14(c) is equivalent to the calculation of the equation shown in FIG. 14(d). That is, a filtered image can be generated by calculating the tensor product of a virtual light source vector and a spatial filter and then convolving with a normal map. The tensor product of a virtual light source vector and a spatial filter becomes a multi-channel spatial filter. Therefore, the calculation of the equation shown in FIG. 14(d) is equivalent to the calculation of the equation shown in FIG. 14(e), and a filtered image can be generated by convolving a normal map with a multi-channel spatial filter. Hereinafter, the spatial filter used in the second embodiment will be referred to as a single-channel spatial filter to distinguish it from a multi-channel spatial filter.

[0094] The processing contents of the functional configuration of the image processing device 101 will be described. The detection unit 1301 has a plurality of filter processing units 1302A to 1302D, a sum calculation unit 1303, and a threshold processing unit 507. Each of the filter processing units 1302A to 1302D performs convolution between a normal map and a multi-channel spatial filter. This generates a filter image equivalent to the filter image generated by each of the plurality of filter processing units 506A to 506D according to the second embodiment. The multi-channel spatial filter is generated by the plurality of filter processing units 1302A to 1302D calculating the tensor product of a virtual light source vector and a single-channel spatial filter. The single-channel spatial filter used here has weights distributed in a direction orthogonal to the virtual light source vector, similar to the single-channel spatial filter (spatial filter) used in the second embodiment.

[0095] The sum calculation unit 1303 uses the four filter images output from the filter processing units 1302A to 1302D to generate a sum image by adding up the values ​​of corresponding pixels in each filter image. Specifically, the sum calculation unit 1303 generates the sum image by calculating the sum of four pixel values, which are the values ​​of pixels in each filter image corresponding to each position (x, y) on the inspection surface. This integrates the linear irregularities detected for each virtual light source vector. The threshold processing unit 507 detects linear irregularities on the inspection surface based on the sum image generated by the sum calculation unit 1303, as in the second embodiment.

[0096] According to the image processing device 101 configured as described above, a filter image equivalent to the filter image generated by the detection unit 702 according to the second embodiment can be obtained, and therefore, like the image processing device 101 according to the second embodiment, the detection accuracy of linear unevenness can be improved. Furthermore, while the image processing device 101 according to the second embodiment generates a filter image through two-stage processing, the image processing device 101 according to the fourth embodiment can generate a filter image similar to that of the second embodiment through one-stage processing. Therefore, compared to the image processing device 101 according to the second embodiment, the image processing device 101 according to the fourth embodiment can reduce the processing load and facilitate the implementation of programs and the like.

[0097] FIG. 13(b) is a block diagram showing another example of the functional configuration of the image processing device 101 according to the fourth embodiment. The image processing device 101 shown in FIG. 13(b) has, as its functional configuration, a light source control unit 500, an image acquisition unit 501, a normal map acquisition unit 502, a virtual light source vector setting unit 701, and a detection unit 1311. The detection unit 1311 also has a filter processing unit 1312 and a threshold processing unit 507. The processing of each functional configuration is realized by the CPU 106 executing program code loaded in the RAM 105. The functional configuration of the image processing device 101 shown in FIG. 13(a) can be simplified as shown in FIG. 13(b) as an example of the image processing device 101. By configuring the image processing device 101 shown in FIG. 13(b), it is possible to further reduce the processing load and make implementation easier compared to the image processing device 101 shown in FIG. 13(a).

[0098] FIG. 15 is a diagram for explaining an example of processing by the image processing device 101 shown in FIG. 13(b). FIG. 15(a) shows how a sum image is generated from filter images corresponding to lighting in two directions. In the case of the image processing device 101 shown in FIG. 13(a), the calculation of the equation shown in FIG. 15(a) is equivalent to the calculation of the equation shown in FIG. 15(b). In the calculation of the equation shown in FIG. 15(b), the sum image is generated after convolution of the normal map with the multi-channel spatial filter. The calculation of the equation shown in FIG. 15(b) is equivalent to the calculation of the equation shown in FIG. 15(c). In other words, even if the sum value of the multi-channel spatial filter is calculated and then convolution with the normal map is performed, the same result as the calculation of the equation shown in FIG. 15(b) is obtained. Note that the sum value of the multi-channel spatial filter is a multi-channel spatial filter generated by calculating the sum value for each element.

[0099] The filter processing unit 1312 in the detection unit 1311 calculates the sum of multi-channel spatial filters corresponding to each of the four virtual light source vectors set by the virtual light source vector setting unit 701. Furthermore, the filter processing unit 1312 generates an image equivalent to the sum image generated by the sum calculation unit 1303 shown in Fig. 13(a) by convolving the multi-channel filter obtained by this calculation with the normal map. In this way, the configuration of the image processing device 101 shown in Fig. 13(b) can further simplify the configuration of the image processing device 101 shown in Fig. 13(a).

[0100] [Other embodiments] The present disclosure can also be realized by providing a program that realizes one or more functions of the above-described embodiments to a system or device via a network or a storage medium, and having one or more processors in the computer of the system or device read and execute the program. It can also be realized by a circuit (e.g., ASIC) that realizes one or more functions.

[0101] It should be noted that within the scope of the present disclosure, the embodiments may be freely combined, any component of each embodiment may be modified, or any component of each embodiment may be omitted.

[0102] [Configuration of the present disclosure] The present disclosure includes the following configurations.

[0103] <Configuration 1> a generating means for generating an image of a target object using lighting with a virtual light source; a detection means for detecting linear features of the target object based on the image; Having An image processing device comprising:

[0104] <Configuration 2> The detecting means detects linear irregularities extending in a direction perpendicular to the lighting direction of the virtual light source as the linear features. 2. The image processing device according to configuration 1,

[0105] <Configuration 3> a virtual light source setting means for setting the virtual light source so that the lighting direction of the virtual light source is perpendicular to the direction of the linear feature; Further possessing 3. The image processing device according to configuration 1 or 2, characterized in that:

[0106] <Configuration 4> The virtual light source setting means sets the virtual light source in accordance with the type of the target object. 4. The image processing device according to configuration 3,

[0107] <Configuration 5> The virtual light source setting means sets the virtual light source in accordance with the shape of the target object. 5. The image processing device according to configuration 3 or 4, characterized in that:

[0108] <Configuration 6> a virtual light source setting means for setting a plurality of virtual light sources having different lighting directions; and the generating means generates the images corresponding to the plurality of virtual light sources, The detecting means detects the linear features corresponding to each of the plurality of virtual light sources based on the plurality of generated images. 6. The image processing device according to any one of configurations 1 to 5, characterized in that:

[0109] <Configuration 7> The plurality of virtual light sources are set such that the angles formed by two line segments connecting two adjacent virtual light sources with the vertical axis of the inspection surface of the target object are equal to each other, with the vertical axis as the center. 7. The image processing device according to configuration 6,

[0110] <Configuration 8> The plurality of virtual light sources are set to have uniform heights from a plane including an inspection surface of the target object. 8. The image processing device according to configuration 6 or 7, characterized in that:

[0111] <Configuration 9> The plurality of virtual light sources are set at the same height as the inspection surface and illuminate from a direction parallel to a plane including the inspection surface. 9. The image processing device according to configuration 8,

[0112] <Configuration 10> The virtual light source setting means sets a larger number of the virtual light sources as the set detection sensitivity becomes higher. 10. The image processing device according to any one of configurations 6 to 9, characterized in that:

[0113] <Configuration 11> The virtual light source setting means sets a smaller number of virtual light sources as the set inspection speed becomes faster. 11. The image processing device according to any one of configurations 6 to 10, characterized in that:

[0114] <Configuration 12> filtering means for applying a predetermined spatial filter to the image to generate a filtered image; and The detecting means detects the linear feature based on the filtered image. 12. The image processing device according to any one of configurations 1 to 11,

[0115] <Configuration 13> The spatial filter has weights distributed in a direction perpendicular to the lighting direction of the virtual light source. 13. The image processing device according to configuration 12,

[0116] <Configuration 14> an inspection scale acquisition means for acquiring an inspection scale; a spatial filter generating means for generating the spatial filter based on the inspection scale; Further possessing 14. The image processing device according to configuration 12 or 13,

[0117] <Configuration 15> The detecting means detects the linear feature using a predetermined detection sensitivity threshold. 15. The image processing device according to any one of configurations 1 to 14,

[0118] <Configuration 16> a threshold value acquisition means for acquiring a threshold value of the detection sensitivity; Further possessing 16. The image processing device according to configuration 15,

[0119] <Configuration 17> viewpoint acquisition means for acquiring viewpoint position information indicating the position of the viewpoint; and The generating means generates the image based on the position of the viewpoint. 17. The image processing device according to any one of configurations 1 to 16,

[0120] <Configuration 18> The generating means generates the image by simulating the appearance of the target object. 18. The image processing device according to any one of configurations 1 to 17,

[0121] <Configuration 19> a shape acquisition means for acquiring the shape of the target object; and The generating means generates the image based on the shape. 19. The image processing device according to any one of configurations 1 to 18,

[0122] <Configuration 20> the shape acquisition means acquires a normal map of the target object; The generating means generates the image based on a plurality of normal vectors included in the normal map. 20. The image processing device according to configuration 19,

[0123] <Configuration 21> The shape acquisition means acquires the normal map by photometric stereo. 21. The image processing device according to configuration 20,

[0124] <Configuration 22> the generating means generates the image based on a similarity between each of the plurality of normal vectors included in the normal map and a virtual light source vector indicating a lighting direction of the virtual light source. 22. The image processing device according to configuration 20 or 21,

[0125] <Configuration 23> The smaller the angle between the normal vector and the virtual light source vector, the greater the similarity. 23. The image processing device according to configuration 22,

[0126] <Configuration 24> the generating means calculates the similarity based on an inner product of the normal vector and the virtual light source vector. 24. The image processing device according to configuration 22 or 23,

[0127] <Configuration 25> When an inner product of a vector obtained by projecting the normal vector onto a plane including an inspection surface of the target object and a vector obtained by projecting the virtual light source vector onto the plane is a negative value, the generation means inverts the sign of a component of the normal vector that is parallel to the plane, and then calculates an inner product with the virtual light source vector. 25. The image processing device according to configuration 24,

[0128] <Configuration 26> a variation acquisition means for acquiring a posture variation parameter of the target object; a normal vector correction means for correcting the orientation of each of the plurality of normal vectors included in the normal map based on the posture fluctuation parameters; and The generating means generates the image based on the normal map after the correction. 26. The image processing device according to any one of configurations 20 to 25,

[0129] <Configuration 27> a positioning means for performing positioning of the normal map based on the posture variation parameters; and The generating means generates the image based on the normal map after the alignment and the correction. 27. The image processing device according to configuration 26,

[0130] <Configuration 28> filtering means for applying a predetermined multi-channel spatial filter to said normal map to generate a filtered image; and The detecting means detects the linear feature based on the filtered image. 22. The image processing device according to configuration 20 or 21,

[0131] <Configuration 29> a filter generating means for generating the multi-channel spatial filter by a tensor product of a virtual light source vector indicating a lighting direction of the virtual light source and a single-channel spatial filter; Further possessing 29. The image processing device according to configuration 28,

[0132] <Configuration 30> The filter generating means generates the multi-channel spatial filter by a tensor product of the virtual light source vector and the single-channel spatial filter having weights distributed in a direction orthogonal to the virtual light source vector. 30. The image processing device according to configuration 29,

[0133] <Configuration 31> an output means for outputting the image generated by the generation means; Further possessing 31. The image processing device according to any one of configurations 1 to 30, characterized in that:

[0134] <Configuration 32> a generation step of generating an image of the target object using lighting from a virtual light source; a detection step of detecting linear features of the target object based on the image; Including An image processing method comprising:

[0135] <Configuration 33> A program for causing a computer to function as the image processing device according to any one of configurations 1 to 31. [Explanation of symbols]

[0136] 101 Image processing device 504 Correlation map generation unit 505 Detection unit

Claims

1. A generating means for generating an image of a target object using lighting with a virtual light source; a detection means for detecting linear features of the target object based on the image; Having An image processing device comprising:

2. The detection means detects linear irregularities extending in a direction perpendicular to a lighting direction of the virtual light source as the linear features.

2. The image processing device according to claim 1,

3. a virtual light source setting means for setting the virtual light source so that a lighting direction of the virtual light source is perpendicular to a direction of the linear feature; Further possessing 2. The image processing device according to claim 1,

4. The virtual light source setting means sets the virtual light source in accordance with a type of the target object.

4. The image processing device according to claim 3,

5. The virtual light source setting means sets the virtual light source in accordance with a shape of the target object.

4. The image processing device according to claim 3,

6. a virtual light source setting means for setting a plurality of virtual light sources having different lighting directions; and The generating means generates the images corresponding to each of the plurality of virtual light sources, The detection means detects the linear features corresponding to each of the plurality of virtual light sources based on the generated plurality of images.

2. The image processing device according to claim 1,

7. The plurality of virtual light sources are set such that the angles formed by two line segments connecting two adjacent virtual light sources and the vertical axis are equal to each other, the two line segments being centered on the vertical axis of the inspection surface of the target object.

7. The image processing device according to claim 6,

8. The plurality of virtual light sources are set so that their heights from a plane including an inspection surface of the target object are uniform.

7. The image processing device according to claim 6,

9. The plurality of virtual light sources are set at the same height as the inspection surface, and illuminate from a direction parallel to a plane including the inspection surface. The image processing device according to claim 8 .

10. The virtual light source setting means sets a larger number of the virtual light sources as the set detection sensitivity becomes higher.

7. The image processing device according to claim 6,

11. The virtual light source setting means sets a smaller number of the virtual light sources as the set inspection speed becomes faster.

7. The image processing device according to claim 6,

12. filtering means for applying a predetermined spatial filter to the image to generate a filtered image; and The detection means detects the linear feature based on the filtered image.

2. The image processing device according to claim 1,

13. The spatial filter has weights distributed in a direction perpendicular to the lighting direction of the virtual light source. The image processing device according to claim 12 .

14. An inspection scale acquisition means for acquiring an inspection scale; a spatial filter generating means for generating the spatial filter based on the inspection scale; Further possessing The image processing device according to claim 12 .

15. The detection means detects the linear feature using a predetermined detection sensitivity threshold.

2. The image processing device according to claim 1,

16. a threshold value acquisition means for acquiring a threshold value of the detection sensitivity; Further possessing The image processing device according to claim 15 ,

17. A viewpoint acquisition means for acquiring viewpoint position information indicating a position of a viewpoint; and The generating means generates the image based on the position of the viewpoint.

2. The image processing device according to claim 1,

18. The generating means generates the image by simulating an appearance of the target object.

2. The image processing device according to claim 1,

19. A shape acquisition means for acquiring a shape of the target object; and The generating means generates the image based on the shape.

2. The image processing device according to claim 1,

20. The shape acquisition means acquires a normal map of the target object; The generating means generates the image based on a plurality of normal vectors included in the normal map. The image processing device according to claim 19 .

21. The shape acquisition means acquires the normal map by photometric stereo. The image processing device according to claim 20 .

22. The generating means generates the image based on a similarity between each of the plurality of normal vectors included in the normal map and a virtual light source vector indicating a lighting direction of the virtual light source. The image processing device according to claim 20 .

23. The smaller the angle between the normal vector and the virtual light source vector, the greater the similarity. The image processing device according to claim 22 .

24. The generating means calculates the similarity based on an inner product of the normal vector and the virtual light source vector. The image processing device according to claim 22 .

25. When an inner product of a vector obtained by projecting the normal vector onto a plane including an inspection surface of the target object and a vector obtained by projecting the virtual light source vector onto the plane is a negative value, the generation means inverts a sign of a component of the normal vector that is parallel to the plane, and then calculates an inner product with the virtual light source vector. The image processing device according to claim 24 .

26. a variation acquisition means for acquiring a posture variation parameter of the target object; a normal vector correction means for correcting the orientation of each of the plurality of normal vectors included in the normal map based on the posture fluctuation parameters; and The generating means generates the image based on the normal map after the correction. The image processing device according to claim 20 .

27. a position adjustment means for adjusting the position of the normal map based on the posture variation parameters; and The generating means generates the image based on the normal map after the alignment and the correction.

27. The image processing device according to claim 26,

28. filtering means for applying a predetermined multi-channel spatial filter to said normal map to generate a filtered image; and The detection means detects the linear feature based on the filtered image. The image processing device according to claim 20 .

29. a filter generating means for generating the multi-channel spatial filter by a tensor product of a virtual light source vector indicating a lighting direction of the virtual light source and a single-channel spatial filter; Further possessing 29. The image processing device according to claim 28,

30. The filter generating means generates the multi-channel spatial filter by a tensor product of the virtual light source vector and the single-channel spatial filter having weights distributed in a direction orthogonal to the virtual light source vector.

30. The image processing device according to claim 29,

31. an output means for outputting the image generated by the generation means; Further possessing 2. The image processing device according to claim 1,

32. A generating step of generating an image of a target object using lighting from a virtual light source; a detection step of detecting linear features of the target object based on the image; Contains An image processing method comprising:

33. A program for causing a computer to function as the image processing device according to any one of claims 1 to 31.

Citation Information

Patent Citations

  • Inspection system

    JP2019191105A