A defect unwrapping method and inverse mapping method for a curved strip target
Patent Information
- Application Number
- CN202611146451.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-30
- Publication Date
- 2026-10-20
AI Technical Summary
但是极坐标展开适用于以固定圆心为基础的环形目标,而对于非圆形、非同心、局部弯曲、开放式曲线结构,其展开结果容易出现局部拉伸、压缩或错位,不适合任意开放曲线、局部弯曲结构和非规则曲线带状工业目标
一种面向曲线带状目标的缺陷展开方法,包括以下步骤
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection, and specifically to a defect unfolding method and inverse mapping method for curved strip-shaped targets. Background Technology
[0002] To facilitate the detection of curved targets, the curve is typically unfolded for detection. For example, a polar coordinate-based geometric correction method can be used. Specifically, for rings or concentric structures, polar coordinate unfolding can be used to unfold the circular structure into a rectangular image. This method is suitable for regular geometric targets and has the advantages of simple implementation and high computational efficiency. However, polar coordinate unfolding is suitable for ring-shaped targets with a fixed center. For non-circular, non-concentric, locally curved, or open curved structures, the unfolding result is prone to local stretching, compression, or misalignment, making it unsuitable for arbitrarily open curves, locally curved structures, and irregular curved strip-shaped industrial targets. Summary of the Invention
[0003] The purpose of this invention is to overcome the aforementioned defects or problems existing in the prior art or to provide a material basis for overcoming the aforementioned defects or problems existing in the prior art, and to provide a defect unfolding method and an inverse mapping method for curved strip targets.
[0004] To achieve the above objectives, the present invention and its preferred embodiments employ the following technical solutions, but the embodiments are not limited to the following solutions: Option 1, a defect unfolding method for curved strip targets, includes the following steps: The baseline point sequence of the curved strip target region is obtained, and the boundary or bandwidth of the curved strip target is obtained at the same time; the curved strip target region is an open curve structure or a closed curve structure. The cumulative arc length is calculated based on the distance between adjacent points in the unfolded baseline point list to obtain the total curve length; according to the set arc length sampling step, several discrete sampling positions are generated in the curve direction; Determine the unit normal direction at each arc-length sampling position; Using the arc length direction as the horizontal coordinate of the unfolded strip plot and the normal offset as the vertical coordinate, a curve unfolding mapping table is constructed: P(s,d)=C(s)+d·n(s); Where P(s,d) is the coordinate point of the rectangular strip plot (s,d) in the original plot, C(s) represents the coordinate of the unfolded baseline point at the arc length position s, n(s) represents the unit normal direction at that point, and d represents its normal offset relative to the unfolded baseline. The original image is resampled according to the curve expansion mapping table to generate a rectangular strip image; Defect analysis is performed on a rectangular strip image to obtain defect image results or defect region results in the strip domain.
[0005] Option 2, based on Option 1, also includes the step of obtaining the curved strip target region: The process involves acquiring an industrial image to be inspected and determining the curved strip target region within the image using methods such as threshold segmentation, edge detection, template matching, contour analysis, manual annotation, or deep learning segmentation.
[0006] Option 3, based on Option 1, involves deduplicating, smoothing, or processing outliers on the unfolded baseline point list before calculating the cumulative arc length.
[0007] Option 4, based on Option 3, involves processing the repeated points at the beginning and end when the curve is a closed curve structure.
[0008] Option 5, based on Option 1, if the length of the baseline for unfolding the curved strip target area degrades or the number of points is insufficient, then the curved strip target area will not be unfolded.
[0009] Option 6, based on Option 1, calculates the local tangential direction at each arc length sampling position, corresponding to the unfolded baseline point, and obtains the unit normal direction based on the local tangential direction: When the target area of the curve strip is an open curve structure, the local tangential direction of the starting point in the unfolded baseline point sequence is calculated by forward difference, the local tangential direction of the ending point is calculated by backward difference, and the local tangential direction of the remaining points is calculated by forward and backward difference. When the target area of the curved strip is a closed curve structure, the local tangential direction of each point is calculated by front and back difference.
[0010] Option 7, based on Option 1, involves safe normalization after calculating the local tangential direction and unit normal direction: First, calculate the vector length len. If len is less than the threshold, the vector is considered degenerate and (0,0) is returned directly. If len is greater than or equal to the threshold, the unit vector (vx / len, vy / len) is returned, where vx and vy refer to the x and y components of the direction vector to be normalized.
[0011] Option 8, an inverse mapping method, based on any one of Options 1 to 7, a defect unfolding method for curved strip targets, includes the following steps: Based on the curve expansion mapping table, the defect image results or defect region results in the strip domain are inversely mapped to output the defect results restored to the original image coordinate system.
[0012] Scheme 9, based on Scheme 8, performs inverse mapping on the image results based on bilinear weight allocation. When the strip domain processing result is a defective image, the strip image pixels are restored to the original image coordinates according to the curve expansion mapping table. For each rectangular strip image pixel, its corresponding original image floating-point coordinates are read, and its pixel value is allocated to the four nearest integer pixel positions in the original image according to bilinear weights. If multiple rectangular strip image pixels contribute to the same original image pixel, the pixel values and weights are accumulated respectively, and finally the weights are normalized. For original image positions not covered by rectangular strip image pixels, the original background values are kept unchanged. When the strip domain processing result is a defect image result, the minimum bounding rectangle window of the region pixel in the original image is calculated according to the coordinates of the region pixel in the mapping table, and a local binary mask is established within the minimum bounding rectangle window; the original image mapping points corresponding to the adjacent region pixels are connected along the arc length direction and normal direction of the strip image, and oblique connectivity compensation is performed on the local adjacent grid.
[0013] Scheme 10, based on Scheme 8, determines whether there are obvious corners or high curvature regions in the curve during the inverse mapping process based on the local directional changes formed by adjacent mapping points. When the local corner change exceeds the threshold, the number of chord connection sampling steps is adaptively increased.
[0014] As can be seen from the above description of the present invention and its preferred embodiments, compared with the prior art, the technical solution of the present invention and its preferred embodiments have the following beneficial effects due to the adoption of the following technical means: A defect unfolding method for curved strip targets includes the following steps: The baseline point sequence of the curved strip target region is obtained, and the boundary or bandwidth of the curved strip target is obtained at the same time; the curved strip target region is an open curve structure or a closed curve structure. The cumulative arc length is calculated based on the distance between adjacent points in the unfolded baseline point list to obtain the total curve length; according to the set arc length sampling step, several discrete sampling positions are generated in the curve direction; Determine the unit normal direction at each arc-length sampling position; Using the arc length direction as the horizontal coordinate of the unfolded strip plot and the normal offset as the vertical coordinate, a curve unfolding mapping table is constructed: P(s,d)=C(s)+d·n(s); Where P(s,d) is the corresponding coordinate point of the strip plot coordinate (s,d) in the original plot, C(s) represents the coordinate of the unfolded baseline point at the arc length position s, n(s) represents the unit normal direction at that point, and d represents its normal offset relative to the unfolded baseline. The original image is resampled according to the curve expansion mapping table to generate a rectangular strip image; Defect analysis is performed on a rectangular strip image to obtain defect image results or defect region results in the strip domain.
[0015] This invention does not simply generate unfolded images, but rather establishes a "original image curve-strip target region - rectangular strip map - strip domain defect processing" model specifically for industrial defect detection. This transforms the detection problem of curve-strip structures into a detection problem within a regular strip domain. Furthermore, a unified curve unfolding mapping table is used to unfold the original image, ensuring that the image forward transformation and the region forward transformation share the same arc length and normal mapping relationship, guaranteeing the coordinate consistency of the two types of data in the unfolded domain. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments are briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a diagram showing the unfolded curve effect in Example 1. The yellow area in the upper left corner is the unfolded rectangular strip diagram. Figure 2 This is a schematic diagram showing the baseline and bandwidth in Example 1; Figure 3 This is a schematic diagram of the region after the inverse transformation. The red area is the corresponding curve strip graph, which is the original region. Figure 4 This is a diagram showing the defect extraction results in Example 1; Figure 5 This is a step diagram from Example 1. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are preferred embodiments of the present invention and should not be considered as excluding other embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0019] Unless otherwise expressly defined, the use of terms such as "first," "second," or "third" in the claims, description, and accompanying drawings of this invention is for distinguishing different objects and not for describing a specific order.
[0020] Unless otherwise expressly defined, in the claims, description, and accompanying drawings of this invention, the use of directional terms such as "center," "lateral," "longitudinal," "horizontal," "vertical," "top," "bottom," "inner," "outer," "upper," "lower," "front," "rear," "left," "right," "clockwise," and "counterclockwise" to indicate orientation or positional relationships is based on the orientation and positional relationships shown in the accompanying drawings and is only for the convenience of describing the invention and simplifying the description, and is not intended to indicate or imply that the device or element referred to must have a specific orientation or be constructed and operated in a specific orientation, and therefore should not be construed as limiting the specific scope of protection of this invention.
[0021] Unless otherwise expressly defined, the terms "fixed connection" or "fixed connection" used in the claims, description and drawings of this invention should be interpreted broadly to refer to any connection in which there is no displacement or relative rotation relationship between the two parties, including non-removable fixed connection, detachable fixed connection, integral connection and fixed connection by other means or components.
[0022] In the claims, description and accompanying drawings of this invention, the terms "comprising," "having," and variations thereof are used to mean "including but not limited to."
[0023] refer to Figures 1-5 , A defect unfolding method for curved strip targets includes the following steps: S1: Obtaining the Curved Strip Target Region: Acquire the industrial image to be inspected, and determine the curved strip target region within the image using methods such as threshold segmentation, edge detection, template matching, contour analysis, manual annotation, or deep learning segmentation. The curved strip target region can be an open or closed curve structure. It represents the ROI to be inspected. This method is suitable for regions with curved boundaries, such as products with clear and distinct contour boundaries. The detection area typically surrounds this contour, hence the name "curved strip." This method is applicable to products requiring inspection of non-linear edge regions, such as the glass covers of mobile phones, watches, and tablets. Figure 1 That is, the glass cover of a mobile phone.
[0024] S2: Based on the curved strip-shaped target region, extract or fit its unfolded baseline (extracting the unfolded baseline means obtaining a line directly from the segmented target region using image processing methods, such as Canny edge detection; fitting involves first obtaining some discrete points, boundary points, or coarse sampling points, and then approximating it with a mathematical curve to make the curve smoother and more stable. If the target outline is clear, the boundary is stable, and the segmentation result quality is good, it can be extracted directly. If the target boundary has noise, local gaps, burrs, or breaks, fitting is more suitable), obtain its unfolded baseline point sequence, and simultaneously obtain the left and right boundaries or bandwidth of the curved strip-shaped target. This bandwidth can be defined manually and is not a fixed value, but it needs to refer to a width range, for example... Figure 2 The selected expansion baseline is the outer edge of the bounding box. Its width should be the distance *d* between the outer and inner edges of the bounding box. Since the inner and outer edges are two non-parallel curves, if the sampling width is greater than *d*, the inner edge will be included, and the curve will still exist after expansion, which is detrimental to subsequent processing. The expansion baseline describes the geometric orientation of the target along its length, while the boundary or bandwidth constrains the normal sampling range.
[0025] S3: Perform deduplication (removing duplicate points at the beginning and end, removing adjacent duplicate points, etc.) or smoothing or outlier processing on the unfolded baseline point list, removing adjacent duplicate points and invalid points. When the curve is a closed curve structure, the duplicate points at the beginning and end are processed to ensure the stability of the cumulative arc length and tangential direction calculation. If the unfolded baseline length of the curve strip target area degenerates or the number of points is insufficient, the area is determined not to meet the unfolding conditions, and the curve strip target area will not be unfolded.
[0026] S4: Calculate the cumulative arc length based on the distance between adjacent points in the unfolded baseline point column to obtain the total length of the curve. Calculating the arc length is to establish one-dimensional position coordinates on the curve. Only after obtaining the arc length coordinates can the curved baseline be unfolded into the horizontal coordinates of the rectangular strip diagram along the length direction. According to the set arc length sampling step size (the sampling step size can be set by yourself, and is generally 1 pixel by default. The step size can be increased or decreased according to actual needs), generate several discrete sampling positions in the curve direction. Each sampling position corresponds to a column in the unfolded strip diagram.
[0027] S5: At each discrete sampling location, calculate the local tangential direction of the corresponding unfolded baseline point (sampling point), and obtain the unit normal direction based on the local tangential direction; specifically: When the target area of the curve strip is an open curve structure, the open curve, i.e., the unfolded baseline, has a clear start and end point, such as P0 — P1 — P2 — P3 — P4, where P0 is the start point, P4 is the end point, and P1, P2, and P3 are intermediate points. The start point P0 has no preceding point, and the tangent of the start point = the direction from the start point to the next point, i.e., t0 = normalize(P1 - P0). Therefore, the local tangent direction of the start point in the unfolded baseline point sequence is calculated through forward difference. Similarly, the tangent of the end point = the direction from the preceding point to the end point, t4 = normalize(P4 - P3). Therefore, the local tangent direction of the end point is calculated through backward difference. Intermediate points have points before and after them, therefore, ti = normalize(P(i+1) - P(i-1)), where i is 2 or 3 in this example. Therefore, the local tangent directions of the remaining points (points other than the start and end points, i.e., intermediate points) are calculated through forward and backward difference. When the target area of the curved strip is a closed curve structure, since any point has a front and a back point, the local tangential direction of each point is calculated by front and back difference.
[0028] Finally, safe normalization is used to avoid numerical anomalies caused by zero-length vectors. Ordinary normalization is: normalize(v) = v / |v|. If v = (0,0), then |v| = 0, resulting in NaN or invalid values. Subsequent use of this tangential vector to calculate the normal and mapped coordinates would pollute the entire mapping table. Safe normalization first calculates the vector length len. If len is less than a threshold, the vector is considered degenerate and (0,0) is returned directly. If len is greater than or equal to the threshold (and therefore normal), a unit vector (vx / len, vy / len) is returned, where vx and vy refer to the x and y components of the direction vector to be normalized.
[0029] S6: Construct a curve unfolding mapping table using the arc length direction as the horizontal coordinate of the unfolded strip image and the normal offset (obtained from the unit normal direction) as the vertical coordinate of the unfolded strip image: For any pixel in the rectangular strip image, determine the arc length position based on its horizontal coordinate, determine the normal offset based on its vertical coordinate, and calculate its floating-point coordinates in the original image according to the following relationship: P(s,d)=C(s)+d·n(s); Where P(s,d) is the coordinate point of the rectangular strip plot (s,d) in the original plot, C(s) represents the coordinate of the unfolded baseline point at the arc length position s, n(s) represents the unit normal direction at that point, and d represents its normal offset relative to the unfolded baseline; thus, a unified mapping table from strip coordinates to original plot coordinates is obtained.
[0030] S7: Resample the original image according to the curve unfolding mapping table to generate a rectangular strip image; simultaneously, for the curved strip target area in the original image, the region can be unfolded according to the same mapping table to obtain the region representation in the strip coordinate system. This allows both image data and region data (the preceding strip images are image data with grayscale value changes, used for defect detection. Region data is equivalent to a binary image, where 1 indicates belonging to a region and 0 indicates not belonging to a region, used for locating and outputting defect results) to share the same mapping relationship, thus maintaining the coordinate consistency of the two types of data in the unfolded domain.
[0031] S8: Perform defect analysis on rectangular strip images, such as through one or more of the following methods: defect enhancement, background suppression, texture analysis, thresholding, traditional feature detection, object detection, semantic segmentation, or instance segmentation, to obtain defect image results or defect region results in the strip domain. Because the curved structure has been unfolded into regular strips, the direction, scale, and local contextual relationships (the relative positional relationship between a defect pixel or defect region and its surrounding structures) of the defects are more stable.
[0032] S9: Inverse mapping of defective image results or defective region results in the strip domain: Inverse mapping of image results based on bilinear weight allocation. When the strip domain processing result is a defective image result, the rectangular strip image pixels are restored to the original image coordinates according to the curve expansion mapping table. For each rectangular strip image pixel, its corresponding original image floating-point coordinates are read, and its pixel value is allocated to the four nearest integer pixel positions in the original image according to the bilinear weight. If multiple rectangular strip image pixels contribute to the same original image pixel, the pixel values and weights are accumulated respectively, and finally the weights are normalized. For the original image positions not covered by rectangular strip image pixels, the original background values are kept unchanged. Specifically, when each strip pixel is mapped back to the original image, it usually falls on a floating-point coordinate, rather than an integer pixel coordinate. Therefore, it cannot be simply written to a single pixel; instead, its contribution is distributed proportionally based on its distance from the surrounding four integer pixels.
[0033] Suppose that a pixel in the striped image has the value I_strip(u,v). It maps to the floating-point coordinates in the original graph through a mapping table: (fx, fy). Here, fx and fy are generally not integers, for example: fx = 100.3, fy = 50.7.
[0034] So it is located in the original Figure 4 Between integer pixels: (x0, y0) = (100, 50) (x1, y0) = (101, 50) (x0, y1) = (100, 51) (x1, y1) = (101, 51) Where: x0 = floor(fx) y0 = floor(fy) x1 = x0 + 1 y1 = y0 + 1 Next, calculate the decimal offset within the smaller grid: dx = fx - x0 dy = fy - y0 For the example: dx = 100.3 - 100 = 0.3 dy = 50.7 - 50 = 0.7 The four weights are: w00 = (1-dx)(1-dy)= (1-0.3)(1-0.7) = 0.7 × 0.3 = 0.21 w10 = dx(1-dy)= 0.3 × (1-0.7) = 0.3 × 0.3 = 0.09 w01 = (1-dx)dy=(1-0.3) × 0.7 = 0.7 × 0.7 = 0.49 w11 = dxdy = 0.3 × 0.7 = 0.21 The entire contribution of this strip pixel is distributed among its four neighboring pixels. Assuming the pixel value is 200, then the contribution (x0, y0): 200 × 0.21 = 42 (x1, y0): 200 × 0.09 = 18 (x0, y1): 200 × 0.49 = 98 (x1, y1): 200 × 0.21 = 42 Because many pixels in a strip will be mapped back to the original image, and they may fall near the same pixel in the original image, we cannot simply overwrite the one written last; instead, we must sum them all up. The final restored pixel value = sum of weighted pixel contributions / sum of weights. This step is called weight normalization.
[0035] When the strip domain processing result is a defect image result, the minimum bounding rectangle window of the region pixel in the original image is calculated based on the coordinates of the region pixel in the mapping table, and a local binary mask is established within the minimum bounding rectangle window; the original image mapping points corresponding to the adjacent region pixels are connected along the arc length direction and normal direction of the strip image, and oblique connectivity compensation is performed on the local adjacent grid.
[0036] S10: During the inverse mapping process, the presence of obvious corners or high curvature regions in the curve is determined based on the local directional changes formed by adjacent mapping points. When the local corner change exceeds a threshold, the number of chord connection sampling steps is adaptively increased. Specifically, chord connections are made between the original image mapping points corresponding to adjacent foreground pixels in the strip region, and connectivity compensation is performed along the arc length direction, normal direction, and local adjacency direction, respectively. For example, the presence of obvious corners or folds can be determined based on the directional changes of adjacent vectors formed by three consecutive mapping points. When the directional change exceeds a threshold, the number of chord connection sampling steps is adaptively increased.
[0037] S11: Outputs defect results restored to the original image coordinate system. This includes the defect image, defect region, defect outline, defect area, length, width, location, severity, or grading results. The output can be used for defect visualization, dimensional measurement, quality assessment, re-inspection marking, or industrial control.
[0038] Compared with the prior art, this embodiment has the following beneficial effects: In one exemplary embodiment, a defect unfolding method for curved strip targets includes the following steps: The baseline point sequence of the curved strip target region is obtained, and the boundary or bandwidth of the target is also obtained; the curved strip target region is an open curve structure or a closed curve structure. The cumulative arc length is calculated based on the distance between adjacent points in the unfolded baseline point list to obtain the total curve length; according to the set arc length sampling step, several discrete sampling positions are generated in the curve direction; Determine the unit normal direction at each arc-length sampling position; Using the arc length direction as the horizontal coordinate of the unfolded strip plot and the normal offset as the vertical coordinate, a curve unfolding mapping table is constructed: P(s,d)=C(s)+d·n(s); Where P(s,d) is the corresponding coordinate point of the strip plot coordinate (s,d) in the original plot, C(s) represents the coordinate of the unfolded baseline point at the arc length position s, n(s) represents the unit normal direction at that point, and d represents its normal offset relative to the unfolded baseline. The original image is resampled according to the curve expansion mapping table to generate a rectangular strip image; Defect analysis is performed on a rectangular strip image to obtain defect image results or defect region results in the strip domain.
[0039] This invention does not simply generate unfolded images, but rather establishes a "original image curve-strip target region - rectangular strip map - strip domain defect processing" model specifically for industrial defect detection. This transforms the detection problem of curve-strip structures into a detection problem within a regular strip domain. Furthermore, a unified curve unfolding mapping table is used to unfold the original image, ensuring that the image forward transformation and the region forward transformation share the same arc length and normal mapping relationship, guaranteeing the coordinate consistency of the two types of data in the unfolded domain.
[0040] In one exemplary embodiment, the method further includes the step of obtaining a curved strip-shaped target region: The process involves acquiring an industrial image to be inspected and identifying a curved, strip-shaped target region within the image using methods such as threshold segmentation, edge detection, template matching, contour analysis, manual annotation, or deep learning segmentation, to suit industrial automation applications.
[0041] In one exemplary embodiment, before calculating the cumulative arc length, the unfolded baseline point list is deduplicated, smoothed, or anomaly point processed to remove adjacent duplicate points and invalid points.
[0042] In one exemplary embodiment, when the curve is a closed curve structure, the first and last repeated points are processed to prevent mutual interference.
[0043] In one exemplary embodiment, if the length of the unfolding baseline of the curved strip target region degenerates or the number of points is insufficient, the curved strip target region will not be unfolded. This ensures that only curved strip regions with effective length, effective direction, and effective geometric structure enter the unfolding process. If the unfolding baseline is too short, the number of points is too small, or the geometry has degenerated into a single point / very short segment, forcibly unfolding it would be meaningless and could lead to algorithm errors or unstable results.
[0044] In one exemplary embodiment, At each arc length sampling position, calculate the local tangential direction of the corresponding unfolded baseline point, and obtain the unit normal direction based on the local tangential direction: When the target area of the curve strip is an open curve structure, the local tangential direction of the starting point in the unfolded baseline point sequence is calculated by forward difference, the local tangential direction of the ending point is calculated by backward difference, and the local tangential direction of the remaining points is calculated by forward and backward difference; in order to ensure the accuracy of the calculation.
[0045] When the target area of the curved strip is a closed curve structure, the local tangential direction of each point is calculated by front and back difference to ensure the accuracy of the calculation.
[0046] In one exemplary embodiment, after calculating the local tangential direction and the unit normal direction, a safety normalization process is performed: First, calculate the vector length len. If len is less than the threshold, the vector is considered degenerate and (0,0) is returned directly. If len is greater than or equal to the threshold, a unit vector (vx / len, vy / len) is returned to avoid numerical anomalies caused by zero-length vectors.
[0047] In one exemplary embodiment, an inverse mapping method, based on the aforementioned defect unfolding method for curved strip targets, includes the following steps: Based on the curve unfolding mapping table, the defect image results or defect region results in the strip domain are inversely mapped, and a complete closed loop of "original image curve strip target region - rectangular strip image - strip domain defect processing - original image coordinate result reflection" is established. This ensures that the forward image transformation, inverse image transformation, forward region transformation and inverse region transformation share the same arc length and normal mapping relationship, guaranteeing that the coordinates between the strip image, strip defect region and original image defect result are consistent, and avoiding mismatch between image display results and region positioning results.
[0048] The output restores the defect results to the original coordinate system, accurately returning the detection results to the original coordinate system, thus achieving the integration of detection, positioning, measurement, and output.
[0049] In one exemplary embodiment, inverse mapping is performed on the image results based on bilinear weight allocation. When the stripe domain processing result is a defective image result, the stripe image pixels are restored to the original image coordinates according to the curve expansion mapping table. For each rectangular stripe image pixel, its corresponding original image floating-point coordinates are read, and its pixel value is allocated to the four nearest integer pixel positions in the original image according to bilinear weights. If multiple rectangular stripe image pixels contribute to the same original image pixel, the pixel values and weights are accumulated respectively, and finally, weight normalization is performed. For original image positions not covered by rectangular stripe image pixels, the original background value remains unchanged. The inverse mapping method based on bilinear weight allocation uses a pixel contribution allocation method instead of simple nearest neighbor backfilling during image inverse mapping. Stripe pixels are allocated to the neighboring pixels in the original image according to bilinear weights, and the restoration result is obtained through weight normalization. This can reduce holes, jagged edges, gray-level abrupt changes, and local discontinuities in inverse mapping, and improve the smoothness and positioning stability of the image result restoration.
[0050] When the strip domain processing result is a defective image result, the minimum bounding rectangle window of the region pixel in the original image is calculated based on the coordinates of the region pixel in the mapping table, and a local binary mask is established within the minimum bounding rectangle window; the original image mapping points corresponding to the adjacent region pixels are connected along the arc length direction and normal direction of the strip image, and oblique connectivity compensation is performed on the local adjacent grid; in this way, the continuous region in the strip domain is stably restored to the continuous region in the original image coordinate system.
[0051] In one exemplary embodiment, to address the issues of discrepancies, breaks, and missed mappings that easily occur when strip domain defect regions are mapped back to the original image coordinate system, the system determines whether there are obvious corners or high curvature regions in the curve based on the local directional changes formed by adjacent mapping points during the inverse mapping process. When the local corner change exceeds a threshold, the number of chord connection sampling steps is adaptively increased, thereby enhancing the mapping continuity of high curvature regions, slender defect regions, and locally bent regions.
[0052] The foregoing description of the specifications and embodiments is intended to explain the scope of protection of this invention, but does not constitute a limitation on the scope of protection of this invention. Modifications, equivalent substitutions, or other improvements to the embodiments of this invention or a portion thereof that can be obtained by those skilled in the art through logical analysis, reasoning, or limited experimentation, based on the teachings of this invention or the foregoing embodiments, in conjunction with common knowledge, general technical knowledge, and / or existing technology, should all be included within the scope of protection of this invention.
Claims
1. A defect unfolding method for curved strip targets, characterized in that: Includes the following steps The baseline point sequence of the curved strip target region is obtained, and the boundary or bandwidth of the curved strip target is obtained at the same time. The curved strip-shaped target region has an open curve structure or a closed curve structure; The cumulative arc length is calculated based on the distance between adjacent points in the unfolded baseline point list to obtain the total curve length; according to the set arc length sampling step, several discrete sampling positions are generated in the curve direction; Determine the unit normal direction at each arc-length sampling position; Using the arc length direction as the horizontal coordinate of the unfolded strip plot and the normal offset as the vertical coordinate, a curve unfolding mapping table is constructed: P(s,d)=C(s)+d·n(s); Where P(s,d) is the coordinate point of the rectangular strip plot (s,d) in the original plot, C(s) represents the coordinate of the unfolded baseline point at the arc length position s, n(s) represents the unit normal direction at that point, and d represents its normal offset relative to the unfolded baseline. The original image is resampled according to the curve expansion mapping table to generate a rectangular strip image; Defect analysis is performed on a rectangular strip image to obtain defect image results or defect region results in the strip domain.
2. The defect unfolding method for curved strip targets as described in claim 1, characterized in that: It also includes the step of obtaining the curved band target region: The process involves acquiring an industrial image to be inspected and determining the curved strip target region within the image using methods such as threshold segmentation, edge detection, template matching, contour analysis, manual annotation, or deep learning segmentation.
3. The defect unfolding method for curved strip targets as described in claim 1, characterized in that: Before calculating the cumulative arc length, the expanded baseline point list is deduplicated, smoothed, or processed for outliers.
4. The defect unfolding method for curved strip targets as described in claim 3, characterized in that: When the curve is a closed curve structure, the first and last repeated points are processed.
5. The defect unfolding method for curved strip targets as described in claim 1, characterized in that: If the length of the baseline for unfolding the curved strip target area degrades or the number of points is insufficient, the curved strip target area will not be unfolded.
6. The defect unfolding method for curved strip targets as described in claim 1, characterized in that: At each arc length sampling position, calculate the local tangential direction of the corresponding unfolded baseline point, and obtain the unit normal direction based on the local tangential direction: When the target area of the curve strip is an open curve structure, the local tangential direction of the starting point in the unfolded baseline point sequence is calculated by forward difference, the local tangential direction of the ending point is calculated by backward difference, and the local tangential direction of the remaining points is calculated by forward and backward difference. When the target area of the curved strip is a closed curve structure, the local tangential direction of each point is calculated by front and back difference.
7. The defect unfolding method for curved strip targets as described in claim 1, characterized in that: After calculating the local tangential direction and the unit normal direction, a safe normalization process is performed: First, calculate the vector length len. If len is less than the threshold, the vector is considered degenerate and (0,0) is returned directly. If len is greater than or equal to the threshold, the unit vector (vx / len, vy / len) is returned, where vx and vy refer to the x and y components of the direction vector to be normalized.
8. An inverse mapping method, characterized in that: A defect unfolding method for curved strip targets as described in any one of claims 1-7 includes the following steps: Based on the curve expansion mapping table, the defect image results or defect region results in the strip domain are inversely mapped to output the defect results restored to the original image coordinate system.
9. The inverse mapping method as described in claim 8, characterized in that: The image results are inversely mapped based on bilinear weight allocation. When the strip domain processing result is a defective image, the strip image pixels are restored to the original image coordinates according to the curve expansion mapping table. For each rectangular strip image pixel, its corresponding original image floating-point coordinates are read, and its pixel value is allocated to the four nearest integer pixel positions in the original image according to bilinear weight. If multiple rectangular strip image pixels contribute to the same original image pixel, the pixel values and weights are accumulated respectively, and finally the weights are normalized. For the original image positions not covered by rectangular strip image pixels, the original background values are kept unchanged. When the strip domain processing result is a defect image result, the minimum bounding rectangle window of the region pixel in the original image is calculated according to the coordinates of the region pixel in the mapping table, and a local binary mask is established within the minimum bounding rectangle window; the original image mapping points corresponding to the adjacent region pixels are connected along the arc length direction and normal direction of the strip image, and oblique connectivity compensation is performed on the local adjacent grid.
10. The inverse mapping method as described in claim 8, characterized in that: During the inverse mapping process, the presence of obvious turning points or high curvature regions in the curve is determined based on the local directional changes formed by adjacent mapping points. When the local turning point changes exceed the threshold, the number of chord connection sampling steps is adaptively increased.