Rangefinder and rangefinding method
The distance measuring device uses multiple light sources and correlation-based smoothing to minimize speckle noise in distance images, enhancing the accuracy of surface shape representation by adjusting smoothing based on correlation values between evaluation images.
Patent Information
- Application Number
- PCT/JP2024/004011
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-24
- Filing Date
- 2024-02-07
- Publication Date
- 2024-10-03
AI Technical Summary
Existing distance measuring devices using coherent illumination light, such as laser beams, suffer from speckle noise in distance images, which can obscure the actual surface shape of objects, particularly when the surface is smooth, and require either multiple light sources or wavelength modulation to reduce noise effectively.
A distance measuring device and method that employs multiple light sources arranged at different positions to generate evaluation distance images, calculating correlation values between these images to adjust smoothing processing, thereby reducing speckle noise while maintaining the accuracy of surface irregularities in the distance image.
The approach effectively reduces speckle noise in distance images, making the surface irregularities more reproducible and less distorted by noise, especially in areas where speckle noise is dominant, while preserving the shape details of the object surface.
Smart Images

Figure JP2024004011_03102024_PF_FP_ABST
Abstract
Description
Distance measuring device and distance measuring method
[0001] The present invention relates to a distance measuring device and a distance measuring method.
[0002] Distance measuring devices are known that generate distance images by illuminating a subject with highly directional illumination light, such as laser light, and detecting reflected light from the subject using a distance sensor, such as a time-of-flight (ToF) sensor. However, such illumination light has coherence, which can cause speckle noise in the distance image. Several technologies have been proposed for reducing speckle noise. For example, Patent Document 1 discloses a technology that combines multiple (N) light projecting means arranged so that the optical paths to the object surface are different, and adds multiple laser beams projected from the multiple light projecting means to reduce speckle contrast to 1 / √N. Furthermore, Patent Document 2 discloses a technology that modulates the oscillation wavelength of laser light to change the phase of scattered light and superimposes the changed speckle pattern to reduce noise.
[0003] Japanese Patent Application Laid-Open No. 5-141965 Japanese Patent Application Laid-Open No. 2020-9749
[0004] The technology disclosed in Patent Document 1 requires a large number of lighting means to sufficiently reduce speckle noise, while the technology disclosed in Patent Document 2 requires a device capable of modulating the oscillation wavelength and emitting laser light of multiple wavelengths.
[0005] The present invention has been made in view of the above circumstances, and has an object to provide a technique for generating a distance image in which speckle noise is less noticeable.
[0006] In order to solve the above problem, a distance measuring device of one embodiment of the present invention comprises a first light source that irradiates a subject with a first illumination light, a second light source that irradiates the subject with a second illumination light, a distance sensor that detects light from the subject and generates a distance image, a light source control unit that switches between a normal pattern that turns on the first light source and the second light source, a first evaluation pattern that turns on the first light source, and a second evaluation pattern that turns on the second light source, a correlation unit that calculates a correlation value between a first evaluation distance image generated when the first evaluation pattern is irradiated and a second evaluation distance image generated when the second evaluation pattern is irradiated, for each of a plurality of evaluation areas set in the distance image, and a smoothing processing unit that applies a smoothing process of a strength corresponding to the correlation value to the normal distance image generated when the normal pattern is irradiated, to generate a corrected distance image.
[0007] Another aspect of the present invention is a distance measurement method that includes the steps of switching between a normal pattern in which a first light source that irradiates a subject with a first illumination light and a second light source that irradiates the subject with a second illumination light are turned on, a first evaluation pattern in which the first light source is turned on, and a second evaluation pattern in which the second light source is turned on, detecting light from the subject using a distance sensor to generate a distance image, calculating a correlation value between the first evaluation distance image generated when the first evaluation pattern is irradiated and the second evaluation distance image generated when the second evaluation pattern is irradiated, for each of a plurality of regions set in the distance image, and generating a corrected distance image by applying a smoothing process of a strength corresponding to the correlation value to the normal distance image generated when the normal pattern is irradiated.
[0008] Any combination of the above components or mutual substitution of the components or expressions of the present invention between methods, devices, systems, etc. are also valid aspects of the present invention.
[0009] According to the present invention, a distance image in which speckle noise is less noticeable can be generated.
[0010] 17A to 17C are diagrams showing an example of a captured image of a subject. FIGS. 2A and 2B are diagrams showing an example of a point cloud image of the same subject as in FIG. 1. FIG. 17B is a diagram showing an example of a configuration of a distance measuring device according to a first embodiment. FIG. 17C is a diagram showing an example of a configuration of a light source device in FIG. 3. FIG. 17D is a block diagram showing an example of a functional configuration of the distance image correction unit in FIG. 3. FIG. 17C is a conceptual diagram showing an example of setting multiple evaluation areas. FIG. 17D is a conceptual diagram showing an example of multiple evaluation areas overlapping in the horizontal direction. FIG. 17C is a conceptual diagram showing an example of multiple evaluation areas overlapping in the vertical direction. FIGS. 9A to 9C are diagrams showing an example of evaluation areas used in calculating a gradient component value by a gradient calculation unit. FIG. 9C is a conceptual diagram showing an example of a flow of a smoothing process. FIG. 9D is a diagram showing an example of coefficients of a low-pass filter used in the smoothing process. FIG. 9D is a diagram showing a distance image, a point cloud image, and a difference value image according to a first embodiment. FIG. 9D is a diagram showing a distance image, a point cloud image, and a difference value image according to a second embodiment. FIG. 9D is a flowchart showing an index value calculation process according to the first embodiment. FIG. 9D is a flowchart showing a correction process of a normal distance image according to the first embodiment. FIG. 9D is a diagram showing an example of a configuration of a distance measuring device according to a second embodiment. FIG. 9D is a diagram showing an example of a configuration of a light source device in FIG. 17. Fig. 18 is a block diagram schematically showing the functional configuration of the distance image correction unit in Fig. 17. Fig. 19 is a diagram showing an example of the operation of the distance image correction unit in Fig. 17 on a frame-by-frame basis.
[0011] Hereinafter, embodiments of the present invention will be described with reference to the drawings. Specific numerical values and the like shown in the embodiments are merely examples for facilitating understanding of the invention, and do not limit the present invention unless otherwise specified. Elements not directly related to the present invention are omitted from the drawings.
[0012] Before describing the embodiments, a brief explanation of speckle noise in a distance image will be given. Fig. 1 shows an example of an image of a subject 20 captured by a general camera. The subject 20 has a surface 21 that is composed of a smooth plane with few irregularities. As shown in Fig. 1, the captured image shows that the surface 21 of the subject 20 appears to be a smooth plane with few irregularities.
[0013] 2(a) and 2(b) show examples of point cloud images of the same object 20 as in FIG. 1 . Specifically, FIG. 2(a) shows a distance image of the object 20 generated using a TOF sensor and converted into point cloud data using a VCSEL (Vertical Cavity Surface Emitting Laser) that emits laser light as illumination light. FIG. 2(b) shows a point cloud image obtained by enlarging a rectangular region 21a, which is a portion of the surface 21 of the object 20 shown in FIG. 2(a). As shown in FIGS. 2(a) and 2(b), the surface 21 of the object 20, which appears smooth and flat in the captured image of FIG. 1, appears to include a wavy, uneven shape in the point cloud image. This is because the coherence of laser light causes reflected light from the object 20 to form interference fringes, resulting in speckle noise in the distance image. The uneven shape caused by speckle noise is problematic because it does not represent the actual shape of the surface 21 of the object 20. Since the magnitude of the speckle noise is relatively small, the speckle noise is not particularly noticeable when the surface 21 of the subject 20 actually includes an uneven shape. On the other hand, when the surface 21 of the subject 20 is a smooth plane, the speckle noise is particularly noticeable.
[0014] The inventors have discovered the following method for reducing the visibility of speckle noise in distance images. First, multiple evaluation distance images are obtained by irradiating illumination light onto the subject 20 at different times from multiple light sources positioned at different locations. Here, it is believed that the speckle noise generated in the multiple evaluation distance images differs due to differences in the angles of illumination light from the multiple light sources. Meanwhile, the uneven surface shape of the subject included in the multiple evaluation distance images is believed to be common because it is the same subject. When multiple evaluation distance images are compared by region and correlation values are calculated, it is believed that the correlation value will be high if the uneven shape of the subject is dominant and low if speckle noise is dominant. Based on these correlation values, the strength of the smoothing process for reducing the visibility of speckle noise is adjusted. Specifically, the smoothing process is strengthened in regions with low correlation values and weakened in regions with high correlation values. This makes it possible to strengthen the smoothing process in regions where speckle noise is dominant, thereby reducing the visibility of speckle noise. On the other hand, in areas where speckle noise is not dominant, the smoothing process can be weakened to prevent the uneven shape of the subject from being distorted. As a result, the overall range image can effectively reduce the conspicuous speckle noise while maintaining the reproducibility of the uneven shape of the subject's surface. This embodiment will be described below.
[0015] First Embodiment Fig. 3 is a diagram schematically illustrating the configuration of a distance measuring device 10 according to a first embodiment. The distance measuring device 10 includes a light source device 12, a distance sensor block 14, a light source control unit 16, and a distance image correction unit 18. The light source device 12 includes, for example, a first light source 12a and a second light source 12b. As shown in Fig. 4, which will be described later, the light source device 12 further includes a third light source 12c and a fourth light source 12d.
[0016] FIG. 4 is a schematic diagram showing the configuration of the light source device 12. FIG. 4 is a view of the distance measuring device 10 as viewed from the subject 20 side. The light source device 12 includes a first light source 12a, a second light source 12b, a third light source 12c, and a fourth light source 12d. The first light source 12a to the fourth light source 12d each emit coherent illumination light such as laser light. The first light source 12a to the fourth light source 12d are each formed of a light-emitting device such as a VCSEL. The first light source 12a irradiates the subject 20 with a first illumination light 22a (see FIG. 3). The second light source 12b irradiates the subject 20 with a second illumination light 22b (see FIG. 3). The third light source 12c irradiates the subject 20 with a third illumination light. The fourth light source 12d irradiates the subject 20 with a fourth illumination light. The first light source 12a to the fourth light source 12d are disposed at different positions, and the angles at which the first illumination light 22a to the fourth illumination light 22d are irradiated onto the subject 20 are also different. The first illumination light 22a to the fourth illumination light 22d may be either visible light or infrared light, but in this example, they are infrared light having a peak wavelength at 940 nm. Hereinafter, the illumination light irradiated onto the subject 20 by the light source device 12 will be collectively referred to as illumination light 22.
[0017] 4, the first light source 12a to the fourth light source 12d are arranged at approximately equal intervals so as to surround the periphery of a lens 26 (described later) included in the distance sensor block 14. For example, the first light source 12a to the fourth light source 12d are arranged at positions above, below, left, and right of the distance sensor block 14, respectively. Specifically, the first light source 12a and the fourth light source 12d are arranged above and below the distance sensor block 14, and the second light source 12b and the third light source 12c are arranged to the left and right of the distance sensor block 14. For example, the first light source 12a to the fourth light source 12d are arranged so that the illumination light 22 of the light source device 12 as a whole when all of the first light source 12a to the fourth light source 12d are turned on is symmetrical with respect to the optical axis of the lens 26. The number of light sources included in the light source device 12 is not limited to four, and may be two or more.
[0018] Returning to FIG. 3 , the distance sensor block 14 is composed of a distance sensor such as a ToF sensor. The distance measurement method of the ToF sensor may be either iToF (indirect Time of Flight) or dToF (direct Time of Flight). The distance sensor block 14 detects light 24 from the subject 20 to generate a distance image. The light 24 from the subject 20 is, for example, light reflected by the subject 20 from the illumination light 22 from the light source device 12. The light 24 from the subject 20 also includes scattered light. The distance sensor block 14 includes a lens 26, an image sensor 28, and a distance conversion unit 30.
[0019] The lens 26 is provided in front of the image sensor 28 (on the side where the subject 20 is located). The lens 26 is arranged to form an image of light 24 from the subject 20 that is incident on the distance sensor block 14 on the light receiving surface of the image sensor 28. The lens 26 may include any number of optical lenses, one or more.
[0020] The image sensor 28 is configured with a two-dimensional image sensor such as a CCD (Charge Coupled Device) sensor or a CMOS (Complementary Metal Oxide Semiconductor) sensor. The image sensor 28 has a plurality of pixels in both the horizontal and vertical directions. The number of pixels of the image sensor 28 is not particularly limited, but may be, for example, 640 pixels horizontally and 480 pixels vertically. The image sensor 28 photoelectrically converts the light imaged on the light receiving surface for each pixel and outputs the converted signal as an electrical signal to the distance conversion unit 30. The image sensor 28 outputs the electrical signal for each pixel at, for example, 20 frames per second, but is not particularly limited.
[0021] Distance conversion unit 30 converts the electrical signals for each pixel input from image sensor 28 into distance values that indicate the distance to the subject. Distance sensor block 14 outputs the pixel-by-pixel distance values for all pixels converted by distance conversion unit 30 to distance image correction unit 18 as a distance image. Distance sensor block 14 may output the pixel-by-pixel distance values converted by distance conversion unit 30 to distance image correction unit 18 as a serial signal, or may output distance image data that summarizes the distance values for all pixels to distance image correction unit 18.
[0022] The light source control unit 16 switches the lighting patterns of the first light source 12a to the fourth light source 12d. Specifically, the light source control unit 16 switches between a normal pattern in which all of the first light source 12a to the fourth light source 12d are turned on and an evaluation pattern in which some of the first light source 12a to the fourth light source 12d are turned on. The evaluation patterns include a first evaluation pattern in which the first light source 12a is turned on, a second evaluation pattern in which the second light source 12b is turned on, a third evaluation pattern in which the third light source 12c is turned on, and a fourth evaluation pattern in which the fourth light source 12d is turned on. Hereinafter, a distance image generated by the distance sensor block 14 when irradiating the normal pattern will be referred to as a normal distance image. Also, an image generated by the distance sensor block 14 when irradiating the mth evaluation pattern will be referred to as an mth evaluation distance image, where m is a positive integer. The evaluation distance image is used to evaluate the influence of speckle noise contained in the normal distance image. The influence of speckle noise is evaluated based on the correlation value between multiple evaluation distance images. A smoothing process with a strength corresponding to the calculated correlation value is applied to the normal distance image to generate a corrected distance image that is corrected so that speckle noise is not noticeable. The calculation of the correlation value and the generation of the corrected distance image will be described in detail later.
[0023] 5 is a block diagram showing a schematic functional configuration of distance image correction unit 18. Distance image correction unit 18 includes an image acquisition unit 52, a moving average unit 54, an evaluation area extraction unit 56, a gradient calculation unit 58, a gradient removal unit 60, a correlation unit 62, a smoothing strength determination unit 64, and a smoothing processing unit 66.
[0024] Each functional block shown in this embodiment can be realized, for example, by a combination of hardware and software. The hardware of distance image correction unit 18 is realized by elements and mechanical devices such as a processor such as a computer's CPU (Central Processing Unit) or GPU (Graphics Processing Unit) and memories such as ROM (Read Only Memory) or RAM (Random Access Memory). The software of distance image correction unit 18 is realized by a computer program or the like.
[0025] The image acquisition unit 52 acquires distance images generated by the distance sensor block 14. The image acquisition unit 52 acquires a normal distance image, a first evaluation distance image, a second evaluation distance image, a third evaluation distance image, and a fourth evaluation distance image. The image acquisition unit 52 may acquire multiple frames of distance images generated at different times for each of the normal distance image, the first evaluation distance image, the second evaluation distance image, the third evaluation distance image, and the fourth evaluation distance image.
[0026] The moving average unit 54 calculates a moving average in the time direction of pixel values of multiple frames of distance images acquired by the image acquisition unit 52. The moving average here may be a simple moving average or a weighted moving average. By calculating the moving average of pixel values of multiple frames of distance images, the moving average unit 54 can reduce random noise other than speckle noise in the distance images. By applying the processing of the moving average unit 54 to the evaluation distance image, the influence of random noise on the calculated correlation value can be reduced when calculating the correlation value between multiple evaluation distance images.
[0027] The evaluation area extraction unit 56 extracts multiple evaluation areas, each consisting of a predetermined number of pixels, from the distance image acquired by the image acquisition unit 52 or the distance image moving-averaged by the moving average unit 54. The evaluation areas may be preset areas. The multiple evaluation areas may be set so as to partially overlap. The size of the evaluation areas can be set arbitrarily depending on the magnitude of the speckle noise to be reduced. The evaluation areas are, for example, areas consisting of 64 horizontal pixels by 64 vertical pixels.
[0028] FIG. 6 is a conceptual diagram showing an example of setting multiple evaluation areas. FIG. 6 shows an evaluation area 80 set at an arbitrary position other than the periphery of the distance image, and four evaluation areas 81, 82, 83, and 84 that overlap the evaluation area 80 at positions above, below, left, and right. BlockNo[x, y] in FIG. 6 represents the horizontal and vertical area numbers of the evaluation area. If the evaluation area 80 in the center of FIG. 6 is designated BlockNo[x, y], the upper evaluation area 81 is designated BlockNo[x, y−1], the lower evaluation area 84 is designated BlockNo[x, y+1], the left evaluation area 82 is designated BlockNo[x−1, y], and the right evaluation area 83 is designated BlockNo[x+1, y].
[0029] As shown in FIG. 6 , the central evaluation area 80 (Block No [x, y]) has a non-overlapping area 90 that does not overlap with the evaluation areas 81 to 84 located above, below, left, and right, and a first overlapping area 92 and a second overlapping area 94 that overlap with at least one of the evaluation areas 81 to 84 located above, below, left, and right. The first overlapping area 92 is an area where two evaluation areas overlap, and the second overlapping area 94 is an area where three or more evaluation areas overlap. Each evaluation area shown in FIG. 6 consists of 64 pixels horizontally by 64 pixels vertically. Furthermore, the central evaluation area 80 (Block No [x, y]) overlaps with each of the four evaluation areas 81 to 84 located above, below, left, and right by 16 pixels horizontally and / or vertically.
[0030] FIG. 7 is a conceptual diagram illustrating an example of multiple horizontally overlapping evaluation areas. Among the multiple evaluation areas set in the distance image, the evaluation area located in the upper left corner is designated BlockNo[0,0], and the evaluation areas located to the right in the horizontal direction are designated BlockNo[0,1], BlockNo[0,2], .... Each evaluation area is an area consisting of 64 pixels horizontally by 64 pixels vertically, and adjacent evaluation areas horizontally overlap each other by 16 pixels horizontally. In other words, of the total number of pixels in each evaluation area (64 x 64 = 4096 pixels), the overlapping area between BlockNo[0,0] and BlockNo[0,1] and the overlapping area between BlockNo[0,1] and BlockNo[0,2] each are 16 x 64 = 1024 pixels.
[0031] FIG. 8 is a conceptual diagram illustrating an example of multiple vertically overlapping evaluation areas. Among the multiple evaluation areas set in the distance image, the evaluation area located in the upper left corner is designated BlockNo[0,0], and the evaluation areas located vertically below are designated BlockNo[1,0], BlockNo[2,0], and so on. Each evaluation area is 64 pixels wide by 64 pixels high, and adjacent evaluation areas vertically overlap each other by 16 pixels. That is, of the total number of pixels in each evaluation area (64 x 64 = 4096), the overlapping area between BlockNo[0,0] and BlockNo[1,0] and the overlapping area between BlockNo[1,0] and BlockNo[2,0] each are 16 x 64 = 1024 pixels.
[0032] 5 , for an evaluation distance image in which multiple evaluation regions are set, the gradient calculation unit 58 calculates a gradient component value for each pixel based on the average value of the pixel values of multiple pixels aligned vertically or horizontally within each of the multiple evaluation regions. Here, the gradient component value refers to the gradient of the surface 21 of the subject 20 in the depth direction, and is a distance value averaged to exclude small irregularities on the surface 21 of the subject 20. For example, the gradient calculation unit 58 may determine, as the gradient component value for each pixel, the average value of the pixel values of multiple pixels aligned vertically or horizontally within each of the multiple evaluation regions that has the largest absolute value of difference from the average pixel value of the entire region.
[0033] 9(a) to 9(c) are diagrams showing an example of an evaluation area used in the calculation of the gradient component value by the gradient calculation unit 58. In the examples of FIGS. 9(a) to 9(c), the evaluation area is an area consisting of 64 horizontal pixels by 64 vertical pixels. FIG. 9(a) shows a horizontal average value, which is the average of the pixel values of multiple pixels arranged horizontally within the evaluation area. As shown in FIG. 9(a), 64 horizontal average values HAve[1], HAve[2], HAve[3], ..., HAve
[62] , HAve
[63] , and HAve
[64] are calculated. FIG. 9(b) shows a vertical average value, which is the average of the pixel values of multiple pixels arranged vertically within the evaluation area. As shown in FIG. 9(b), 64 vertical average values VAve[1], VAve[2], VAve[3], ..., VAve
[62] , VAve
[63] , and VAve
[64] are calculated. FIG. 9C shows the overall average value BlockAveAll, which is the average value of pixel values in the entire evaluation area.
[0034] For example, the gradient calculation unit 58 calculates the gradient component value HV_Ave[L] for a pixel with a vertical pixel number of L using the following equation (1): IF (ABS(HAve[L] - BlockAveAll) > ABS(VAve[L] - BlockAveAll)) HV_Ave[L] = HAve[L] ELSE HV_Ave[L] = VAve[L] (1) Here, ABS indicates the absolute value, and HV_Ave[L] indicates the gradient component value of the pixel with a vertical pixel number of L. By calculating equation (1) for L = 1 to 64, i.e., for all pixels in the evaluation area, the gradient component values of all pixels in the evaluation area can be calculated. In this example, multiple horizontally aligned pixels are assigned the same gradient component value. By assigning the same gradient component value to multiple horizontally aligned pixels, the overall gradient component within the evaluation area can be appropriately represented. According to the inventor's findings, if the gradient component value is calculated individually for each pixel, the difference in gradient component value between adjacent pixels may become large, making it impossible to properly represent the overall gradient component. Alternatively, instead of this example, the same gradient component value may be used for multiple pixels arranged vertically, rather than horizontally. For example, the vertical pixel number L in the above formula (1) may be replaced with the horizontal pixel number P, and the gradient component value of the pixel with the horizontal pixel number P may be calculated. In this case, by setting the same gradient component value for multiple pixels arranged vertically, the overall gradient component within the evaluation area can be properly represented.
[0035] 5 , the gradient removal unit 60 calculates a difference value by subtracting the gradient component value from the pixel value of each pixel in the evaluation distance image. The difference value corresponds to the distance value indicating the position of the surface 21 of the subject 20, with the overall gradient in the depth direction of the surface 21 of the subject 20 removed. The difference value corresponds to the sum of the components of the uneven shape of the surface 21 of the subject 20 and the components of speckle noise visible on the surface 21.
[0036] The gradient removal unit 60 may further limit the upper and lower limits of the difference value. By limiting the upper and lower limits of the difference value, the gradient removal unit 60 can reduce the influence of abnormal values such as flying pixels from the difference value. Because the speckle noise component contained in the difference value is relatively small, limiting the upper and lower limits of the difference value can remove abnormal values that are significantly larger than the magnitude of the speckle noise.
[0037] For example, for a pixel value DEPTH[P,L] of a pixel having a horizontal pixel number P and a vertical pixel number L, the gradient removal unit 60 calculates a difference value DIFF[P,L] using the gradient component value HV_Ave[L] calculated by the above equation (1) and the following equation (2): IF DEPTH[P,L] - HV_Ave[L] <= -CLIPLEV DIFF[P,L] = -CLIPLEV ELSE IF DEPTH[P,L] - HV_Ave[L] >= CLIPLEV DIFF[P,L] = CLIPLEV ELSE DIFF[P,L] = DEPTH[P,L] - HV_Ave[L] (2) Here, CLIPLEV is the upper limit of the difference value, and -CLIPLEV is the lower limit of the difference value. The magnitude of CLIPLEV may be set according to the maximum value of the expected speckle noise.
[0038] For example, the gradient removal unit 60 uses equation (2) to calculate difference values (DIFF1[P,L], DIFF2[P,L], DIFF3[P,L] and DIFF4[P,L]) with upper and lower limit values limited for the pixel values (DEPTH1[P,L], DEPTH2[P,L], DEPTH3[P,L] and DEPTH4[P,L]) of each pixel within the evaluation area of each of the first evaluation distance image, the second evaluation distance image, the third evaluation distance image and the fourth evaluation distance image.
[0039] The correlation unit 62 calculates a correlation value between any two of the multiple evaluation distance images for each evaluation area. The correlation unit 62 may calculate the correlation value using the difference value calculated by the gradient removal unit 60. That is, the correlation unit 62 may calculate the correlation value using a difference value obtained by subtracting a gradient component value from the pixel value of each pixel in the first evaluation distance image and the second evaluation distance image. Furthermore, when the difference value is greater than a predetermined upper limit value, the correlation unit 62 may calculate the correlation value using the upper limit value, and when the difference value is smaller than a predetermined lower limit value, the correlation unit 62 may calculate the correlation value using the lower limit value.
[0040] For example, the correlation unit 62 calculates the correlation value (r) for each evaluation area using the following equation (3).
[0041]
[0042] Here, n is the number of pixels in the evaluation area. For example, if the evaluation area is an area consisting of 64 pixels horizontally by 64 pixels vertically, then n = 64 x 64 = 4096. i is the difference value (DIFFx) of each pixel in the evaluation area of one of the two evaluation distance images used to calculate the correlation value. x_ave is the average value of the difference values of all pixels in the evaluation area of the one evaluation distance image. i is the difference value (DIFFy) of each pixel in the evaluation area of the other evaluation distance image, and y_ave is the average value of the difference values of all pixels in the evaluation area of the other evaluation distance image.
[0043] For example, when calculating the first correlation value between the first evaluation distance image and the second evaluation distance image for each evaluation area, the correlation unit 62 substitutes DIFF1(P, L) for DIFFx and DIFF2(P, L) for DIFFy in equation (3), resulting in P = 1 to 64 and L = 1 to 64. The first correlation value indicates the correlation (or similarity) of the difference value between the first evaluation distance image and the second evaluation distance image in the evaluation area. As described above, the difference value includes a roughness component on the surface 21 of the subject 20 and a speckle noise component. The roughness component is less affected by differences in illumination light, so the difference between the first evaluation distance image and the second evaluation distance image is relatively small. On the other hand, the speckle noise component is more affected by differences in illumination light, so the difference between the first evaluation distance image and the second evaluation distance image is large. Therefore, a large correlation value means that the influence of speckle noise is small, and a small correlation value means that the influence of speckle noise is large.
[0044] The correlation unit 62 can calculate multiple correlation values by changing the combination of two evaluation distance images. Specifically, the correlation unit 62 can calculate, for each evaluation area, a first correlation value r1 between the first evaluation distance image and the second evaluation distance image, a second correlation value r2 between the first evaluation distance image and the third evaluation distance image, a third correlation value r3 between the first evaluation distance image and the fourth evaluation distance image, a fourth correlation value r4 between the second evaluation distance image and the third evaluation distance image, a fifth correlation value r5 between the second evaluation distance image and the fourth evaluation distance image, and a sixth correlation value r6 between the third evaluation distance image and the fourth evaluation distance image. Note that the number of correlation values calculated by the correlation unit 62 depends on the number of evaluation distance images obtained by switching the evaluation pattern using the light source control unit 16. When there are m types of evaluation distance images, the number of correlation values is m × (m − 1) / 2. For example, when there are two types of evaluation distance images, only one correlation value, which is the correlation value between the two images, is obtained.
[0045] The smoothing strength determination unit 64 determines the strength of the smoothing process to be applied to the normal distance image based on the correlation values calculated by the correlation unit 62. The smoothing strength determination unit 64 may, for example, calculate an index value indicating the degree of influence of speckle noise in each evaluation region based on multiple correlation values r1 to r6 calculated for each evaluation region, and calculate the strength of the smoothing process based on the index value. For example, the smoothing strength determination unit 64 may use the average of two or more of the multiple correlation values r1 to r6 as the index value for that evaluation region. Specifically, the smoothing strength determination unit 64 uses the average (r_ave) of the three correlation values with the smallest absolute values among the six correlation values (r1 to r6) as the index value (index). A larger index value indicates a smaller degree of influence of speckle noise in that evaluation region, and a smaller index value indicates a larger degree of influence of speckle noise in that evaluation region.
[0046] The smoothing strength determination unit 64 may calculate an index value for each pixel based on the index value for each evaluation region. For a pixel located in a first overlap region 92 and a second overlap region 94 (see FIG. 6 ) where two or more evaluation regions overlap, the smoothing strength determination unit 64 may calculate an index value for the pixel based on the index values for each of the two or more evaluation regions.
[0047] For example, for a first overlapping region 92 where the central evaluation region 80 (BlockNo[x,y]) and the right evaluation region 83 (BlockNo[x+1,y]) in Figure 6 overlap, the smoothing strength determination unit 64 may calculate the index value (indexmix[X,Y]) of each pixel from left to right based on the index value (index[x,y]) of the central evaluation region 80 and the index value (index[x+1,y]) of the right evaluation region 83 using the following equation (4). indexmix[1,Y] = index[x,y]×15+index[x+1,y]×1 indexmix[2,Y] = index[x,y]×14+index[x+1,y]×2 indexmix[3,Y] = index[x,y]×13+index[x+1,y]×3 ... indexmix[16,Y] = index[x,y]×0+index[x+1,y]×16 ... (4) This allows the correlation value of each pixel in the first overlap region 92 to be set so that it gradually approaches the index value of the closer of the two evaluation regions.
[0048] The smoothing strength determination unit 64 may calculate the index value of the second overlapping region 94 based on the correlation values of the four evaluation regions that overlap in the second overlapping region 94. Furthermore, for the non-overlapping region 90 that does not overlap with other evaluation regions in the evaluation region 80 (BlockNo[x, y]), the index value of the evaluation region 80 (BlockNo[x, y]) can be used as is.
[0049] For example, the smoothing strength determination unit 64 multiplies the index value (index or indexmix) calculated for each region or pixel by GAIN to obtain an adjusted smoothing mixture ratio (mixgain) according to the following equation (5): mixgain = indexmix × GAIN IF mixgain > 1 mixgain = 1 ... (5) Here, GAIN is an arbitrary value, for example, 2. In the following description, the value obtained by subtracting the smoothing mixture ratio (mixgain) from 1 is also referred to as smoothing strength α. Therefore, smoothing strength α = 1 - mixgain.
[0050] Returning to FIG. 5 , the smoothing processor 66 applies smoothing processing to the normal distance image generated when the normal pattern is irradiated, with the strength determined by the smoothing strength determination unit 64, i.e., the strength corresponding to the correlation value, to generate a corrected distance image. The smoothing processor 66 can apply smoothing processing using, for example, a spatial low-pass filter. The smoothing processor 66 may increase the strength of the smoothing processing applied to an evaluation region of the normal distance image as the correlation value decreases. When the correlation value is small, the influence of speckle noise is large. Therefore, increasing the strength of the smoothing processing can correct the speckle noise so that it is less noticeable. On the other hand, when the correlation value is large, the influence of speckle noise is small. Therefore, decreasing the strength of the smoothing processing can prevent the loss of the surface irregularities due to the smoothing processing. For pixels where two or more of the multiple evaluation regions overlap, the smoothing processor 66 may apply smoothing processing with strengths based on the correlation values of the two or more regions.
[0051] FIG. 10 is a conceptual diagram showing an example of the flow of smoothing processing. As shown in FIG. 10, the smoothing processing unit 66 adds the pixel value (DEPTH) of the pixel to be processed, changing the mixing ratio with the output of an LPF (low-pass filter) according to the smoothing strength (α=1-mixgain). The smoothing processing unit 66 multiplies the value obtained by applying the LPF to the pixel value (DEPTH) by the smoothing strength (α=1-mixgain). The smoothing processing unit 66 multiplies the pixel value (DEPTH) to which the LPF has not been applied by the smoothing mixing ratio (mixgain). The smoothing processing unit 66 adds the results of the two multiplications to obtain the pixel value (DEPTH_CORRECT_OUT) of the corrected distance image.
[0052] Fig. 11 is a diagram showing an example of coefficients of a low-pass filter used in smoothing processing, illustrating a specific example of the LPF in Fig. 10. In the example of Fig. 11, a pixel value to which the LPF has been applied is calculated by weighting and averaging pixel values in a range of 9 pixels x 9 pixels using the LPF coefficients. Note that the LPF coefficients are not limited to those shown in Fig. 11; a range of pixels other than 9 pixels x 9 pixels may be set, or coefficients different from the specific numerical values illustrated may be set.
[0053] Below, we will explain examples involving two objects with different surface shapes. FIG. 12 shows a distance image 32, a point cloud image 38, and a difference value image 44 according to a first example. The object according to the first example is an aluminum box with a flat surface. FIG. 13 shows a distance image 132, a point cloud image 138, and a difference value image 144 according to a second example. The object according to the second example is an aluminum box with wrinkled paper attached to its surface. The distance images 32 and 134 and the difference value images 44 and 144 are images of one evaluation area, which in this case is an area consisting of 64 horizontal pixels by 64 vertical pixels.
[0054] The point cloud images 38, 138 are three-dimensional images obtained from point cloud data obtained by mapping the pixel values (DEPTH) of each pixel in the distance images 32, 132 into three-dimensional space. The difference value images 44, 144 are images made up of difference values (DEPTH) calculated by the gradient removal unit 60. In the distance images 32, 132 and the difference value images 44, 144, pixels with larger pixel values are shown as being closer to black, and pixels with smaller pixel values are shown as being closer to white.
[0055] 12 shows a normal distance image 34, a first evaluation distance image 36a, a second evaluation distance image 36b, a third evaluation distance image 36c, and a fourth evaluation distance image 36d as distance images 32. As point cloud images 38, a normal point cloud image 40 obtained from normal distance image 34, a first point cloud image 42a obtained from first evaluation distance image 36a, a second point cloud image 42b obtained from second evaluation distance image 36b, a third point cloud image 42c obtained from third evaluation distance image 36c, and a fourth point cloud image 42d obtained from fourth evaluation distance image 36d are shown. The difference value images 44 shown in FIG. 13 include a first difference value image 44a obtained from the first evaluation distance image 36a, a second difference value image 44b obtained from the second evaluation distance image 36b, a third difference value image 44c obtained from the third evaluation distance image 36c, and a fourth difference value image 44d obtained from the fourth evaluation distance image 36d. The same applies to the normal distance image 134, the first evaluation distance images 136a to 136d, the normal point cloud image 140, the first point cloud images 142a to 142d, and the first difference value images 144a to 144d shown in FIG.
[0056] First, the normal point cloud image 40 is compared with the normal point cloud image 140. The normal point cloud image 40 obtained from an object with a flat surface contains a wavy pattern. On the other hand, the normal point cloud image 140 obtained from an object with a wrinkled surface also contains a wavy pattern. Therefore, it is difficult to determine whether this pattern is due to the wrinkles (uneven shape) of the object or due to speckle noise from only the normal point cloud images 40 and 140 generated from distance images obtained by lighting a normal pattern.
[0057] Next, the first difference value image 44a to the fourth difference value image 44d are compared with the first difference value image 144a to the fourth difference value image 144d. No correlation can be found visually from the first difference value image 44a to the fourth difference value image 44d obtained from an object with a flat surface. On the other hand, similar patterns can be visually confirmed to appear in the first difference value image 144a to the fourth difference value image 144d obtained from an object with a wrinkled surface, and it is considered that there is a high correlation.
[0058] The correlation values (r1 to r6) between the first evaluation distance image 36a to the fourth evaluation distance image 36d in Figure 11 are r1 = 0.094798, r2 = 0.20169, r3 = 0.151683, r4 = 0.084219, r5 = 0.063144, and r6 = 0.113293, and the average value (r_ave) of the three correlation values with the smallest absolute values (r1, r4, r5) is 0.08072. On the other hand, the correlation values (r1 to r6) between the first evaluation distance image 136a to the fourth evaluation distance image 136d in Figure 12 are r1 = 0.449943, r2 = 0.781383, r3 = 0.747637, r4 = 0.404592, r5 = 0.370536, and r6 = 0.681427, and the average value (r_ave) of the three correlation values with the smallest absolute values (r1, r4, r5) is 0.408357. As such, the correlation value of the evaluation region obtained for a subject with a flat surface is smaller than the correlation value of the evaluation region obtained for a subject with a wrinkled surface. From the above, it was confirmed that, between the unevenness of the subject's surface and speckle noise, the correlation value is low in regions where speckle noise is dominant, and high in regions where the unevenness of the subject's surface is dominant.
[0059] 14 is a flowchart showing the index value calculation process according to the first embodiment. The image acquisition unit 52 acquires a plurality of evaluation distance images (S10). The plurality of evaluation distance images are, for example, first to fourth evaluation distance images generated by the distance sensor block 14 as the light source control unit 16 switches between the first to fourth evaluation patterns. Each of the plurality of evaluation distance images may be obtained by the moving average unit 54 calculating a moving average of pixel values of distance images for a plurality of frames in the time direction.
[0060] The evaluation area extraction unit 56 extracts an evaluation area from each of the evaluation distance images (S12). The gradient removal unit 60 uses the gradient component values calculated by the gradient calculation unit 58 to calculate the difference value of each pixel within the evaluation area by gradient removal and to limit the difference value to an upper and lower limit (S14).
[0061] The correlation unit 62 calculates a correlation value between two of the multiple evaluation distance images for the evaluation area extracted in step S12 (S16). The smoothing strength determination unit 64 calculates an index value for the evaluation area extracted in step S12 based on the multiple correlation values calculated in step S16 (S18). If the evaluation area extraction unit 56 has not extracted all of the evaluation areas (N in S20), the process returns to step S12. If the evaluation area extraction unit 56 has extracted all of the evaluation areas (Y in S20), the process ends.
[0062] FIG. 15 is a flowchart illustrating the correction process for a normal distance image according to the first embodiment. The smoothing strength determination unit 64 acquires a pixel of the normal distance image acquired by the image acquisition unit 52 (S50). The smoothing strength determination unit 64 reads the index value of the evaluation area to which the acquired pixel belongs (S52). The index value calculated in the index value calculation process shown in FIG. 15 can be used as the index value for the evaluation area. The smoothing strength determination unit 64 reads the index values of evaluation areas surrounding the evaluation area to which the acquired pixel belongs (S54). If the acquired pixel is not located in an overlapping area of multiple evaluation areas, i.e., belongs to only one evaluation area (N in S56), the smoothing strength determination unit 64 sets the index value of the evaluation area to which the pixel belongs as the index value of the pixel (S58). On the other hand, if the acquired pixel is located in an overlapping area of multiple evaluation areas (Y in S56), the smoothing strength determination unit 64 sets the index value of the pixel to an index value based on the index values of each evaluation area (S60). After the processes of steps S58 and S60, the smoothing processing unit 66 performs smoothing processing on that pixel according to the set index value (S62). If the smoothing strength determination unit 64 has not acquired all the pixels of the normal distance image (N in S64), the process returns to step S50. On the other hand, if the smoothing strength determination unit 64 has acquired all the pixels of the normal distance image (Y in S64), the process ends.
[0063] According to this embodiment, a correlation value between a first evaluation distance image obtained by illuminating the subject 20 from the first light source 12a and a second evaluation distance image obtained by illuminating the subject 20 from the second light source 12b is calculated for each of a plurality of evaluation regions. Furthermore, smoothing processing of an intensity corresponding to the correlation value is applied to the normal distance images obtained by illuminating the subject 20 from the first light source 12a and the second light source 12b. Therefore, the smoothing processing of evaluation regions with low correlation values is relatively strong to reduce speckle noise, and the smoothing processing of evaluation regions with high correlation values is relatively weak to reproduce the uneven shape of the subject 20 in the normal distance image.
[0064] According to this embodiment, for the first evaluation distance image and the second evaluation distance image, a gradient component value for each pixel is calculated based on the average value of the pixel values of multiple pixels aligned vertically or horizontally within each of multiple evaluation regions. Furthermore, a correlation value is calculated using a difference value obtained by subtracting the gradient component value from the pixel value of each pixel in the first evaluation distance image and the second evaluation distance image. When the subject 20 is tilted in the depth direction, the correlation value tends to be high due to the tilt, making it difficult to evaluate the influence of speckle noise. By calculating the correlation value using a difference value obtained by subtracting the gradient component value from the pixel value of each pixel, the influence of this tilt can be reduced, making it possible to more appropriately calculate a correlation value indicating the influence of speckle noise.
[0065] According to this embodiment, when the difference value is greater than a predetermined upper limit, the upper limit is used to calculate the correlation value, and when the difference value is smaller than a predetermined lower limit, the lower limit is used to calculate the correlation value. This reduces the influence of abnormal values such as flying pixels, and allows for more appropriate calculation of the correlation value that indicates the degree of influence of speckle noise.
[0066] According to this embodiment, the multiple evaluation regions are set to partially overlap, and for pixels where two or more of the multiple evaluation regions overlap, smoothing processing is applied with strength based on the correlation values of each of the two or more regions. Therefore, the strength of the smoothing processing applied to consecutive pixels can be set to gradually change, making it possible to make the corrected distance image obtained by applying the smoothing processing a more natural image.
[0067] Second Embodiment The first embodiment is based on the assumption that the subject is not moving. Hereinafter, a second embodiment will be described as an embodiment that also supports the case where the subject is moving.
[0068] 16 is a diagram schematically illustrating the configuration of a distance measuring device 10A according to the second embodiment. In the second embodiment, a light source control unit 16A and a distance image correction unit 18A differ from those in the first embodiment. The following description of the second embodiment will focus on the differences from the first embodiment, and commonalities will be omitted as appropriate. In the drawings, the same reference numerals will be used to designate components similar to those in the first embodiment.
[0069] FIG. 17 is a schematic diagram showing the configuration of the light source device 12. FIG. 17 is a view of the distance measuring device 10A as seen from the subject 20 side. Unlike the first embodiment, the evaluation patterns switched by the light source control unit 16A include a first evaluation pattern in which the first light source group 12S is turned on and a second evaluation pattern in which the second light source group 12T is turned on. The first light source group 12S includes the first light source 12a and the fourth light source 12d. The second light source group 12T includes the second light source 12b and the third light source 12c. In other words, the first evaluation pattern is a pattern in which the first light source 12a and the fourth light source 12d are turned on simultaneously. The second evaluation pattern is a pattern in which the second light source 12b and the third light source 12c are turned on simultaneously.
[0070] 16 , the light source control unit 16A switches between the normal pattern, the first evaluation pattern, and the second evaluation pattern in a predetermined order. The light source control unit 16A may repeatedly switch between the lighting patterns in the predetermined order. The predetermined order is, for example, the first evaluation pattern, the normal pattern, the second evaluation pattern, and the normal pattern. The light source control unit 16A switches between the lighting patterns at, for example, 20 frames per second, although this is not particularly limited.
[0071] 18 is a block diagram schematically illustrating the functional configuration of distance image correction unit 18A. Distance image correction unit 18A differs from distance image correction unit 18 of the first embodiment in terms of an image acquisition unit 52A, a moving average unit 54A, a correlation unit 62A, and a smoothing processing unit 66A. Distance image correction unit 18A also differs from distance image correction unit 18 of the first embodiment in that it further includes a detection region extraction unit 68 and a motion detection unit 70.
[0072] Image acquisition unit 52A sequentially acquires distance images corresponding to each lighting pattern in accordance with the switching of the lighting patterns of light source control unit 16A in a predetermined order. FIG. 19 is a diagram showing an example of the frame-by-frame operation of distance image correction unit 18A. For example, image acquisition unit 52A acquires a first evaluation distance image in the first frame and stores it in the first frame memory. Image acquisition unit 52A acquires a normal distance image in the second frame and stores it in the second frame memory. Image acquisition unit 52A acquires a second evaluation distance image in the third frame and stores it in the third frame memory. Image acquisition unit 52A acquires a normal distance image in the fourth frame and stores it in the fourth frame memory. Image acquisition unit 52A repeats the same operation as for frames 1 to 4 for frames 5 to 8 and frames 9 to 12, and so on.
[0073] 18 , the detection area extraction unit 68 extracts a detection area from the distance image to be used in the motion detection process by the motion detection unit 70. The detection area may be a predetermined area. The detection area can be arbitrarily set depending on the range of motion of the subject to be detected, and may be, for example, an area consisting of 16 horizontal pixels by 16 vertical pixels. The detection area extraction unit 68 may extract a detection area for each frame in which the image acquisition unit 52A acquires a distance image.
[0074] The motion detection unit 70 compares multiple normal distance images generated at different times and detects motion for each of multiple detection areas set in the normal distance images. In the example shown in FIG. 19 , the motion detection unit 70 calculates a correlation value (hereinafter referred to as a "motion correlation value") for each detection area between the normal distance image stored in the second frame memory and the normal distance image stored in the fourth frame memory at times when the frame number is even. If the absolute value of the calculated motion correlation value is equal to or less than a predetermined threshold, the motion detection unit 70 sets a motion flag for that detection area to 1. This is because a low absolute value of the motion correlation value between multiple normal distance images generated at different times is likely due to subject movement. The motion correlation value can be calculated, for example, using the above-mentioned equation (3). Specifically, the motion correlation value can be calculated by substituting n for the number of pixels in the detection area, x for the pixel value of the detection area in the second frame memory, and y for the pixel value of the same pixel in the fourth frame memory.
[0075] The moving average unit 54A calculates a moving average of pixel values of multiple distance images generated at different times. The multiple distance images used here are multiple distance images generated when the light source control unit 16A has the same lighting pattern. That is, all of the multiple distance images are first evaluation distance images, second evaluation distance images, or normal distance images. The moving average unit 54A also changes the degree of moving average depending on whether motion is detected by the motion detection unit 70. In particular, the moving average unit 54A does not calculate a moving average for pixels in areas where motion is detected among the multiple detection areas, but calculates a moving average of pixel values of multiple distance images generated at different times for pixels in areas where motion is not detected.
[0076] The weighted average performed by the moving average unit 54A may be of the FIR (Finite Impulse Response) type or of the cyclic type. In the case of the cyclic type, for example, at the timing of the fifth frame in FIG. 19 , the moving average unit 54A multiplies the pixel value (IN) of the pixel of the first evaluation distance image newly acquired and stored in the first frame memory by a coefficient (1 / A). The moving average unit 54A also multiplies the pixel value (1FB) of the pixel of the first evaluation distance image stored in the first moving average memory by a coefficient (1-1 / A). By adding these values together, the weighted average (MOVEAVE) of the pixel values of the first evaluation distance image is calculated. This is expressed by the following equation (6): MOVEAVE = 1 / A × IN + (1-1 / A) × 1FB (6). Here, 1FB is the pixel value of the pixel of the first evaluation distance image for the first frame. A can be changed as desired.
[0077] The moving average unit 54A stores MOVEAVE calculated by equation (6) in the first moving average memory. Then, at the timing of the ninth frame, the next MOVEAVE is calculated by reading 1FB of equation (6) from the first moving average memory. In this way, the weighted average of the pixel values of the first evaluation distance image is updated as needed.
[0078] Here, when the moving average unit 54A calculates the weighted average of the pixel values of the first evaluation distance image, if the motion flag of the detection area including that pixel is set to 1, the coefficient (A) in equation (6) is set to 1. For example, when the moving average unit 54A calculates the weighted average for the fifth frame, if the motion flag for the second or fourth frame is set to 1, by setting the coefficient (A) in equation (6) to 1, the calculated weighted average becomes equal to the pixel value of the first evaluation distance image acquired for the fifth frame. In other words, the circulation of the weighted average is reset.
[0079] Similarly, the moving average unit 54A calculates a weighted average of the pixel values of the pixels in the second evaluation distance image when the second evaluation distance image is acquired, such as the third frame, seventh frame, eleventh frame, and stores the weighted average in the second moving average memory. Similarly, the moving average unit 54A calculates a weighted average of the pixel values of the pixels in the normal distance image when the normal distance image is acquired, such as the second frame, fourth frame, sixth frame, and stores the weighted average in the third moving average memory. Similarly, when the motion flag is set to 1, the coefficient (A) in equation (6) is set to 1.
[0080] As described above, random noise in the distance images can be reduced by the moving average unit 54A performing a weighted average of the pixel values of multiple distance images generated at multiple times. Furthermore, because the moving average unit 54A does not perform a weighted average of the pixel values of pixels in areas where movement is detected, it is possible to eliminate the effect of adding together distance images that show different states of the subject before and after movement is detected.
[0081] The evaluation area extraction unit 56, gradient calculation unit 58, and gradient removal unit 60 are the same as those in the first embodiment. However, in this embodiment, the gradient removal unit 60 calculates the difference value of pixels in each evaluation distance image using the weighted average calculation result by the moving average unit 54A. In the example of FIG. 19 , the gradient removal unit 60 reads the pixel value of each pixel in the first evaluation distance image from the first moving average memory and calculates the difference value. In addition, the gradient removal unit 60 reads the pixel value of each pixel in the second evaluation distance image from the second moving average memory and calculates the difference value.
[0082] Similar to the correlation unit 62 in the first embodiment, the correlation unit 62A calculates the correlation value between the first evaluation distance image and the second evaluation distance image for each evaluation area. However, in this embodiment, since there are no evaluation distance images other than the first evaluation distance image and the second evaluation distance image, it is only necessary to calculate the correlation value between the first evaluation distance image and the second evaluation distance image.
[0083] For pixels in a region where motion is detected among the plurality of detection regions, the correlation unit 62A calculates a correlation value from pixel values of distance images generated at timings corresponding to the detection of the motion.Furthermore, for pixels in a region where motion is not detected among the plurality of detection regions, the correlation unit 62A calculates a correlation value from a weighted average of pixel values of multiple distance images generated at multiple timings.
[0084] 19 , the correlation unit 62A reads the pixel values of each pixel in the first evaluation distance image from the first moving average memory, reads the pixel values of each pixel in the second evaluation distance image from the second moving average memory, and calculates a correlation value. The correlation unit 62A may calculate the correlation value using the difference value calculated by the gradient removal unit 60. That is, the correlation unit 62A may calculate the correlation value using a difference value obtained by subtracting a gradient component value from the pixel value of each pixel in the first evaluation distance image and the second evaluation distance image. Furthermore, if the difference value is greater than a predetermined upper limit value, the correlation unit 62A may calculate the correlation value using the upper limit value, and if the difference value is smaller than a predetermined lower limit value, the correlation unit 62A may calculate the correlation value using the lower limit value.
[0085] The correlation unit 62A may calculate the correlation value when a new distance image is acquired. For example, the correlation unit 62A may calculate the correlation value at the timing of an even-numbered frame when a normal distance image is acquired.
[0086] Similar to the smoothing processor 66 of the first embodiment, the smoothing processor 66A applies smoothing processing of an intensity corresponding to the correlation value to each evaluation region of the normal distance image generated when a normal pattern is irradiated, thereby generating a corrected distance image. The normal distance image to which the smoothing processor 66A applies smoothing processing may be the normal distance image after weighted averaging stored in the second moving average memory of FIG. 19 . The smoothing processor 66A applies smoothing processing to detection regions in which no motion is detected to generate a corrected distance image. On the other hand, the smoothing processor 66A does not apply smoothing processing to detection regions in which motion is detected. For example, for detection regions in which the motion flag is set to 1, the smoothing processor 66A sets the smoothing mixing ratio (mixgain) in FIG. 10 to 1. In other words, smoothing processing may be omitted by setting the smoothing intensity α to 0. The smoothing processor 66A may generate a corrected distance image at the timing of an even-numbered frame in which the normal distance image is acquired.
[0087] Distance measuring device 10A may output the generated corrected distance image at any time. If the corrected distance image is generated at the timing of even-numbered frames, distance measuring device 10A may output the corrected distance image each time. This makes it possible to obtain corrected distance images with reduced speckle noise in real time.
[0088] According to this embodiment, smoothing processing is applied to detection areas in which no motion is detected among multiple detection areas set in a normal distance image, thereby making it possible to selectively apply smoothing processing to areas in which speckle noise on the surface of the subject is likely to be noticeable due to the lack of subject motion.
[0089] According to this embodiment, for pixels in areas of the multiple detection areas where no movement is detected, a correlation value is calculated from a weighted average of pixel values of multiple distance images generated at multiple times. Therefore, in areas where speckle noise is likely to be noticeable due to the lack of subject movement, random noise can be removed by weighted averaging, and a correlation value indicating the degree of influence of speckle noise can be more appropriately calculated.
[0090] The present invention has been described above with reference to the above-mentioned embodiments, but the present invention is not limited to the above-mentioned embodiments, and appropriate combinations or substitutions of the configurations shown in the embodiments are also included in the present invention.
[0091] According to the present invention, a distance image in which speckle noise is less noticeable can be generated.
[0092] 10, 10A... distance measuring device, 12... light source device, 12a... first light source, 12b... second light source, 14... distance sensor block, 16, 16A... light source control unit, 20... subject, 22a... first illumination light, 22b... second illumination light, 24... light from subject, 58... gradient calculation unit, 62, 62A... correlation unit, 66, 64A... smoothing processing unit, 70... motion detection unit.
Claims
1. A distance measuring device comprising: a first light source that irradiates a subject with a first illumination light; a second light source that irradiates the subject with a second illumination light; a distance sensor that detects light from the subject and generates a distance image; a light source control unit that switches between a normal pattern that turns on the first light source and the second light source, a first evaluation pattern that turns on the first light source, and a second evaluation pattern that turns on the second light source; a correlation unit that calculates a correlation value between a first evaluation distance image generated when the first evaluation pattern is irradiated and a second evaluation distance image generated when the second evaluation pattern is irradiated, for each of a plurality of evaluation areas set in the distance image; and a smoothing processing unit that applies a smoothing process of a strength corresponding to the correlation value to the normal distance image generated when the normal pattern is irradiated, to generate a corrected distance image.
2. The ranging device of claim 1, further comprising a gradient calculation unit that calculates a gradient component value for the first evaluation distance image and the second evaluation distance image based on the average value of pixel values of multiple pixels lined up vertically or horizontally in each of the multiple evaluation areas, and the correlation unit calculates the correlation value using a difference value obtained by subtracting the gradient component value from the pixel value of each pixel in each of the first evaluation distance image and the second evaluation distance image.
3. The distance measuring device according to claim 2, wherein the correlation unit calculates the correlation value using a predetermined upper limit value when the difference value is greater than the upper limit value, and calculates the correlation value using a predetermined lower limit value when the difference value is smaller than the lower limit value.
4. The distance measuring device of claim 1, wherein the multiple evaluation areas are set to partially overlap, and the smoothing processing unit applies the smoothing processing to pixels where two or more of the multiple evaluation areas overlap, the smoothing processing having an intensity based on the correlation values of each of the two or more areas.
5. The ranging device of claim 1, further comprising a motion detection unit that compares multiple normal distance images generated at different times and detects motion for each of multiple detection areas set in the normal distance images, and the smoothing processing unit applies the smoothing processing to detection areas in which no motion is detected to generate the corrected distance image.
6. The ranging device of claim 5, wherein the correlation unit calculates the correlation value for pixels in areas among the multiple detection areas where motion is detected from pixel values of the first evaluation distance image and the second evaluation distance image generated at a timing corresponding to the detection of the motion, and calculates the correlation value for pixels in areas among the multiple detection areas where motion is not detected from a weighted average of pixel values of the multiple first evaluation distance images generated at multiple timings and a weighted average of pixel values of the multiple second evaluation distance images generated at multiple timings.
7. A distance measuring method comprising: a step of switching between a normal pattern in which a first light source that irradiates a subject with a first illumination light and a second light source that irradiates the subject with a second illumination light, a first evaluation pattern that turns on the first light source, and a second evaluation pattern that turns on the second light source; a step of detecting light from the subject using a distance sensor to generate a distance image; a step of calculating a correlation value between a first evaluation distance image generated when the first evaluation pattern is irradiated and a second evaluation distance image generated when the second evaluation pattern is irradiated, for each of a plurality of evaluation areas set in the distance image; and a step of applying a smoothing process of a strength corresponding to the correlation value to the normal distance image generated when the normal pattern is irradiated to generate a corrected distance image.
Citation Information
Patent Citations
Removing device for speckle noise
JP1993141965A
Light source, projection device, measurement device, robot, electronic apparatus, moving body, and molding device
JP2020009749A
System and method for detecting defect on wafer
JP2020034572A
Systems, methods, and apparatus for autonomous diagnostic verification of optical components of vision-based inspection systems
JP2022501594A
Simultaneous multi-directional laser wafer inspection
US20180073993A1
Cited By
Distance measurement device and distance measurement method
WO2026120971A1
