Image processing method, point cloud generation method, and image processing apparatus
By judging and filtering noise points in the stripe sequence number map, the noise problem in phase-shifted Gray code three-dimensional reconstruction is solved, and the signal-to-noise ratio and three-dimensional reconstruction accuracy of point cloud data are improved.
Patent Information
- Application Number
- PCT/CN2023/132961
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-17
- Filing Date
- 2023-11-21
- Publication Date
- 2024-10-24
AI Technical Summary
In the three-dimensional reconstruction technology based on phase-shifted Gray codes, the noise introduced by the solution error will lead to a significant increase in the noise in the point cloud data, reduce the three-dimensional reconstruction accuracy, and cannot meet the needs of practical applications.
By extracting the number of matching pixels on both sides of the pixels in the stripe number map, dividing the pixels to be detected in the continuous area, and judging the noise points based on the number of matching pixels, performing noise filtering to ensure the accuracy of the stripe number map, thereby Improve the signal-to-noise ratio of point cloud data.
It effectively suppresses the noise in the stripe sequence number map, reduces the noise in the point cloud data, and improves the effect and accuracy of the three-dimensional reconstruction.
Smart Images

Figure CN2023132961_24102024_PF_FP_ABST
Abstract
Description
Image processing method, point cloud generation method and image processing device Technical Field
[0001] The present invention relates to technical fields such as noise filtering of Gray code images and point cloud generation based on phase-shift Gray code. In particular, the present invention relates to an image processing method, a point cloud generation method based on phase-shift Gray code, a device, an electronic device and a readable storage medium. Background Art
[0002] In three-dimensional reconstruction based on phase-shift Gray code, several phase-shift Gray code patterns are projected onto the object to be measured. The phase-shift Gray code patterns that are deformed due to modulation on the surface of the object to be measured are photographed and then solved to obtain the main value phase image and fringe number image. The absolute phase image is obtained based on the main value phase image and fringe number image. Finally, the depth of each point on the object to be measured is determined based on the absolute phase image and the pre-calibrated system parameters, thereby obtaining point cloud data that can characterize the three-dimensional morphological characteristics of the object to be measured.
[0003] Since Gray code can arbitrarily set the coding length and has high stability, the three-dimensional reconstruction technology based on phase-shift Gray code has been widely used in the three-dimensional reconstruction of various scenes and multiple objects.
[0004] However, if an error occurs in the calculation of the phase-shifted Gray code pattern, noise will be introduced into the fringe number map. The noise in the fringe number map will be substituted into the point cloud data representing the three-dimensional morphological features of the object being measured, making the point cloud noise obvious in areas such as the junction of light and dark in the scene and the boundary of the object being measured, resulting in a decrease in the accuracy of the three-dimensional reconstruction of the object being measured, which cannot meet the needs of practical applications.
[0005] Embodiments of the present invention provide an image processing method, a point cloud generation method and device based on phase-shift Gray code, an electronic device, and a readable storage medium.
[0006] According to one aspect of the present invention, an image processing method is provided, comprising: obtaining a fringe number map based on a plurality of Gray code images obtained from a surface of a measured object, the fringe number map comprising a plurality of pixel stripes arranged along a first direction, each pixel stripe corresponding to a unique fringe number, the fringe numbers increasing in increments along the first direction, and each stripe extending along a second direction perpendicular to the first direction; for pixels in the fringe number map having the same second direction coordinates, dividing the fringe number map into continuous regions along the first direction, so as to divide the fringe number map into one or more continuous regions; and dividing the fringe number map into continuous regions within the continuous regions. All pixel points are used as pixel points to be inspected, and the number of matching pixel points on both sides of each pixel point to be inspected is obtained based on the first direction coordinates of each pixel point to be inspected and the stripe number corresponding to each pixel point to be inspected, wherein the sequential relationship between the stripe number corresponding to the pixel point to be inspected and the stripe number corresponding to the matching pixel points on both sides matches the positional relationship between the first direction coordinate of the pixel point to be inspected and the first direction coordinates of the matching pixel points on both sides; based on the number of matching pixel points on both sides of all pixel points to be inspected in the continuous area, it is judged whether each pixel point to be inspected is a noise point; and the stripe number map is noise-filtered based on all noise points in the obtained stripe number map.
[0007] According to an image processing method of at least one embodiment of the present invention, the number of matching pixel points on both sides of each pixel point to be inspected is obtained, including: judging whether the first direction coordinate of the pixel point to be inspected on the first side of the current pixel point to be inspected is smaller than the first direction coordinate of the current pixel point to be inspected, judging whether the stripe number corresponding to the pixel point to be inspected on the first side of the current pixel point to be inspected is smaller than or equal to the stripe number corresponding to the current pixel point to be inspected, and if both are yes, judging the pixel point to be inspected on the first side as a matching pixel point; judging whether the first direction coordinate of the pixel point to be inspected on the second side of the current pixel point to be inspected is greater than the first direction coordinate of the current pixel point to be inspected, judging whether the stripe number corresponding to the pixel point to be inspected on the second side of the current pixel point to be inspected is greater than or equal to the stripe number corresponding to the current pixel point to be inspected, and if both are yes, judging the pixel point to be inspected on the second side as a matching pixel point; counting the matching pixel points on the first side and the matching pixel points on the second side of the current pixel point to be inspected to obtain the number of matching pixel points on both sides.
[0008] According to an image processing method of at least one embodiment of the present invention, whether each pixel point to be inspected is a noise point is judged based on the number of matching pixel points on both sides of all pixel points to be inspected in the continuous area, including: performing a comparison operation on the number of matching pixel points on both sides of each pixel point to be inspected in the continuous area to obtain a comparison result; and judging whether each pixel point to be inspected is a noise point based on the comparison result.
[0009] According to the image processing method of at least one embodiment of the present invention, the comparison operation includes: comparing the number of matching pixels on both sides of each pixel in a one-dimensional connected domain based on the pixel stripe.
[0010] According to the image processing method of at least one embodiment of the present invention, whether each pixel point to be inspected is a noise point is judged based on the number of matching pixel points on both sides of all pixel points to be inspected in the continuous area, including: for pixel points with the same second direction coordinates in the stripe serial number map, obtaining a one-dimensional connected domain of each pixel stripe based on the pixel value of the pixel point; judging whether the one-dimensional connected domain of each pixel stripe is unique; if there are more than two one-dimensional connected domains of a pixel stripe, comparing the sum of the number of matching pixel points on both sides of all pixel points in each one-dimensional connected domain, retaining the one-dimensional connected domain with the largest sum of the number of matching pixel points on both sides of all pixel points, and judging the pixel points in the other one-dimensional connected domains as noise points.
[0011] According to the image processing method of at least one embodiment of the present invention, if the number of one-dimensional connected domains in which the sum of the number of matching pixels on both sides of all pixels is the largest is two or more, the mean values of the number of matching pixels on both sides of all pixels in the two or more one-dimensional connected domains are compared, and the one-dimensional connected domain in which the mean value of the number of matching pixels on both sides of all pixels is retained, and the pixels in the other one-dimensional connected domains are determined to be noise points.
[0012] According to the image processing method of at least one embodiment of the present invention, the comparison operation includes: comparing the number of matching pixels on both sides of each pixel to be detected with a preset threshold.
[0013] According to the image processing method of at least one embodiment of the present invention, whether each pixel point to be inspected is a noise point is determined based on the number of matching pixel points on both sides of all pixel points to be inspected in the continuous area, including: for pixel points with the same second direction coordinates in the fringe number map, comparing the number of matching pixel points on both sides of each pixel point with a preset threshold; and determining the pixel points whose number of matching pixel points on both sides is less than or equal to the preset threshold as noise points.
[0014] According to another aspect of the present invention, a point cloud generation method based on a phase-shift Gray code is provided, comprising: obtaining a phase-shift coding map and a Gray code map of the surface of a measured object; decoding the phase-shift coding map to obtain a principal value phase map, decoding and noise filtering the Gray code map to obtain a noise-filtered fringe number map; obtaining an absolute phase map based on the principal value phase map and the noise-filtered fringe number map; and obtaining point cloud data representing surface morphological features of the measured object based on the absolute phase map; wherein decoding and noise filtering the Gray code map to obtain the noise-filtered fringe number map is implemented based on the image processing method of any one of the embodiments of the present invention.
[0015] According to another aspect of the present invention, an image processing device is provided, comprising: a fringe number map acquisition module, the fringe number map acquisition module obtaining a fringe number map based on a plurality of Gray code maps acquired from a surface of a measured object, the fringe number map comprising a plurality of pixel point stripes arranged along a first direction, each pixel point stripe corresponding to a unique fringe number, the fringe number increasing along the first direction, and each stripe extending along a second direction perpendicular to the first direction; a fringe number map division module, the fringe number map division module performing continuous region division of the fringe number map along the first direction for pixel points having the same second direction coordinates in the fringe number map, so as to divide the fringe number map into one or more continuous regions; a matching pixel point acquisition module, the matching pixel point acquisition module The pixel point acquisition module uses all the pixel points in the continuous area as the pixel points to be checked, and obtains the number of matching pixels on both sides of each pixel point to be checked based on the first direction coordinates of each pixel point to be checked and the stripe serial number corresponding to each pixel point to be checked, wherein the order relationship between the stripe serial number corresponding to the pixel point to be checked and the stripe serial number corresponding to the matching pixel points on both sides matches the positional relationship between the first direction coordinate of the pixel point to be checked and the first direction coordinate of the matching pixel points on both sides; a noise point determination module, the noise point determination module determines whether each pixel point to be checked is a noise point based on the number of matching pixels on both sides of all the pixel points to be checked in the continuous area; a noise filtering module, the noise filtering module performs noise filtering on the stripe serial number map based on all noise points in the acquired stripe serial number map.
[0016] According to another aspect of the present invention, a point cloud generation device based on phase-shift Gray code is provided, comprising: an image acquisition module, which acquires a phase-shift coding map and a Gray code map of the surface of the object to be measured; a first image processing module, which decodes the phase-shift coding map to obtain a principal value phase map; a second image processing module, which decodes and filters the Gray code map to obtain a fringe number map after noise filtering; an absolute phase map acquisition module, which acquires an absolute phase map based on the principal value phase map and the fringe number map after noise filtering; and a point cloud data acquisition module, which acquires point cloud data representing the surface morphological features of the object to be measured based on the absolute phase map; wherein the second image processing module is an image processing device according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, an electronic device is provided, comprising: a memory storing execution instructions; a processor executing the execution instructions stored in the memory, so that the processor executes the image processing method of any embodiment of the present invention and / or executes the point cloud generation method of any embodiment of the present invention.
[0018] According to another aspect of the present invention, a readable storage medium is provided, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the image processing method of any embodiment of the present invention and / or the point cloud generation method of any embodiment of the present invention.
[0019] An embodiment of the present invention obtains the number of pixels in the fringe number map that satisfy the rule of increasing fringe numbers along the fringe direction by counting each pixel in the fringe number map and comparing it with other pixel points in the same row, thereby determining the noise in the fringe number map, thereby realizing filtering of the fringe number map, and can effectively suppress the noise in the fringe number map, reduce the noise in the point cloud data generated based on the phase-shifted Gray code, improve the signal-to-noise ratio of the point cloud data generated based on the phase-shifted Gray code, and enhance the effect of three-dimensional reconstruction of the object under test. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings illustrate exemplary embodiments of the present invention and together with the description serve to explain the principles of the present invention. These drawings are included to provide a further understanding of the present invention and are incorporated in and constitute a part of this specification.
[0021] FIG1 is a schematic flow chart of an image processing method according to an embodiment of the present invention.
[0022] FIG. 2 is an example diagram of an ideal stripe number map according to an embodiment of the present invention.
[0023] FIG. 3 shows a trend line of the column direction coordinates of a row of image data in the ideal fringe number diagram shown in FIG. 2 as the fringe number changes.
[0024] FIG4 is an example diagram of a stripe sequence number diagram in an actual test scenario according to an embodiment of the present invention.
[0025] FIG. 5 shows a trend line of the column direction coordinates of a row of image data in the fringe number diagram shown in FIG. 4 as the fringe number changes.
[0026] FIG6 shows a curve showing a change in the column direction coordinates of each pixel point in a row of image data as a function of the stripe number and a curve showing a change in the score of each pixel point as a function of the stripe number in the stripe number diagram shown in FIG4 .
[0027] FIG7 is an example diagram of a stripe sequence number map after filtering in an actual test scenario according to an embodiment of the present invention.
[0028] FIG8 is a flow chart of a point cloud generation method based on phase-shifted Gray code according to an embodiment of the present invention.
[0029] FIG9 is a block diagram showing the structure of an image processing apparatus implemented in hardware using a processing system according to an embodiment of the present invention.
[0030] FIG10 is a block diagram showing the structure of an image processing apparatus implemented in hardware using a processing system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It will be understood that the specific embodiments described herein are intended only to explain the relevant content and are not intended to limit the present invention. It should also be noted that, for ease of description, only portions relevant to the present invention are shown in the accompanying drawings.
[0032] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0033] The image processing method, point cloud generation method, device, etc. of the present invention are described in detail below with reference to FIG. 1 to FIG. 10 .
[0034] Fig. 1 shows a schematic flow chart of an image processing method according to some embodiments of the present invention. As shown in Fig. 1 , the image processing method according to the embodiment of the present invention may include the following steps S102 to S110.
[0035] In step S102, a fringe number map is obtained based on multiple Gray code images obtained from the surface of the object being measured. The fringe number map includes multiple pixel stripes arranged along a first direction, each pixel stripe corresponding to a unique stripe number, and the stripe numbers increase along the first direction. Each stripe extends along a second direction perpendicular to the first direction.
[0036] The fringe number map of the present invention is generated by analyzing multiple Gray code images projected onto the surface of the object being measured, modulated by the surface, and then reflected. In other words, the fringe number map described in the present invention is obtained by decoding the Gray code image reflected from the surface of the object being measured (e.g., the surface of the workpiece being inspected). The embodiments of the present invention do not limit the specific algorithm and implementation process for Gray code decoding. Those skilled in the art will appreciate that any algorithm capable of decoding Gray code images to obtain a fringe number map is applicable to the embodiments of the present invention.
[0037] In some embodiments of the present invention, the fringe number map includes multiple stripes arranged along the column direction of the map. Each stripe may include one or more columns of pixels, and each stripe is associated with a unique fringe number. The fringe number of each stripe is obtained by solving the Gray code pattern reflected by the surface of the object being measured.
[0038] Figure 2 shows an example of an ideal, noise-free fringe number map. As shown in Figure 2, in an ideal, noise-free fringe number map, also known as a correct fringe number map, each fringe has a unique fringe number, and the fringe numbers increase along the fringe distribution direction. The example in Figure 2 exemplarily illustrates a portion of the fringe numbers corresponding to those in Figure 3.
[0039] As shown in Figure 2, in the noise-free ideal fringe number map, that is, the correct fringe number map, each pixel in the fringe number map corresponds to a fringe number, and the fringe number is the unique fringe number of the fringe to which the pixel belongs, and each fringe number corresponds to a unique connected domain in the fringe number map.
[0040] In the example of Figure 2, each stripe contains multiple columns of pixels, and the stripes in the stripe number diagram are arranged along the image column direction (the horizontal direction in the figure is the image column direction, that is, the first direction), that is, the stripe arrangement direction is consistent with the image column direction of the stripe number diagram, and the increasing direction of the stripe numbers of each stripe in the stripe number diagram is consistent with the increasing direction of the column number of each pixel in the stripe number diagram.
[0041] FIG3 is a schematic diagram showing a trend line of column-direction coordinates of a row of image data in the ideal fringe number diagram shown in FIG2 as the fringe number changes. The ordinate in FIG3 is the value of the fringe number corresponding to the pixel point, and the abscissa in FIG3 represents the column number of the pixel point in the fringe number diagram, i.e., the column-direction coordinate (the abscissa in the diagram).
[0042] As can be seen from Figure 3, when the stripe arrangement direction is consistent with the image column direction of the stripe number map, in the ideal noise-free stripe number map, the increasing direction of the stripe numbers corresponding to each pixel in a row of image data is consistent with the increasing direction of the column coordinates (i.e., horizontal coordinates) of the pixels in that row. That is, in the example of Figure 2, the column numbers, i.e., the column coordinates, of the pixels increase along the stripe arrangement direction. This can be understood as follows: for each pixel in the stripe number map, the stripe numbers corresponding to the pixels in its row whose column numbers (i.e., column coordinates) are greater than the pixel's column number (i.e., column coordinates) should be greater than or equal to the pixel's corresponding stripe number, and the stripe numbers corresponding to the pixels in its row whose column numbers (i.e., column coordinates) are less than the pixel's column number should be less than or equal to the pixel's corresponding stripe number.
[0043] It should be noted that FIG2 is merely an example. In other implementations, for example, when the stripes are arranged along the row direction of the stripe number map (i.e., the second direction shown in FIG2 ), that is, when the stripe arrangement direction of the stripe number map is consistent with the image row direction of the stripe number map (the second direction shown in FIG2 ), the increasing direction of the stripe number of each stripe in the stripe number map is consistent with the increasing direction of the row number, i.e., the row coordinate (ordinate), corresponding to the pixel point in the stripe number map. The increasing direction of the row number, i.e., the row coordinate, of each pixel point in each column of the stripe number map is consistent with the increasing direction of the corresponding stripe number. In this case, the row number, i.e., the row coordinate, of the pixel point increases along the stripe arrangement direction. This can be understood as follows: for each pixel point in the stripe number map, the stripe number corresponding to other pixels in the column whose row number (row coordinate) is greater than the pixel point's row number should be greater than or equal to the pixel point's corresponding stripe number, and the stripe number corresponding to other pixels in the column whose row number (row coordinate) is less than the pixel point's row number should be less than or equal to the pixel point's corresponding stripe number.
[0044] Figure 4 shows an example of a fringe number map from an actual test scenario. Figure 5 shows a schematic diagram of a trend line showing how the column coordinates of a row of image data in the fringe number map shown in Figure 4 change as the fringe number changes. The ordinate in Figure 5 represents the fringe number corresponding to the pixel, and the abscissa represents the column coordinate of the pixel in the fringe number map.
[0045] As can be seen from Figures 4 and 5, in the actual test scenario, the stripe number map does not satisfy the above-mentioned rule of increasing stripe numbers along the stripe arrangement direction due to the presence of a lot of noise. In Figure 4, the image area in the black box has more noise. As can be seen from Figure 5, the stripe numbers corresponding to the noise points in the black box are arranged irregularly and randomly.
[0046] Comparing Figures 2 and 4, and Figures 3 and 5, we can see that when there is no noise in the fringe number map, each pixel in the fringe number map must satisfy the rule that the pixel's column number (column-direction coordinate) increases along the direction of the fringe arrangement. That is, for any pixel in the fringe number map, the fringe number corresponding to it should be greater than or equal to the fringe numbers corresponding to all the pixels preceding it in the row, and less than or equal to the fringe numbers corresponding to all the pixels following it in the row. When the fringe in the fringe number map is arranged along the image column direction, all the pixels preceding a pixel include all pixels with column numbers (column-direction coordinates) less than that pixel's column number, and all the pixels following a pixel include all pixels with column numbers greater than that pixel's column number.
[0047] When the stripes in the stripe number map are arranged along the row direction of the image, all the pixels in front of a certain pixel in the column where the pixel is located include all the pixels whose row numbers (row direction coordinates) are smaller than the row number of the pixel, and all the pixels behind a certain pixel in the column where the pixel is located include all the pixels whose row numbers (row direction coordinates) are larger than the row number of the pixel.
[0048] In step S104, for pixels in the fringe number map having the same second-direction coordinates, the fringe number map is divided into continuous regions along the first direction to divide the fringe number map into one or more continuous regions. When divided into one continuous region, global statistics are performed, and when divided into two or more continuous regions, local statistics are performed.
[0049] In step S106, all pixel points in the continuous area are taken as pixel points to be inspected, and the number of matching pixel points on both sides of each pixel point to be inspected is obtained based on the first direction coordinates of each pixel point to be inspected and the stripe serial number corresponding to each pixel point to be inspected, wherein the sequential relationship between the stripe serial number corresponding to the pixel point to be inspected and the stripe serial number corresponding to the matching pixel points on both sides matches the positional relationship between the first direction coordinate of the pixel point to be inspected and the first direction coordinate of the matching pixel points on both sides.
[0050] Preferably, obtaining the number of matching pixels on both sides of each pixel to be detected includes the following contents.
[0051] Determine whether the first direction coordinate of the pixel point to be inspected on the first side of the current pixel point to be inspected (for example, the left side in the first direction shown in Figure 2) is smaller than the first direction coordinate of the current pixel point to be inspected, and determine whether the stripe serial number value corresponding to the pixel point to be inspected on the first side of the current pixel point to be inspected is less than or equal to the stripe serial number value corresponding to the current pixel point to be inspected. If both are yes, the pixel point to be inspected on the first side is determined to be a matching pixel point.
[0052] Determine whether the first direction coordinate of the pixel point to be inspected on the second side of the current pixel point to be inspected (for example, the right side in the first direction shown in Figure 2) is greater than the first direction coordinate of the current pixel point to be inspected, and determine whether the stripe serial number value corresponding to the pixel point to be inspected on the second side of the current pixel point to be inspected is greater than or equal to the stripe serial number value corresponding to the current pixel point to be inspected. If both are yes, the pixel point to be inspected on the second side is determined to be a matching pixel point.
[0053] The matching pixels on the first side and the matching pixels on the second side of the current pixel to be detected are counted to obtain the number of matching pixels on both sides.
[0054] In some embodiments of the present invention, taking the arrangement of stripes along the column direction of the stripe number map as an example, step S106 may include: for any pixel point in the stripe number map, such as the first pixel point, traversing the selected columns (such as all columns) of its row, counting the number of other pixel points in the selected columns of its row that satisfy "the column direction coordinates of the pixel points increase along the stripe arrangement direction", and using the counted number of other pixel points as the score of the first pixel point: the stripe number corresponding to the other pixel points whose column number (column direction coordinate) is greater than the column number (column direction coordinate) of the first pixel point is greater than or equal to the stripe number corresponding to the first pixel point, and the stripe number corresponding to the other pixel points whose column number is less than the column number of the first pixel point is less than or equal to the stripe number corresponding to the first pixel point.
[0055] In some embodiments of the present invention, taking the arrangement of stripes along the row direction of the stripe number map as an example, step S106 may include: for any pixel point in the stripe number map, such as the second pixel point, traversing the selected rows (such as all rows) of its column, counting the number of other pixel points in the selected rows of its column that satisfy "the row direction coordinates of the pixel points increase along the stripe arrangement direction", and using the counted number of other pixel points as the score of the second pixel point: the stripe number corresponding to the other pixel points whose row number (row direction coordinate) is greater than the row number (row direction coordinate) of the first pixel point is greater than or equal to the stripe number corresponding to the second pixel point, and the stripe number corresponding to the other pixel points whose row number is less than the row number of the second pixel point is less than or equal to the stripe number corresponding to the second pixel point.
[0056] In an embodiment of the present invention, in step S106, the number of other pixel points in the row or column where each pixel point is located that meets the requirement that "the column coordinates or row coordinates of the pixel point increase along the stripe arrangement direction (i.e., the stripe number)" can be determined by global statistics, local statistics, etc.
[0057] In some embodiments of the present invention, the global statistics described above is to set the selected columns to all columns in the stripe number map, and to set the selected rows to all rows in the stripe number map. The selected columns described above can be all columns in the stripe number map. For example, taking the arrangement of stripes along the column direction of the stripe number map as an example, for pixel i in the 3rd row and 10th column of the stripe number map, all other pixels in the 3rd row of the stripe number map except pixel i are traversed, and each of these other pixels is verified to determine whether they satisfy the following conditions: "the stripe number corresponding to other pixels with column numbers (column coordinates) less than pixel i is less than or equal to the stripe number corresponding to pixel i" and "the stripe number corresponding to other pixels with column numbers (column coordinates) greater than pixel i is greater than or equal to the stripe number corresponding to pixel i". For each other pixel in the row where pixel i is located (i.e., row 3) that satisfies the above rule, the score of pixel i is increased by 1. This process continues until all other pixels in all columns of the 3rd row of the stripe number map except pixel i are traversed. The resulting score of pixel i is the number of other pixels in the selected column of the row where pixel i is located (i.e., all columns of the stripe number map) that satisfy the condition "the pixel's column coordinates increase along the stripe arrangement direction". Here, the initial value of the score of pixel i can be set to 0 or another default value.
[0058] Local statistics involves pre-dividing the image data of the fringe number map into multiple segments (i.e., multiple continuous regions). Each segment of image data can contain N consecutive columns of pixels or N consecutive rows of pixels. The pixel scores are determined on a per-segment basis, i.e., the columns or rows within the image data segment to which the pixel belongs are used as the selected columns or rows for determining the pixel scores. Specifically, the selected columns described above can be the N consecutive columns of the fringe number map containing the current pixel whose score is to be determined, where N is a preset value, which can be an integer greater than 1.
[0059] When using a local statistical method, the image data of the fringe number image can be segmented according to the resolution of the fringe number image. The present invention preferably employs an equal segmentation approach, where each segment of image data contains equal columns or rows of pixels. This reduces computational complexity and facilitates application in various practical test scenarios and for various test objects. For example, for a fringe number image with a resolution of 2048 x 1536, the image data can be divided into eight equal segments, each containing 256 columns of pixels.
[0060] For example, taking the arrangement of stripes along the column direction of the image in the stripe number map as an example, for pixel i in the 3rd row and 10th column of the stripe number map, assuming that the image data segment to which pixel i belongs includes columns 9 to 17, traverse all other pixels in the 3rd row and 9th to 17th columns of the stripe number map, and verify one by one whether these other pixels satisfy the rule that "the stripe numbers corresponding to other pixels with column numbers smaller than pixel i are smaller than or equal to the stripe numbers corresponding to pixel i" and "the stripe numbers corresponding to other pixels with column numbers larger than pixel i are larger than or equal to the stripe numbers corresponding to pixel i". For each other pixel in the 3rd row and 9th to 17th columns of the stripe number map that satisfies the above rule, the score of pixel i is increased by 1. This process continues until all other pixels in the 3rd row and 9th to 17th columns of the stripe number map are traversed. The score of pixel i obtained in this way is the number of other pixels in the selected column of the row where pixel i is located (i.e., columns 9 to 17) that satisfy the rule that "the column coordinates of the pixels increase along the stripe arrangement direction".
[0061] Experimental verification has found that the pixel score determined by local statistics has a higher correlation with whether the pixel is noise. That is, the pixel score determined by local statistics can more accurately indicate whether the pixel is noise or the degree to which the pixel is noise, while also reducing computational complexity. The effect is particularly obvious for images with higher resolution.
[0062] FIG6 shows a curve showing a change in the column direction coordinates of each pixel point in a row of image data as a function of the stripe number and a curve showing a change in the score of each pixel point as a function of the stripe number in the stripe number diagram shown in FIG4 .
[0063] As can be seen from Figure 6 and Figure 4, the scores of pixels that are not noise are higher, while the scores of pixels that are noise are lower. That is, the score of a pixel can represent the degree to which the pixel belongs to noise.
[0064] The present invention determines whether a pixel is a noise point through step S108. In step S108, whether each pixel to be detected is a noise point is determined based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area.
[0065] Then in step S110 , noise is filtered out of the fringe number image based on all noise points in the acquired fringe number image.
[0066] In some embodiments of the present invention, step S108 may include the following: step 1082, comparing the number of matching pixels on both sides of each pixel to be detected in the continuous region to obtain a comparison result. step S1084, determining whether each pixel to be detected is a noise point based on the comparison result.
[0067] In some embodiments of the present invention, the comparison operation described above includes: comparing the number of matching pixels on both sides of each pixel in a one-dimensional connected domain based on the pixel stripe.
[0068] In some further embodiments of the present invention, the comparison operation described above includes: comparing the number of matching pixels on both sides of each pixel to be detected with a preset threshold.
[0069] In some embodiments of the present invention, in step S108, whether each pixel point to be inspected is a noise point is determined based on the number of matching pixels on both sides of all pixel points to be inspected in a continuous area, including: for pixel points with the same second direction coordinates in the stripe number map, obtaining a one-dimensional connected domain of each pixel stripe based on the pixel value of the pixel point; determining whether the one-dimensional connected domain of each pixel stripe is unique; and if there are more than two one-dimensional connected domains of a pixel stripe, comparing the sum of the number of matching pixels on both sides of all pixel points in each one-dimensional connected domain, retaining the one-dimensional connected domain with the largest sum of the number of matching pixels on both sides of all pixel points, and determining the pixel points in the other one-dimensional connected domains as noise points.
[0070] Furthermore, if there are more than two one-dimensional connected domains with the largest sum of the number of matching pixels on both sides of all pixels, the average numbers of matching pixels on both sides of all pixels in the two or more one-dimensional connected domains are compared, and the one-dimensional connected domain with the largest average number of matching pixels on both sides of all pixels is retained, and the pixels in the other one-dimensional connected domains are determined as noise points.
[0071] In some further embodiments of the present invention, in step S108, whether each pixel point to be inspected is a noise point is determined based on the number of matching pixel points on both sides of all pixel points to be inspected in a continuous area, including: for pixel points with the same second direction coordinates in the fringe number map, comparing the number of matching pixel points on both sides of each pixel point with a preset threshold; and determining pixel points whose number of matching pixel points on both sides is less than or equal to the preset threshold as noise points.
[0072] Specifically, in some embodiments of the present invention, the noise in the fringe number map is determined according to the score of each pixel in the fringe number map, preferably through connected component analysis or histogram statistics.
[0073] In a preferred embodiment of the present invention, in step S108, filtering out noise in the fringe number map based on the scores of each pixel point in the fringe number map includes: obtaining a connected domain of pixels in each row of the fringe number map through connected domain analysis; for two or more connected domains of pixels with the same fringe number, selecting a true connected domain based on the scores of the pixels in each connected domain and determining the other connected domains as noise point connected domains of the fringe number map.
[0074] In some embodiments of the present invention, the selected true connected domain described above is the connected domain with the highest mean pixel score among two or more connected domains with the same stripe number. Those skilled in the art, inspired by the technical solutions of the present invention, may adjust the method for determining true connected domains and noise point connected domains, and all such adjustments fall within the scope of protection of the present invention.
[0075] For the ideal stripe number diagram shown in Figure 2 where the stripes are arranged along the column direction of the image, the stripe number sequence of a row of image data can be expressed as "1122334455667788" according to the arrangement of pixel column numbers (column direction coordinates) from low to high. "11", "22", "33", "44", "55", "66", "77", and "88" are the one-dimensional pixel point connected domains corresponding to each stripe number, and the numbers 1 to 8 represent the values of the stripe number. It can be seen that each stripe number corresponds to a unique pixel point connected domain, that is, a true connected domain.
[0076] In the stripe number map of the actual test scene, for example, the stripes are arranged along the image column direction and arranged from low to high according to the pixel column number (column direction coordinate). The stripe number sequence corresponding to a row of image data can be expressed as "11122331144466". Two connected domains with the same stripe number appear in this row of image data, namely, "111" and "11". It can be determined that there is noise in the stripe number map, and the noise is distributed in one of the two connected domains.
[0077] When there are two or more connected domains with the same stripe number in the stripe number map, one of the connected domains is selected and retained as the true connected domain according to the fraction of pixels in the two or more connected domains with the same stripe number, and the other connected domains are determined as noise point connected domains.
[0078] For example, if the fringe number sequence corresponding to a row of image data is "11122331144466," and the mean score of the three pixels in the connected domain "111" is 14, while the mean score of the two pixels in the connected domain "11" is 8, then the connected domain "111" is retained as a true connected domain, and the connected domain "11" is determined as a noise point connected domain. Therefore, by performing connected domain analysis on a single row of data in the fringe number map, the noise in each row can be determined, achieving fine filtering of the fringe number map.
[0079] In yet other embodiments of the present invention, in step S108, a histogram of the scores of pixels in each row of the fringe number map can be calculated. Based on the histogram results, pixels in each row of the fringe number map with scores below a preset threshold are identified. Pixels in each row of the fringe number map with scores below the preset threshold are considered noise points in the fringe number map. For example, in a fringe number map with a resolution of 2048*1536, a global statistical approach is used to determine the scores of each pixel in each row of a given scene. After performing a histogram of the scores for each pixel, cluster analysis is performed. Pixels corresponding to a category with a score below a certain threshold can be considered noise for filtering purposes.
[0080] FIG. 7 is a schematic diagram showing the fringe number map shown in FIG. 4 after being filtered by the image processing method of the present invention.
[0081] Comparing the black box area in FIG7 with the black box area in FIG4 , it can be seen that the image processing method of the present invention can effectively eliminate noise in the fringe number image.
[0082] FIG8 is a flow chart of a point cloud generation method based on phase-shifted Gray code according to an embodiment of the present invention.
[0083] As shown in Figure 8, the point cloud generation method S200 based on the phase-shift Gray code of the present invention may include: step S202, obtaining a phase-shift coding map and a Gray code map of the surface of the object to be measured; step S204, decoding the phase-shift coding map to obtain a main value phase map, decoding the Gray code map and filtering the noise to obtain a fringe number map after noise filtering; step S206, obtaining an absolute phase map based on the main value phase map and the fringe number map after noise filtering; step S208, obtaining point cloud data representing the surface morphology characteristics of the object to be measured based on the absolute phase map.
[0084] The decoding and noise filtering of the Gray code image to obtain the noise-filtered fringe number image is implemented based on the image processing method S100 of any one of the embodiments described above in the present invention.
[0085] Figure 9 is a block diagram showing the structure of an image processing apparatus using a hardware implementation of a processing system according to an embodiment of the present invention. Figure 10 is a block diagram showing the structure of an image processing apparatus using a hardware implementation of a processing system according to an embodiment of the present invention.
[0086] The image processing device 1000 and the phase-shifted Gray code-based point cloud generation device 2000 may include corresponding modules for executing each or several steps in the above flowcharts. Therefore, each or several steps in the above flowcharts may be executed by corresponding modules, and may include one or more of these modules. A module may be one or more hardware modules specifically configured to execute the corresponding steps, or implemented by a processor configured to execute the corresponding steps, or stored in a computer-readable medium for execution by a processor, or implemented by some combination thereof.
[0087] The hardware structure can be implemented using a bus architecture. The bus architecture can include any number of interconnecting buses and bridges, depending on the specific application and overall design constraints of the hardware. Buses 1100, 2100 connect various circuits including one or more processors 1200, 2200, memories 1300, 2300 and / or hardware modules. Buses 1100, 2100 can also connect various other circuits 1400, 2400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.
[0088] Buses 1100 and 2100 may be Industry Standard Architecture (ISA) buses, Peripheral Component Interconnect (PCI) buses, or Extended Industry Standard Component Architecture (EISA) buses. Buses can be classified as address buses, data buses, control buses, and the like. For ease of illustration, this figure shows only one connecting line, but this does not imply that there is only one bus or only one type of bus.
[0089] Any process or method description in the flowchart or otherwise described herein can be understood to represent a module, fragment or portion of code including one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which the functions may be performed in a manner not shown or discussed, including performing the functions substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art of the art to which the embodiments of the present invention pertain. The processor performs the various methods and processes described above. For example, the method embodiments of the present invention can be implemented as a software program that is tangibly contained in a machine-readable medium, such as a memory. In some embodiments, part or all of the software program can be loaded and / or installed via a memory and / or a communication interface. When the software program is loaded into the memory and executed by the processor, one or more steps in the method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform one of the above methods in any other appropriate manner (e.g., by means of firmware).
[0090] The logic and / or steps represented in the flowchart or otherwise described herein may be embodied in any readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device).
[0091] For the purposes of this specification, a "readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples (a non-exhaustive list) of readable storage media include the following: an electrical connection having one or more wires (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), a fiber optic device, and a portable read-only memory (CDROM). In addition, the readable storage medium can even be paper or other suitable medium on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in other suitable ways as necessary, and then storing it in a memory.
[0092] It should be understood that various parts of the present invention can be implemented using hardware, software, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0093] Those skilled in the art will understand that all or part of the steps of the above-mentioned implementation method can be accomplished by instructing related hardware through a program, and the program can be stored in a readable storage medium. When the program is executed, it includes one or a combination of the steps of the method implementation method.
[0094] Furthermore, the functional units in various embodiments of the present invention may be integrated into a single processing module, each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in either hardware or software functional modules. If the integrated modules are implemented as software functional modules and sold or used as independent products, they may also be stored in a readable storage medium. The storage medium may be a read-only memory, a magnetic disk, or an optical disk, etc.
[0095] 9 , in some embodiments of the present invention, the image processing apparatus 1000 of the present invention may include: a stripe number map acquisition module 1002 , a stripe number map division module 1004 , a matching pixel point acquisition module 1006 , a noise point determination module 1008 , and a noise filtering module 1010 .
[0096] The fringe number map acquisition module 1002 obtains a fringe number map based on multiple Gray code images obtained from the surface of the object under test. The fringe number map includes multiple pixel stripes arranged along a first direction, each pixel stripe corresponds to a unique fringe number, the fringe numbers increase along the first direction, and each stripe extends along a second direction perpendicular to the first direction.
[0097] The fringe number map dividing module 1004 divides the fringe number map into continuous regions along the first direction for the pixel points in the fringe number map having the same second direction coordinates, so as to divide the fringe number map into one or more continuous regions.
[0098] The matching pixel point acquisition module 1006 takes all the pixel points in the continuous area as the pixel points to be checked, and obtains the number of matching pixel points on both sides of each pixel point to be checked based on the first direction coordinates of each pixel point to be checked and the stripe serial number corresponding to each pixel point to be checked, wherein the sequential relationship between the stripe serial number corresponding to the pixel point to be checked and the stripe serial number corresponding to the matching pixel points on both sides matches the positional relationship between the first direction coordinate of the pixel point to be checked and the first direction coordinate of the matching pixel points on both sides.
[0099] The noise point determination module 1008 determines whether each pixel to be detected is a noise point based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area.
[0100] The noise filtering module 1010 performs noise filtering on the fringe number image based on all noise points in the acquired fringe number image.
[0101] In some embodiments of the present invention, the phase-shift Gray code-based point cloud generation device 2000 of the present invention may include: an image acquisition module 2002, a first image processing module 2004, a second image processing module 2006, an absolute phase map acquisition module 2008, and a point cloud data acquisition module 2010.
[0102] Image acquisition module 2002 acquires a phase shift coding map and a Gray code map of the surface of the object being measured. First image processing module 2004 decodes the phase shift coding map to obtain a principal value phase map. Second image processing module 2006 decodes and removes noise from the Gray code map to obtain a noise-filtered fringe number map. Absolute phase map acquisition module 2008 acquires an absolute phase map based on the principal value phase map and the noise-filtered fringe number map. Point cloud data acquisition module 2010 acquires point cloud data representing the surface topography of the object being measured based on the absolute phase map. Second image processing module 2006 is the image processing device 1000 described above.
[0103] The present invention also provides an electronic device, comprising: a memory, the memory storing execution instructions; and a processor, the processor executing the execution instructions stored in the memory, so that the processor executes the image processing method of any embodiment of the present invention and / or executes the point cloud generation method of any embodiment of the present invention.
[0104] The present invention also provides a readable storage medium, which stores execution instructions. When the execution instructions are executed by a processor, they are used to implement the image processing method of any embodiment of the present invention and / or the point cloud generation method of any embodiment of the present invention.
[0105] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0106] It should be understood by those skilled in the art that the above embodiments are merely for the purpose of illustrating the present invention clearly, and are not intended to limit the scope of the present invention. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and such changes or modifications are still within the scope of the present invention.
Claims
1. An image processing method, characterized in that: include: A fringe number map is obtained based on a plurality of Gray code images obtained from the surface of the object to be measured, wherein the fringe number map comprises a plurality of pixel point fringe lines arranged along a first direction, each pixel point fringe line corresponds to a unique fringe number, the fringe number increases along the first direction, and each fringe line extends along a second direction perpendicular to the first direction; For pixel points in the fringe number map having the same second direction coordinate, dividing the fringe number map into continuous regions along the first direction, so as to divide the fringe number map into one or more continuous regions; Taking all the pixels in the continuous area as the pixels to be checked, the number of matching pixels on both sides of each pixel to be checked is obtained based on the first direction coordinates of each pixel to be checked and the stripe numbers corresponding to each pixel to be checked, wherein the order relationship between the stripe numbers corresponding to the pixel to be checked and the stripe numbers corresponding to the matching pixels on both sides matches the positional relationship between the first direction coordinates of the pixel to be checked and the first direction coordinates of the matching pixels on both sides; Determine whether each pixel to be detected is a noise point based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area; as well as The fringe number image is subjected to noise filtering based on all noise points in the fringe number image.
2. The image processing method according to claim 1, characterized in that: Get the number of matching pixels on both sides of each pixel to be checked, including: Determine whether the first direction coordinate of the pixel to be inspected on the first side of the current pixel to be inspected is less than the first direction coordinate of the current pixel to be inspected, and determine whether the stripe number corresponding to the pixel to be inspected on the first side of the current pixel to be inspected is less than or equal to the stripe number corresponding to the current pixel to be inspected. If both are yes, determine that the pixel to be inspected on the first side is a matching pixel; Determine whether the first direction coordinate of the pixel to be inspected on the second side of the current pixel to be inspected is greater than the first direction coordinate of the current pixel to be inspected, and determine whether the stripe number corresponding to the pixel to be inspected on the second side of the current pixel to be inspected is greater than or equal to the stripe number corresponding to the current pixel to be inspected. If both are yes, determine that the pixel to be inspected on the second side is a matching pixel; and The matching pixel points on the first side and the matching pixel points on the second side of the current pixel point to be detected are counted to obtain the number of matching pixel points on the two sides.
3. The image processing method according to claim 1, characterized in that: Judging whether each pixel to be detected is a noise point based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area includes: Comparing the numbers of matching pixels on both sides of each pixel to be detected in the continuous area to obtain a comparison result; and Based on the comparison result, it is determined whether each pixel to be detected is a noise point.
4. The image processing method according to claim 3, characterized in that: The comparison operation includes: Comparison of the number of matching pixels on both sides of each pixel in a one-dimensional connected domain based on pixel stripes.
5. The image processing method according to claim 4, characterized in that: Judging whether each pixel to be detected is a noise point based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area includes: For the pixel points having the same second direction coordinates in the stripe number map, obtaining a one-dimensional connected domain of each pixel stripe based on the pixel values of the pixel points; Determine whether the one-dimensional connected domain of each pixel stripe is unique; and If there are more than two one-dimensional connected domains of a pixel stripe, the sum of the number of matching pixels on both sides of all pixels in each one-dimensional connected domain is compared, and the one-dimensional connected domain with the largest sum of the number of matching pixels on both sides of all pixels is retained, and the pixels in other one-dimensional connected domains are judged as noise points.
6. The image processing method according to claim 5, characterized in that: If there are more than two one-dimensional connected domains with the largest sum of the number of matching pixels on both sides of all pixels, the mean values of the number of matching pixels on both sides of all pixels in the more than two one-dimensional connected domains are compared, and the one-dimensional connected domain with the largest mean value of the number of matching pixels on both sides of all pixels is retained, and the pixels in the other one-dimensional connected domains are determined as noise points.
7. The image processing method according to claim 3, characterized in that: The comparison operation includes: The number of matching pixels on both sides of each pixel to be checked is compared with a preset threshold.
8. The image processing method according to claim 5, characterized in that: Judging whether each pixel to be detected is a noise point based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area includes: For the pixel points in the fringe number map having the same second direction coordinate, comparing the number of matching pixel points on both sides of each pixel point with a preset threshold; Pixel points whose number of matching pixel points on both sides is less than or equal to the preset threshold are determined as noise points.
9. A point cloud generation method, the point cloud generation method is a point cloud generation method based on phase-shift Gray code, characterized in that: include: Obtaining a phase shift coding diagram and a Gray code diagram of the surface of the object being measured; Decoding the phase shift coding image to obtain a main value phase image, decoding the Gray code image and filtering out noise to obtain a fringe number image after noise filtering; Obtaining an absolute phase image based on the main value phase image and the fringe number image after noise filtering; as well as Acquire point cloud data representing the surface morphology characteristics of the object under test based on the absolute phase image; Wherein, decoding the Gray code image and filtering out noise to obtain the noise-filtered fringe number image is implemented based on the image processing method described in claim 1.
10. An image processing device, characterized in that: include: a fringe number map acquisition module, which acquires a fringe number map based on a plurality of Gray code maps acquired from the surface of the object to be measured, wherein the fringe number map comprises a plurality of pixel point fringe lines arranged along a first direction, each pixel point fringe line corresponds to a unique fringe number, the fringe number increases along the first direction, and each fringe line extends along a second direction perpendicular to the first direction; a fringe number map division module, for pixel points in the fringe number map having the same second direction coordinate, dividing the fringe number map into continuous regions along the first direction, so as to divide the fringe number map into one or more continuous regions; A matching pixel point acquisition module, which uses all the pixels in the continuous area as the pixels to be checked, and obtains the number of matching pixels on both sides of each pixel to be checked based on the first direction coordinates of each pixel to be checked and the stripe numbers corresponding to each pixel to be checked, wherein the order relationship between the stripe numbers corresponding to the pixel to be checked and the stripe numbers corresponding to the matching pixels on both sides matches the positional relationship between the first direction coordinates of the pixel to be checked and the first direction coordinates of the matching pixels on both sides; A noise point determination module, which determines whether each pixel point to be detected is a noise point based on the number of matching pixels on both sides of all the pixels to be detected in the continuous area; and and a noise filtering module, which performs noise filtering on the fringe number image based on all noise points in the fringe number image obtained.
Citation Information
Patent Citations
Three-dimensional measuring method based on positive and inverse code color encoding stripes
CN101666631A
Underwater three-dimensional reconstruction method based on binocular structured light
CN113129430A
Phase shift stripe brightness amplitude-based point cloud noise deletion method
CN113793273A
Image processing method, point cloud generation method, electronic equipment and readable storage medium
CN116385657A
Forming 3D models using periodic illumination patterns
US20120176380A1
