Distance measuring device and distance measuring method

The device uses multiple light sources and correlation-based smoothing to reduce speckle noise in distance images, ensuring accurate representation of object surfaces.

JP2024136596APending Publication Date: 2024-10-04JVC KENWOOD CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2023047751
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-24
Publication Date
2024-10-04

AI Technical Summary

Technical Problem

Existing distance measuring devices using coherent illumination light, such as laser beams, suffer from speckle noise in distance images, which are challenging to reduce effectively without requiring numerous lighting means or complex wavelength modulation.

Method used

A distance measuring device employing multiple light sources positioned differently to irradiate illumination light at varying angles, combined with a distance sensor, calculates correlation values between evaluation distance images to adjust smoothing processing, reducing speckle noise while maintaining object surface detail.

Benefits of technology

The method effectively reduces speckle noise in distance images, preserving the accuracy of object surface details by adaptively adjusting smoothing based on correlation values, resulting in clearer distance images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024136596000001_ABST
    Figure 2024136596000001_ABST
Patent Text Reader

Abstract

To generate a distance image in which speckle noise is hardly conspicuous.SOLUTION: A distance measuring device 10 comprises: a first light source 12a for irradiating a subject 20 with first illumination light 22a; a second light source 12b for irradiating the subject 20 with second illumination light 22b; a distance sensor 14 for detecting light from the subject 20 and generating a distance image; a light source control unit 16 for switching among a regular pattern for turning on the first light source 12a and the second light source 12b, a first evaluation pattern for turning on the first light source 12a, and a second evaluation pattern for turning on the second light source 12b; a correlation unit 62 for calculating a correlation value between a first evaluation distance image generated at irradiation of the first evaluation pattern and a second evaluation distance image generated at irradiation of the second irradiation pattern, separately for each of a plurality of evaluation regions set to distance images; and a smoothing processing unit 66 for applying smoothing processing of an intensity corresponding to the correlation value to a regular distance image generated at irradiation of the regular pattern so as to generate a correction distance image.SELECTED DRAWING: Figure 3
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present invention relates to a distance measuring device and a distance measuring method. [Background technology]

[0002] Distance measuring devices are known that generate distance images by irradiating 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 ToF (Time of Flight) sensor. However, such illumination light has coherence, and may cause speckle noise in the distance image. Several techniques have been proposed for reducing speckle noise. For example, Patent Document 1 discloses a technique that combines multiple (N) light projecting means arranged so that the optical paths to the object surface are different, and adds multiple laser lights projected from the multiple light projecting means to reduce the speckle contrast to 1 / √N. Patent Document 2 also discloses a technique that modulates the oscillation wavelength of laser light to change the phase of scattered light, and superimposes the changed speckle pattern to reduce noise. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Japanese Patent Application Publication No. 5-141965 [Patent Document 2] JP 2020-9749 A Summary of the Invention [Problem to be solved by the invention]

[0004] The technology disclosed in Patent Document 1 requires multiple lighting means to sufficiently reduce speckle noise, while the technology disclosed in Patent Document 2 requires a device capable of modulating the oscillation wavelength to emit laser light of multiple wavelengths.

[0005] The present invention has been made in consideration of the above circumstances, and has an object to provide a technique for generating a distance image in which speckle noise is less noticeable. [Means for solving the problem]

[0006] In order to solve the above problems, a distance measuring device of one embodiment of the present invention includes a first light source that irradiates a subject with a first illumination light, a second light source that irradiates a 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 in which the first light source and the second light source 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, 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 measuring method, which includes the steps of switching between a normal pattern in which a first light source for irradiating a subject with a first illumination light and a second light source for irradiating a 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 applying a smoothing process of a strength according to the correlation value to the normal distance image generated when the normal pattern is irradiated to generate a corrected distance image.

[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 as aspects of the present invention. Effect of the Invention

[0009] According to the present invention, a distance image in which speckle noise is less noticeable can be generated. [Brief description of the drawings]

[0010] [Figure 1] FIG. 2 is a diagram showing an example of a captured image of a subject. [Diagram 2] 2(a) and (b) are diagrams showing an example of a point cloud image of the same subject as in FIG. [Diagram 3] FIG. 1 is a diagram illustrating a schematic configuration of a distance measuring device according to a first embodiment. [Figure 4] 4 is a schematic diagram showing the configuration of the light source device in FIG. 3. [Diagram 5] 4 is a block diagram illustrating a functional configuration of a distance image correction unit in FIG. 3. [Figure 6] FIG. 13 is a conceptual diagram showing an example of setting a plurality of evaluation regions. [Figure 7] FIG. 13 is a conceptual diagram showing an example of multiple evaluation regions overlapping in the horizontal direction. [Figure 8] FIG. 13 is a conceptual diagram showing an example of multiple evaluation areas overlapping in the vertical direction. [Figure 9] 9(a) to 9(c) are diagrams showing an example of an evaluation region used for calculating a gradient component value by the gradient calculation unit. [Figure 10] FIG. 11 is a conceptual diagram showing an example of the flow of a smoothing process. [Figure 11] FIG. 11 is a diagram illustrating an example of coefficients of a low-pass filter used in the smoothing process. [Figure 12] 3A to 3C are diagrams showing a distance image, a point cloud image, and a difference value image according to the first embodiment. [Figure 13] 13A to 13C are diagrams showing a distance image, a point cloud image, and a difference value image according to a second embodiment. [Figure 14] 5 is a flowchart showing an index value calculation process according to the first embodiment. [Figure 15] 5 is a flowchart showing a normal distance image correction process according to the first embodiment. [Figure 16]FIG. 11 is a diagram illustrating a schematic configuration of a distance measuring device according to a second embodiment. [Figure 17] 18 is a schematic diagram showing the configuration of the light source device of FIG. 17. [Figure 18] 18 is a block diagram illustrating a functional configuration of a distance image correction unit in FIG. 17. [Figure 19] 18 is a diagram illustrating an example of the operation of the distance image correction unit in FIG. 17 on a frame-by-frame basis. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0011] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. Specific numerical values ​​and the like shown in the embodiment are merely examples for facilitating understanding of the invention, and do not limit the present invention unless otherwise specified. In the drawings, elements that are not directly related to the present invention are omitted.

[0012] First, before going into the description of the embodiment, a brief description will be given of speckle noise in a distance image. Fig. 1 shows an example of a captured image of a subject 20, which is an image captured by a general camera. The subject 20 has a surface 21 that is composed of a smooth flat surface with few irregularities. As shown in Fig. 1, in the captured image, the surface 21 of the subject 20 appears to be a smooth flat surface with few irregularities.

[0013] 2(a) and (b) show an example of a point cloud image 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 using a VCSEL (Vertical Cavity Surface Emitting Laser) that emits laser light as illumination light as a light source, and converted into point cloud data. FIG. 2(b) shows a point cloud image in which a rectangular area 21a, which is a part of the surface 21 of the object 20 shown in FIG. 2(a), is enlarged. As shown in FIGS. 2(a) and (b), the surface 21 of the object 20, which appears as a smooth plane in the captured image of FIG. 1, appears to include a wavy uneven shape in the point cloud image. This is because the reflected light from the object 20 forms interference fringes due to the coherence of the laser light, and speckle noise appears in the distance image. The uneven shape caused by the speckle noise is problematic because it does not show 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 very noticeable when the surface 21 of the object 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 present inventors have found the following as a method for making speckle noise in a distance image less noticeable. First, a plurality of evaluation distance images are obtained by irradiating illumination light from a plurality of light sources arranged at different positions on the subject 20 at different times. Here, it is considered that the speckle noise generated in the plurality of evaluation distance images is different from each other due to the difference in the angle of illumination light from the plurality of light sources. On the other hand, it is considered that the uneven shape of the surface of the subject included in the plurality of evaluation distance images is common because it is the same subject. When a plurality of evaluation distance images are compared by region and a correlation value is calculated, it is considered that the correlation value is high when the uneven shape of the subject is dominant, and the correlation value is low when the speckle noise is dominant. Based on such a correlation value, the strength of the smoothing process for making the speckle noise less noticeable is adjusted. Specifically, the smoothing process is strengthened in the region with a low correlation value, and the smoothing process is weakened in the region with a high correlation value. As a result, in the region where the speckle noise is dominant, the smoothing process is strengthened to make the speckle noise less noticeable. 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 damaged. As a result, the overall distance image can effectively reduce conspicuous speckle noise while maintaining the reproducibility of the uneven shape of the subject's surface. The present embodiment will be described below.

[0015] (First embodiment) 3 is a diagram showing a schematic configuration of a distance measuring device 10 according to the first embodiment. 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. Light source device 12 includes, for example, a first light source 12a and a second light source 12b. Light source device 12 further includes a third light source 12c and a fourth light source 12d, as shown in FIG. 4 described later.

[0016] FIG. 4 is a schematic diagram showing the configuration of the light source device 12. FIG. 4 is a diagram showing 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 each are 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 are irradiated onto the subject 20 are also different. The first illumination light 22a to the fourth illumination light 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 lights irradiated onto the subject 20 by the light source device 12 are collectively referred to as illumination light 22.

[0017] In the example of FIG. 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 on the top, bottom, left and right of the distance sensor block 14. Specifically, the first light source 12a and the fourth light source 12d are arranged on the top and bottom of the distance sensor block 14, and the second light source 12b and the third light source 12c are arranged on 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, illumination light 22 from the light source device 12 reflected by the subject 20. 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 the 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, including one or more.

[0020] The imaging element 28 is composed of a two-dimensional image sensor such as a CCD (Charge Coupled Devices) sensor or a CMOS (Complementary Metal Oxide Semiconductor) sensor. The imaging element 28 has a plurality of pixels in both the horizontal and vertical directions. The number of pixels of the imaging element 28 is not particularly limited, but is, for example, 640 pixels horizontally by 480 pixels vertically. The imaging element 28 photoelectrically converts the light imaged on the light receiving surface for each pixel, and outputs the converted signal to the distance conversion unit 30 as an electrical signal. The imaging element 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 signal for each pixel input from image sensor 28 into a distance value indicating 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 the normal pattern is irradiated is referred to as a normal distance image. Also, an image generated by the distance sensor block 14 when the m-th evaluation pattern is irradiated is referred to as an m-th 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 a correlation value between a plurality of evaluation distance images. A smoothing process having a strength corresponding to the calculated correlation value is applied to the normal distance image to generate a corrected distance image in which 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 cooperation 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 central processing unit (CPU) or a graphics processing unit (GPU) of a computer, and memories such as a read only memory (ROM) or a random access memory (RAM). The software of distance image correction unit 18 is realized by a computer program or the like.

[0025] The image acquiring unit 52 acquires distance images generated by the distance sensor block 14. The image acquiring 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 acquiring unit 52 may acquire distance images of multiple frames 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 distance images of multiple frames 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 distance images of multiple frames, the moving average unit 54 can reduce random noise other than speckle noise in the distance images. If the processing of the moving average unit 54 is applied to the evaluation distance image, the effect 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 areas set in advance. 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 size of the speckle noise to be reduced. The evaluation areas are, for example, areas consisting of 64 pixels horizontally by 64 pixels vertically.

[0028] Fig. 6 is a conceptual diagram showing an example of setting a plurality of evaluation regions. Fig. 6 shows an evaluation region 80 set at an arbitrary position other than the periphery of the distance image, and four evaluation regions 81, 82, 83, and 84 overlapping with the evaluation region 80 at the top, bottom, left, and right positions. BlockNo[x,y] in Fig. 6 is the horizontal and vertical region numbers of the evaluation region. If the evaluation region 80 in the center of Fig. 6 is BlockNo[x,y], the upper evaluation region 81 is BlockNo[x,y-1], the lower evaluation region 84 is BlockNo[x,y+1], the left evaluation region 82 is BlockNo[x-1,y], and the right evaluation region 83 is BlockNo[x+1,y].

[0029] As shown in FIG. 6, the central evaluation area 80 (BlockNo[x,y]) has a non-overlapping area 90 that does not overlap with the evaluation areas 81-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-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. In addition, the central evaluation area 80 (BlockNo[x,y]) overlaps with each of the four evaluation areas 81-84 located above, below, left, and right by 16 pixels in at least one of the horizontal and vertical directions.

[0030] FIG. 7 is a conceptual diagram for explaining an example of multiple evaluation areas overlapping in the horizontal direction. Among the multiple evaluation areas set in the distance image, the evaluation area located in the upper left corner is designated as BlockNo[0,0], and the evaluation areas located on the right side in the horizontal direction are designated as BlockNo[0,1], BlockNo[0,2], ... in order. Each evaluation area is an area consisting of 64 pixels horizontally by 64 pixels vertically, and horizontally consecutive evaluation areas overlap each other by 16 pixels horizontally. In other words, out of the total number of pixels of each evaluation area, which is 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] are both 16 x 64 = 1024 pixels.

[0031] FIG. 8 is a conceptual diagram illustrating an example of multiple evaluation areas overlapping vertically. Among the multiple evaluation areas set in the distance image, the evaluation area located in the upper left corner is designated as BlockNo[0,0], and the evaluation areas located vertically below are designated as BlockNo[1,0], BlockNo[2,0], .... Each evaluation area is an area consisting of 64 pixels horizontally by 64 pixels vertically, and vertically consecutive evaluation areas overlap each other by 16 pixels vertically. In other words, out of the total number of pixels of each evaluation area, which is 64 x 64 = 4096 pixels, the overlapping area between BlockNo[0,0] and BlockNo[1,0] and the overlapping area between BlockNo[1,0] and BlockNo[2,0] are both 16 x 64 = 1024 pixels.

[0032] Returning to FIG. 5, the inclination calculation unit 58 calculates the inclination component value of each pixel of an evaluation distance image in which multiple evaluation regions are set, based on the average value of pixel values ​​of multiple pixels aligned vertically or horizontally in each of the multiple evaluation regions. Here, the inclination component value means the inclination of the surface 21 of the subject 20 in the depth direction, and refers to a distance value averaged to exclude small uneven shapes of the surface 21 of the subject 20. For example, the inclination calculation unit 58 may determine, as the inclination component value of each pixel, the average value of the pixel values ​​of multiple pixels aligned vertically or horizontally in each of the multiple evaluation regions, which has a larger absolute value of difference from the average value of the pixel values ​​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 example of FIG. 9(a) to 9(c), the evaluation area is an area consisting of 64 pixels horizontally by 64 pixels vertically. FIG. 9(a) shows a horizontal average value which is an average of pixel values ​​of a plurality of pixels arranged horizontally in 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 an average of pixel values ​​of a plurality of pixels arranged vertically in 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 region.

[0034] For example, the gradient calculation unit 58 calculates a gradient component value HV_Ave[L] for a pixel having a pixel number L in the vertical direction, using the following formula (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 an absolute value, and HV_Ave[L] indicates a gradient component value of a pixel whose vertical pixel number is L. By calculating formula (1) for L=1 to 64, that is, for all pixels in the evaluation area, the gradient component values ​​of all pixels in the evaluation area can be calculated. In this example, the same gradient component value is used for multiple pixels arranged horizontally. By making the gradient component values ​​of multiple pixels arranged horizontally the same, the overall gradient component in the evaluation area can be properly represented. According to the inventor's knowledge, when the gradient component value is calculated individually for each pixel, the difference in gradient component value between adjacent pixels may become large, and the overall gradient component cannot be properly represented. Note that, instead of this example, the same gradient component value may be used for multiple pixels arranged vertically, not horizontally. For example, the vertical pixel number L in the above formula (1) may be replaced with the horizontal pixel number P to calculate the gradient component value of the pixel whose horizontal pixel number is P. In this case, by making the gradient component values ​​of multiple pixels arranged vertically the same, the overall gradient component in the evaluation area can be properly represented.

[0035] Returning to Fig. 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 the 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. Since the speckle noise component contained in the difference value is relatively small, by limiting the upper and lower limits of the difference value, it is possible to 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 horizontal pixel number P and 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 in the evaluation areas 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 evaluation distance images among 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 of 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 formula (3).

[0041]

number

[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 and 64 pixels vertically, n = 64 × 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. y i is the difference value (DIFFy) of each pixel in the evaluation area of ​​the other evaluation distance image. 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 the correlation unit 62 calculates the first correlation value between the first evaluation distance image and the second evaluation distance image for each evaluation area, it substitutes DIFF1(P,L) for DIFFx and DIFF2(P,L) for DIFFy in formula (3) to obtain 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 the uneven shape component and the speckle noise component on the surface 21 of the subject 20. The uneven shape component is less affected by the difference in the 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 the difference in the 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 the speckle noise is small, and a small correlation value means that the influence of the speckle noise is large.

[0044] The correlation unit 62 can calculate a plurality of correlation values ​​by changing the combination of two evaluation distance images. Specifically, the correlation unit 62 can calculate 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 for each evaluation region. The number of types of correlation values ​​calculated by the correlation unit 62 depends on the number of types of evaluation distance images obtained by the light source control unit 16 switching the evaluation pattern. When there are m types of evaluation distance images, the number of types of correlation values ​​is m×(m−1) / 2. For example, when there are two types of evaluation distance images, only one type of correlation value is obtained, which is the correlation value between the two images.

[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 value calculated by the correlation unit 62. For example, the smoothing strength determination unit 64 may calculate an index value indicating the degree of influence of speckle noise in the evaluation region based on a plurality of 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 set the average of two or more correlation values ​​of the plurality of correlation values ​​r1 to r6 as the index value for the evaluation region. Specifically, the smoothing strength determination unit 64 sets the average (r_ave) of three correlation values ​​having the smallest absolute values ​​among the six correlation values ​​(r1 to r6) as the index value (index). The larger the index value, the smaller the degree of influence of speckle noise in the evaluation region, and the smaller the index value, the greater the degree of influence of speckle noise in the 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 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 respective index values ​​of the two or more evaluation regions.

[0047] For example, for a first overlap region 92 in which the central evaluation region 80 (BlockNo[x,y]) and the right-hand 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-hand 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 makes it possible to set the correlation value of each pixel in the first overlap region 92 so as to gradually approach the index value of the closer of the two evaluation regions.

[0048] The smoothing strength determination unit 64 may calculate the index value for the second overlap region 94 based on the correlation values ​​of the four evaluation regions that overlap in the second overlap region 94. Also, 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 the smoothing mixture ratio (mixgain) adjusted as shown in the following formula (5). mixgain = indexmix × GAIN IF mixgain > 1 mixgain = 1 (5) Here, GAIN is an arbitrary value, for example, 2. In the following description, the smoothing strength α is also referred to as the value obtained by subtracting the smoothing mixture ratio (mixgain) from 1. Therefore, the smoothing strength α=1-mixgain.

[0050] Returning to FIG. 5, the smoothing processor 66 applies smoothing processing of an intensity determined by the smoothing intensity determination unit 64, i.e., an intensity according to the correlation value, to the normal distance image generated when the normal pattern is irradiated, 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 intensity of the smoothing processing applied to the evaluation region of the normal distance image as the correlation value of the evaluation region is smaller. When the correlation value is small, the influence of speckle noise is large, so that the intensity of the smoothing processing can be increased to correct the speckle noise so that it is not noticeable. On the other hand, when the correlation value is large, the influence of speckle noise is small, so that the intensity of the smoothing processing can be reduced to prevent the uneven shape of the surface from being lost by the smoothing processing. The smoothing processor 66 may apply smoothing processing of an intensity based on the correlation values ​​of the two or more regions to a pixel where two or more of the multiple evaluation regions overlap.

[0051] FIG. 10 is a conceptual diagram showing an example of the flow of the smoothing process. As shown in FIG. 10, the smoothing processor 66 changes the mixing ratio with the output of the LPF (low pass filter) according to the smoothing strength (α=1-mixgain) and adds it to the pixel value (DEPTH) of the pixel to be processed. The smoothing processor 66 multiplies the value obtained by applying the LPF to the pixel value (DEPTH) by the smoothing strength (α=1-mixgain). The smoothing processor 66 multiplies the pixel value (DEPTH) to which the LPF is not applied by the smoothing mixing ratio (mixgain). The smoothing processor 66 adds the above two multiplication results 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, and shows a specific example of the LPF in Fig. 10. In the example of Fig. 11, a pixel value to which the LPF is applied is calculated by weighting and averaging pixel values ​​in a range of 9 pixels x 9 pixels with the LPF coefficient. Note that the LPF coefficient is not limited to that shown in Fig. 11, and a range of pixels other than 9 pixels x 9 pixels may be set, or a coefficient other than the specific numerical value shown in the figure may be set.

[0053] Below, examples of two objects with different surface shapes will be described. 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, 134 and the difference value images 44, 144 are images of one evaluation area, which is an area of ​​64 pixels horizontal by 64 pixels vertical in this case.

[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 a 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 closer to black, and pixels with smaller pixel values ​​are shown 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. Shown as point cloud images 38 are 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. The difference value images 44 shown in FIG. 13 are 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 image 136a to the fourth evaluation distance image 136d, the normal point cloud image 140, the first point cloud image 142a to the fourth point cloud image 142d, and the first difference value image 144a to the fourth difference value image 144d shown in FIG.

[0056] First, the normal point cloud image 40 and the normal point cloud image 140 are compared. The normal point cloud image 40 obtained from a subject with a flat surface contains a wavy pattern. On the other hand, the normal point cloud image 140 obtained from a subject with wrinkles on its surface also contains a wavy pattern. Therefore, it is difficult to determine whether this pattern is caused by the wrinkles (uneven shape) of the subject or by speckle noise only from the normal point cloud images 40, 140 generated from distance images obtained by lighting the 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 by visual inspection 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, it can be confirmed by visual inspection that a similar pattern appears from 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 FIG. 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 ​​(r1, r4, r5) with the smallest absolute values ​​is 0.408357. Thus, the correlation value of the evaluation area obtained for an object with a flat surface is smaller than the correlation value of the evaluation area obtained for an object with a wrinkled surface. From the above, it was confirmed that the correlation value is low in the area where the speckle noise is dominant between the uneven shape of the object's surface and the speckle noise, and the correlation value is high in the area where the uneven shape of the object'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 a result of the light source control unit 16 switching between the first to fourth evaluation patterns. Furthermore, each of the plurality of evaluation distance images may be an image obtained by the moving average unit 54 calculating a moving average in the time direction of pixel values ​​of distance images for a plurality of frames.

[0060] The evaluation area extraction unit 56 extracts an evaluation area from each of the multiple evaluation distance images (S12). The gradient removal unit 60 uses the gradient component value calculated by the gradient calculation unit 58 to calculate the difference value of each pixel in the evaluation area by gradient removal and to limit the difference value to an upper limit and a 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 showing the correction process of the 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 out 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 of the evaluation area. The smoothing strength determination unit 64 reads out the index values ​​of the 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 ​​a plurality of evaluation areas, that is, if it 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 ​​a plurality of 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 processor 66 performs smoothing processing on the pixel according to the set index value (S62). If the smoothing strength determiner 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 determiner 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. In addition, a smoothing process of an intensity according to the correlation value is applied to a normal distance image obtained by illuminating the subject 20 from the first light source 12a and the second light source 12b. Thus, the smoothing process of the evaluation region with a low correlation value is made relatively strong to reduce speckle noise, and the smoothing process of the evaluation region with a high correlation value is made 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 of each pixel is calculated based on the average value of pixel values ​​of multiple pixels arranged vertically or horizontally in each of multiple evaluation regions. In addition, a correlation value is calculated 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. When the subject 20 is inclined in the depth direction, the correlation value tends to be high due to the inclination, 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 the inclination can be reduced and the correlation value indicating the influence of speckle noise can be more appropriately calculated.

[0065] According to this embodiment, when the difference value is greater than a predetermined upper limit, the correlation value is calculated using the upper limit, and when the difference value is smaller than a predetermined lower limit, the correlation value is calculated using the lower limit. This reduces the influence of abnormal values ​​such as flying pixels, and allows the correlation value indicating the influence of speckle noise to be calculated more appropriately.

[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 the two or more regions. Therefore, the strength of the smoothing processing applied to consecutive pixels can be set to gradually change, so that the corrected distance image obtained by applying the smoothing processing can be made into a more natural image.

[0067] Second embodiment The first embodiment is based on the assumption that the subject is not moving. A second embodiment will be described below as an embodiment that also supports the case where the subject is moving.

[0068] 16 is a diagram showing a schematic configuration of a distance measuring device 10A according to a second embodiment. In the second embodiment, a light source control unit 16A and a distance image correction unit 18A are different from those in the first embodiment. Hereinafter, the second embodiment will be described with a focus on the differences from the first embodiment, and commonalities will be omitted as appropriate. In the drawings, the same reference numerals are given to configurations 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 seen from the subject 20 side. 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, unlike the first embodiment. 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. That is, 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] Returning to FIG. 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 showing a schematic 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 image acquisition unit 52A, moving average unit 54A, correlation unit 62A, and 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] The image acquisition unit 52A sequentially acquires distance images corresponding to the lighting patterns according to the switching of the lighting patterns of the light source control unit 16A in a predetermined order. FIG. 19 is a diagram showing an example of the operation of the distance image correction unit 18A in units of frames. For example, the image acquisition unit 52A acquires a first evaluation distance image in the first frame and stores it in the first frame memory. The image acquisition unit 52A acquires a normal distance image in the second frame and stores it in the second frame memory. The image acquisition unit 52A acquires a second evaluation distance image in the third frame and stores it in the third frame memory. The image acquisition unit 52A acquires a normal distance image in the fourth frame and stores it in the fourth frame memory. The image acquisition unit 52A repeats the same operation as that in the first to fourth frames for the fifth to eighth frames and the ninth to twelfth frames, and so on.

[0073] Returning to Fig. 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 preset area. The detection area can be set arbitrarily depending on the range of motion of the subject to be detected, and is, for example, an area consisting of 16 pixels horizontally by 16 pixels vertically. 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 a plurality of normal distance images generated at different timings, and detects motion for each of a plurality of 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 a timing when the frame number is an even number. Then, 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 the motion flag for that detection area to 1. This is because if the absolute value of the motion correlation value between a plurality of normal distance images generated at different timings is low, it is considered that this is due to the subject moving. The motion correlation value can be calculated, for example, using the above-mentioned formula (3). Specifically, the motion correlation value can be calculated by substituting n in formula (3) for the number of pixels in the detection area, substituting the pixel value of the detection area in the second frame memory for x, and substituting the pixel value of the same pixel in the fourth frame memory for y.

[0075] The moving average unit 54A calculates a moving average of pixel values ​​of a plurality of distance images generated at different timings. The plurality of distance images used here are a plurality of distance images generated when the light source control unit 16A has the same lighting pattern. That is, all of the plurality of distance images are the first evaluation distance image, the second evaluation distance image, or the normal distance image. The moving average unit 54A also changes the degree of moving average depending on the presence or absence of motion detection by the motion detection unit 70. In detail, the moving average unit 54A does not perform moving average for pixels in an area where motion is detected among the plurality of detection areas, and performs moving average of pixel values ​​of a plurality of distance images generated at a plurality of timings for pixels in an area where motion is not detected.

[0076] The weighted average by the moving average unit 54A may be of FIR (Finite Impulse Response) type or 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). Also, the moving average unit 54A 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, the weighted average (MOVEAVE) of the pixel values ​​of the first evaluation distance image is calculated. This is expressed by the following formula (6). MOVEAVE = 1 / A × IN + (1-1 / A) × 1FB (6) Here, 1FB is the pixel value of the pixel in the first evaluation distance image of the first frame. A can be changed arbitrarily.

[0077] The moving average unit 54A stores MOVEAVE calculated by equation (6) in the first moving average memory. Then, at the timing of the 9th 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 moving average unit 54A calculates the weighted average of pixel values ​​of the first evaluation distance image, if the motion flag of the detection area including that pixel is set to 1, coefficient (A) of equation (6) is set to 1. For example, when 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 coefficient (A) of equation (6) to 1, the calculated weighted average becomes equal to the pixel value of the first evaluation distance image acquired in the fifth frame. In other words, the circulation of the weighted average is reset.

[0079] Similarly, moving average unit 54A calculates a weighted average of pixel values ​​of pixels in the second evaluation distance image when the second evaluation distance image is acquired, such as the third frame, seventh frame, eleventh frame, etc., and stores the weighted average in the second moving average memory. Similarly, moving average unit 54A calculates a weighted average of pixel values ​​of pixels in the normal distance image when the normal distance image is acquired, such as the second frame, fourth frame, sixth frame, etc., and stores the weighted average in the third moving average memory. Similarly, when the motion flag is set to 1, coefficient (A) in equation (6) is set to 1.

[0080] As described above, the moving average unit 54A performs a weighted average of the pixel values ​​of multiple distance images generated at multiple times, thereby reducing random noise in the distance images. Furthermore, since the moving average unit 54A does not perform a weighted average of the pixel values ​​of pixels in an area where motion is detected, it is possible to eliminate the effect of adding together distance images in which the state of the subject is different before and after motion is detected.

[0081] The evaluation area extraction unit 56, the gradient calculation unit 58, and the 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 the pixels of 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 of the first evaluation distance image from the first moving average memory and calculates the difference value. Also, the gradient removal unit 60 reads the pixel value of each pixel of 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 region. 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 sufficient to calculate only the correlation value between the first evaluation distance image and the second evaluation distance image.

[0083] For pixels in an area where motion is detected among the multiple detection areas, the correlation unit 62A calculates a correlation value from pixel values ​​of a distance image generated at a timing corresponding to the detection of the motion. Also, for pixels in an area where motion is not detected among the multiple detection areas, the correlation unit 62A calculates a correlation value from a weighted average of pixel values ​​of multiple distance images generated at multiple timings.

[0084] In the example shown in FIG. 19, the correlation unit 62A reads out the pixel value of each pixel of the first evaluation distance image from the first moving average memory, and reads out the pixel value of each pixel of the second evaluation distance image from the second moving average memory, and calculates the 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 the gradient component value from the pixel value of each pixel of 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 62A 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 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] The smoothing processor 66A, like the smoothing processor 66 of the first embodiment, applies smoothing processing of an intensity according to the correlation value to each evaluation region to the normal distance image generated when the normal pattern is irradiated, to generate a corrected distance image. The normal distance image to which the smoothing processor 66A applies the 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 a detection region 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 a detection region in which motion is detected. For example, the smoothing processor 66A sets the smoothing mixture ratio (mixgain) in FIG. 10 to 1 for a detection region in which the motion flag is set to 1. In other words, the smoothing processing may not be performed 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. When the corrected distance image is generated at any time at the timing of an even-numbered frame, distance measuring device 10A may output the corrected distance image each time. This makes it possible to obtain a corrected distance image with reduced speckle noise in real time.

[0088] According to this embodiment, the smoothing process is applied to a detection area in which no motion is detected among a plurality of detection areas set in a normal distance image, and therefore the smoothing process can be selectively applied to an area in which the speckle noise on the surface of the subject is likely to be noticeable due to the lack of motion of the subject.

[0089] According to this embodiment, for pixels in an area where no motion is detected among the multiple detection areas, a correlation value is calculated from a weighted average of pixel values ​​of multiple distance images generated at multiple timings. Therefore, in an area where the subject is not moving and speckle noise is easily noticeable, random noise can be removed by weighted average processing, and a correlation value indicating the 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. [Explanation of symbols]

[0091] 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... tilt calculation unit, 62, 62A... correlation unit, 66, 64A... smoothing processing unit, 70... motion detection unit.

Claims

1. 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 in which the first light source and the second light source 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; a correlation unit that calculates a correlation value between a first evaluation distance image generated when the first evaluation pattern is projected and a second evaluation distance image generated when the second evaluation pattern is projected, for each of a plurality of evaluation regions set in the distance image; a smoothing processing unit that applies a smoothing process of a strength corresponding to the correlation value to a normal distance image generated when the normal pattern is irradiated, to generate a corrected distance image; A distance measuring device comprising:

2. a gradient calculation unit that calculates a gradient component value for the first evaluation distance image and the second evaluation distance image based on an average value of pixel values ​​of a plurality of pixels aligned vertically or horizontally in each of the plurality of evaluation areas, the correlation unit calculates the correlation value using a difference value obtained by subtracting the gradient component value from a pixel value of each pixel of the first evaluation distance image and the second evaluation distance image.

2. A distance measuring device according to claim 1.

3. 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.

3. A distance measuring device according to claim 2.

4. The plurality of evaluation regions are set so as to partially overlap each other, the smoothing processing unit applies the smoothing process to a pixel where two or more of the evaluation regions overlap, the smoothing process having an intensity based on the correlation values ​​of the two or more regions.

2. A distance measuring device according to claim 1.

5. a motion detection unit that compares a plurality of normal distance images generated at different times and detects motion for each of a plurality of detection areas set in the normal distance images; the smoothing processing unit applies the smoothing processing to a detection area in which no movement is detected to generate the corrected distance image.

2. A distance measuring device according to claim 1.

6. The correlation unit is calculating the correlation value from pixel values ​​of a first evaluation distance image and a second evaluation distance image generated at a timing corresponding to the detection of the motion, for pixels in an area in which motion is detected among the plurality of detection areas; for pixels in an area where no movement is detected among the plurality of detection areas, the correlation value is calculated from a weighted average of pixel values ​​of a plurality of first evaluation distance images generated at a plurality of timings and a weighted average of pixel values ​​of a plurality of second evaluation distance images generated at a plurality of timings; 6. A distance measuring device according to claim 5.

7. a step of switching between a normal pattern in which a first light source for irradiating a subject with a first illumination light and a second light source for irradiating 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 a first evaluation distance image generated when the first evaluation pattern is projected and a second evaluation distance image generated when the second evaluation pattern is projected for each of a plurality of evaluation regions set in the distance image; generating a corrected distance image by applying a smoothing process having a strength corresponding to the correlation value to a normal distance image generated when the normal pattern is irradiated; A distance measuring method comprising:

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