Euclidean distance transformation calculation method and device for enhancing local perception

By dividing the image into multiple sub-blocks and calculating and merging feature points dimension by dimension in the Euclidean distance transformation, the problem of high computational complexity in the prior art is solved, and more efficient Euclidean distance transformation calculation is achieved.

CN121837670APending Publication Date: 2026-04-10INST OF SOFTWARE - CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511945580.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing Euclidean distance transformation calculation methods are computationally complex and inefficient when processing large-scale, high-resolution images, especially when the feature pixel distribution is sparse and uneven, which affects the efficiency of image segmentation and path planning.

Method used

The N-dimensional image is divided into intervals along each dimension to form multiple image sub-blocks. Within each sub-block, the nearest feature point of each pixel is calculated dimension by dimension. Sub-blocks are gradually merged along the dimensional direction to update the nearest feature point of each pixel. Finally, the Euclidean distance from each pixel in the image to its nearest feature point is calculated.

Benefits of technology

By employing a locally-aware Euclidean distance transformation calculation method, computational complexity is reduced, computational efficiency is improved, and irrelevant calculations are avoided, making it suitable for rapid processing of large-scale and high-resolution images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121837670A_ABST
    Figure CN121837670A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of graphic image processing, and provides an Euclidean distance transformation calculation method and device for enhancing local perception. According to the method, interval division is carried out on a to-be-processed N-dimensional image in each dimension to obtain a plurality of image sub-blocks, and processing is carried out in each image sub-block in sequence dimension by dimension to calculate the nearest feature point of each pixel in the image sub-block; and gradually combining the image sub-blocks along the dimension direction to update the nearest feature point of each pixel in the combined image sub-blocks until the nearest feature point of each pixel in the whole image is obtained, and then calculating the Euclidean distance from each pixel to the nearest feature point in the image to complete the Euclidean distance transformation of the image. According to the method and the device, each pixel can search the nearest feature point in each dimension more quickly, a large amount of irrelevant calculation in the existing method and device is avoided, the calculation complexity is reduced, and the calculation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of graphics and image processing technology, and in particular to a method and apparatus for calculating Euclidean distance transformation to enhance local perception. Background Technology

[0002] The Euclidean Distance Transform (EDT) is a method for calculating the distance from any pixel in an image of any dimension to its nearest feature point, given a set of pixels as feature points. Euclidean distance transform is one of the fundamental methods for constructing distance fields and is widely used in image segmentation, skeleton extraction, path planning, and other scenarios.

[0003] There are many methods for calculating EDT in related technologies. For example, a fast calculation method based on template propagation first constructs a local EDT calculation template, then scans and moves this template across the image to quickly perform the Euclidean distance transformation. This method has high computational efficiency, but its distance calculation is only an approximation. Currently, there is an increasing demand for high-quality applications that require accurate EDT calculation; approximate distance calculation methods are insufficient to meet these needs.

[0004] Current methods for accurately calculating the EDT include methods that perform synchronous equidistant diffusion propagation from the feature point as the center, methods that process sequentially dimension by dimension based on dimensionality decomposition, and methods that process in parallel on each dimension. Among these, the former method has high computational complexity, typically O(n log n). or ,in The latter two methods can reduce the computational complexity to the number of pixels in the image; However, these methods process data dimension by dimension during computation. For example, if the nearest feature point of a pixel needs to be determined through processing in a later dimension, the related computations in the preceding dimensions are wasted. This wasted computation severely restricts the efficiency improvement of EDT computation, especially when processing large-scale, high-resolution images and images with sparse and uneven distribution of feature pixels. This limitation on the efficiency improvement of EDT computation will affect the efficient completion of subsequent tasks such as image segmentation and path planning. Summary of the Invention

[0005] In view of this, the present application provides a method and apparatus for calculating Euclidean distance transformation to enhance local perception, so as to solve the problems of high computational complexity and low computational efficiency of Euclidean distance transformation in the prior art.

[0006] A first aspect of this application provides a method for calculating Euclidean distance transformation to enhance local perception, comprising:

[0007] Step S101: Divide the N-dimensional image to be processed into intervals along the N dimensions to obtain M image sub-blocks; where N and M are both positive integers greater than 1.

[0008] Step S102: Calculate the nearest feature point of each pixel in its respective image sub-block;

[0009] Step S103: Merge each image sub-block, and calculate and update the nearest feature points of each pixel in the merged image sub-block based on the nearest feature points of each pixel in the merged image sub-block during each merger, until the merged image sub-block is a complete image to be processed; wherein, the nearest feature points of each pixel in the merged image sub-block are determined by performing a validity check on the union of the nearest feature points of each pixel in the merged image sub-block.

[0010] Step S104: Calculate the Euclidean distance from each pixel to its nearest feature point based on the nearest feature point of each pixel in the complete image to be processed, and complete the global Euclidean distance transformation (EDT) of the image.

[0011] A second aspect of this application provides an Euclidean distance transformation calculation apparatus for enhanced local perception, comprising:

[0012] The interval partitioning module is configured to partition the N-dimensional image to be processed into intervals along N dimensions, resulting in M ​​image sub-blocks; where N and M are both positive integers greater than 1.

[0013] The calculation module is configured to calculate the nearest feature point of each pixel in its respective image sub-block;

[0014] The merging module is configured to merge image sub-blocks and, during each merge, calculate and update the nearest feature points of each pixel in the merged image sub-block based on the nearest feature points of each pixel in the merged image sub-block, until the merged image sub-block is a complete image to be processed; wherein, the nearest feature points of each pixel in the merged image sub-block are determined by performing a validity check on the union of the nearest feature points of each pixel in the merged image sub-block;

[0015] The determination module is configured to calculate the Euclidean distance from each pixel to its nearest feature point based on the nearest feature point of each pixel in the complete image to be processed, and to complete the global Euclidean distance transformation (EDT) of the image.

[0016] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.

[0017] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0018] The beneficial effects of this application embodiment compared with the prior art are as follows: This application embodiment divides the N-dimensional image to be processed into multiple image sub-blocks by dividing it into intervals along each dimension. First, within each image sub-block, processing is performed dimension-by-dimensionally to calculate the nearest feature point of each pixel within that sub-block. Then, the image sub-blocks are gradually merged along the dimensional direction to update the nearest feature points of each pixel in the merged sub-block, until the nearest feature points of each pixel in the entire image are obtained. The Euclidean distance from each pixel to its nearest feature point is then calculated, completing the Euclidean distance transformation of the image. When merging the nearest feature points of image sub-blocks, the nearest feature points associated with each pixel can be updated first along the dimension being merged, and then updated along other dimensions until all dimensions are updated. This method and apparatus enable each pixel to search for its nearest feature point in each dimension more quickly, avoiding a large amount of irrelevant calculations in existing methods and apparatuses, reducing computational complexity and improving computational efficiency. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating a method for calculating Euclidean distance transformation to enhance local perception, provided in an embodiment of this application.

[0021] Figure 2 This is a schematic diagram of local pixels and feature points of the Euclidean distance transformation calculation method for enhanced local perception provided in the embodiments of this application.

[0022] Figure 3 This is a schematic diagram of a method for merging image sub-blocks provided in an embodiment of this application.

[0023] Figure 4 This is a flowchart illustrating a method for dividing an N-dimensional image to be processed into intervals along N dimensions, as provided in an embodiment of this application.

[0024] Figure 5 This is a flowchart illustrating the method for calculating the nearest feature point of each pixel in its respective image sub-block, as provided in the embodiments of this application.

[0025] Figure 6 This is a schematic diagram of local pixels and feature points of another Euclidean distance transformation calculation method for enhancing local perception provided in an embodiment of this application.

[0026] Figure 7 This is a flowchart illustrating the method provided in this application for iteratively calculating the nearest feature point of each pixel when processing the (i+1)th dimension within its respective image sub-block based on the nearest feature point of each pixel after processing the i-th dimension.

[0027] Figure 8 This is a schematic diagram of local pixels and feature points of another Euclidean distance transformation calculation method for enhancing local perception provided in the embodiments of this application.

[0028] Figure 9 This is a schematic diagram illustrating the validity check of the nearest feature points of each pixel in each merged image sub-block provided in an embodiment of this application.

[0029] Figure 10 This diagram illustrates the experimental results of performing calculations on a 2D feature uniformly distributed image experimental dataset using the method provided in the embodiments of this application and a comparative method.

[0030] Figure 11 This diagram illustrates the experimental results of performing calculations on a 2D feature-nonuniformly distributed image experimental dataset using the method provided in the embodiments of this application and a comparative method.

[0031] Figure 12 This diagram illustrates the experimental results of performing calculations on a 3D feature uniformly distributed image experimental dataset using the method provided in the embodiments of this application and a comparative method.

[0032] Figure 13 This diagram illustrates the experimental results of performing calculations on a 3D feature non-uniformly distributed image experimental dataset using the method provided in the embodiments of this application and a comparative method.

[0033] Figure 14 This diagram illustrates the experimental results regarding computational efficiency of the method provided in this application and the comparative method on a 2D feature uniformly distributed image experimental dataset.

[0034] Figure 15 This diagram illustrates the experimental results regarding computational efficiency of the method provided in this application and the comparative method on a 2D feature non-uniformly distributed image experimental dataset.

[0035] Figure 16 This diagram illustrates the experimental results regarding computational efficiency of the method provided in this application and the comparative method on a 3D feature uniformly distributed image experimental dataset.

[0036] Figure 17 This diagram illustrates the experimental results regarding computational efficiency of the method provided in this application and the comparative method on a 3D feature non-uniformly distributed image experimental dataset.

[0037] Figure 18 This is a schematic diagram illustrating experimental results regarding computational efficiency of another method provided in this application and a comparative method on a 2D feature uniformly distributed image experimental dataset.

[0038] Figure 19 This is a schematic diagram of experimental results regarding computational efficiency of another method provided in the embodiments of this application and a comparative method on a 2D feature non-uniform distribution map experimental dataset.

[0039] Figure 20 This is a schematic diagram illustrating experimental results regarding computational efficiency of another method provided in this application and a comparative method on a 3D feature uniformly distributed image experimental dataset.

[0040] Figure 21 This is a schematic diagram of experimental results regarding computational efficiency of another method provided in the embodiments of this application and a comparative method on a 3D feature non-uniformly distributed image experimental dataset.

[0041] Figure 22 This is a schematic diagram of an Euclidean distance transformation calculation device for enhancing local perception provided in an embodiment of this application.

[0042] Figure 23 This is a schematic diagram of the electronic device provided in the embodiments of this application. Detailed Implementation

[0043] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0044] The following will describe in detail, with reference to the accompanying drawings, a method and apparatus for calculating Euclidean distance transformation to enhance local perception according to embodiments of this application.

[0045] As mentioned above, the EDT calculation methods in related technologies either have high computational complexity or low computational efficiency.

[0046] In view of this, embodiments of this application provide a method for calculating Euclidean distance transformation to enhance local perception. This method involves dividing the N-dimensional image to be processed into multiple image sub-blocks along various dimensions. First, within each image sub-block, processing is performed dimension-by-dimensionally to calculate the nearest feature point of each pixel within that sub-block. Then, the image sub-blocks are progressively merged along the dimensional direction to update the nearest feature points of each pixel in the merged sub-block, until the nearest feature points of each pixel in the entire image are obtained. Finally, the Euclidean distance from each pixel to its nearest feature point is calculated, completing the Euclidean distance transformation of the image. When merging the nearest feature points of image sub-blocks, the nearest feature points associated with each pixel can be updated first along the dimension being merged, and then updated along other dimensions until all dimensions are updated. This method and apparatus enable each pixel to search for its nearest feature point in each dimension more quickly, avoiding a large amount of irrelevant computation in existing methods and apparatuses, reducing computational complexity and improving computational efficiency.

[0047] Figure 1 This is a flowchart illustrating a method for calculating Euclidean distance transformation to enhance local perception, provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps:

[0048] In step S101, the N-dimensional image to be processed is divided into intervals in N dimensions to obtain M image sub-blocks.

[0049] Where N and M are both positive integers greater than 1.

[0050] In step S102, the nearest feature point of each pixel in its respective image sub-block is calculated.

[0051] In step S103, each image sub-block is merged, and the nearest feature point of each pixel in the merged image sub-block is calculated and updated based on the nearest feature point of each pixel in the merged image sub-block during each merge, until the merged image sub-block is a complete image to be processed.

[0052] The nearest feature point of each pixel in the merged image sub-block is determined by validating the union of the nearest feature points of each pixel in the merged image sub-block.

[0053] In step S104, the Euclidean distance from each pixel to its nearest feature point is calculated based on the nearest feature point of each pixel in the complete image to be processed, thus completing the global EDT of the image.

[0054] In some embodiments of this application, the method may be executed by a server or by a terminal device with certain processing capabilities.

[0055] In some embodiments of this application, the N-dimensional image to be processed can be divided into intervals along N dimensions to obtain M image sub-blocks. Then, within each image sub-block, the nearest feature point of each pixel in the image sub-block within its own image sub-block is calculated dimension by dimension.

[0056] In some embodiments of this application, when calculating the nearest feature point of each pixel in each image sub-block dimension by dimension, a feature point sequence on each scan line of the first dimension can be calculated first within each image sub-block. This feature point sequence on each scan line of the first dimension includes the nearest feature point corresponding to each pixel on each scan line within the image sub-block. In other words, the nearest feature point corresponding to each pixel on each scan line of the first dimension can be determined by scanning, and the nearest feature points are used to form the feature point sequence on each scan line of the first dimension.

[0057] The selection of the first dimension can be set according to actual needs. For example, a dimension with fewer feature points can be selected as the first dimension, or other dimensions can be selected as the first dimension; there are no restrictions here.

[0058] In some embodiments of this application, starting from the second dimension, the nearest feature point of each pixel within each image sub-block in the next dimension can be iteratively calculated based on the calculation results of the previous dimension. In some examples, the nearest feature point corresponding to each pixel within each image sub-block on each scan line in the image sub-block can be updated iteratively from the second to the Nth dimensions.

[0059] In some embodiments of this application, after calculating the nearest feature point of each pixel in each image sub-block, the image sub-blocks can be merged, and the nearest feature point of each pixel in the merged image sub-block can be calculated and updated based on the nearest feature point of each pixel in the merged image sub-block during each merging, until the merged image sub-block is a complete image to be processed.

[0060] In some implementations, image sub-blocks can be merged along a first dimension first, and the union of the nearest feature points of each pixel in the merged image sub-block can be determined as the nearest feature points of each pixel in the merged image sub-block. Then, the validity of the nearest feature points of each pixel in the merged image sub-block is checked, and the updated nearest feature points of each pixel in the merged image sub-block are obtained based on the check results. Next, the operations of merging image sub-blocks dimension-wise, checking the validity of the nearest feature points of each pixel in the merged image sub-block, and updating the nearest feature points of each pixel in the merged image sub-block based on the check results are iteratively performed until the merged image sub-blocks constitute a complete image to be processed.

[0061] Finally, the Euclidean distance from each pixel to its nearest feature point can be calculated based on the nearest feature point of each pixel in the complete image to be processed, thus completing the global EDT of the image.

[0062] According to the technical solution provided in the embodiments of this application, the N-dimensional image to be processed is divided into multiple image sub-blocks along various dimensions. First, within each image sub-block, processing is performed dimension-by-dimensionally to calculate the nearest feature point of each pixel within that sub-block. Then, the image sub-blocks are progressively merged along the dimensional direction to update the nearest feature point of each pixel in the merged sub-block, until the nearest feature point of each pixel in the entire image is obtained. Finally, the Euclidean distance from each pixel in the image to its nearest feature point is calculated, completing the Euclidean distance transformation of the image. When merging the nearest feature points of image sub-blocks, the nearest feature points associated with each pixel can be updated first along the dimension being merged, and then updated along other dimensions until all dimensions are updated. This method and apparatus enable each pixel to search for its nearest feature point in each dimension more quickly, avoiding a large amount of irrelevant computation in existing methods and apparatuses, reducing computational complexity and improving computational efficiency.

[0063] Figure 2 This is a schematic diagram of local pixels and feature points in the Euclidean distance transform calculation method for enhanced local perception provided in the embodiments of this application. For example... Figure 2 As shown, if the traditional EDT calculation strategy based on dimensional decomposition and progressive processing is used, the lines parallel to the X-axis can be processed first. In this case, the nearest feature point P of pixel A is located on the same scan line, so the distance between pixel A and feature point P is calculated and stored. Then, the lines parallel to the Y-axis are processed. The nearest feature point of pixel A can then be identified as feature point Q via pixel B. Thus, the calculation of point P is wasted for the EDT calculation of pixel A.

[0064] Using the technical solution provided in the embodiments of this application, the image can first be divided into multiple image sub-blocks in various dimensions, then local EDT calculations are performed in each dimension in each image sub-block, and finally the local EDT calculation results of adjacent image sub-blocks are gradually merged and updated to obtain the EDT calculation result of the entire image.

[0065] Specifically, by performing local EDT calculations for each dimension within each image sub-block, only the nearest feature point of each pixel in each sub-block needs to be calculated, without needing to calculate the EDT value. After merging to obtain the nearest feature points of each pixel in the complete image, the EDT of the complete image is then calculated based on the nearest feature points of each pixel in the complete image.

[0066] In other words, in some embodiments of this application, each pixel of an image sub-block stores the coordinates of its nearest feature point in the image sub-block, without calculating and storing the distance from each pixel to its nearest feature point.

[0067] Still referencing Figure 2 For an image sub-block defined by a dotted line, pixel A can determine its nearest feature point Q within its sub-block without processing feature point P. However, for an image sub-block defined by a broken dotted line, pixel A's sub-block may not contain any feature points, but by merging its sub-block with the sub-block below it, pixel A can determine its nearest feature point Q without processing feature point P.

[0068] Of course, the image sub-block containing pixel A may first be merged with the image sub-block to its right. In this case, feature point P is taken as the nearest feature point, and then it is merged with the image sub-block below to obtain the true nearest feature point Q. Overall, this processing can enhance local perception, allowing each pixel to search in various dimensions in its vicinity and find its nearest feature point more quickly, at least without requiring more searches than existing methods.

[0069] Figure 3 This is a schematic diagram illustrating a method for merging image sub-blocks provided in an embodiment of this application. For example... Figure 3 As shown, taking the two-dimensional case as an example, when merging image sub-blocks, sub-blocks can be merged pairwise along the X-axis direction, such as... Figure 3 Each dashed ellipse shown represents two sub-blocks. Each dashed ellipse signifies a horizontal merge operation.

[0070] Then, sub-blocks can be merged pairwise along the Y-axis, such as... Figure 3 Each solid-line ellipse shown corresponds to one of the merged sub-blocks generated in the previous step, along with two dashed-line ellipses. Each solid-line ellipse represents one vertical merging operation.

[0071] Figure 4 This is a flowchart illustrating a method for dividing an N-dimensional image to be processed into intervals along N dimensions, as provided in an embodiment of this application. For example... Figure 4 As shown, the method includes the following steps:

[0072] In step S401, scan lines are set in each dimension.

[0073] In step S402, the distance between all adjacent feature points on each scan line in dimension k of the N-dimensional image to be processed is counted.

[0074] Where k is a positive integer greater than or equal to 1 and less than or equal to N.

[0075] In step S403, the average value of the above spacing is calculated.

[0076] In step S404, the average value is used as the sub-block division scale for dimension k.

[0077] In some embodiments of this application, an adaptive partitioning strategy can be adopted to improve the efficiency of interval partitioning. For each dimension of the image to be processed, scan lines can be set in that dimension, the distances between adjacent feature points on each scan line in that dimension can be counted, and the average value of these distances can be calculated. Then, this average value is used as the sub-block partitioning scale for that dimension. In some embodiments, this average value can also be appropriately adjusted as the sub-block partitioning scale for that dimension.

[0078] Understandably, other methods can be used to divide the image into sub-blocks in practical applications. The mathematical expectation that needs to be met during division is that each resulting image sub-block contains fewer feature points, such as a large number of empty sub-blocks and sub-blocks containing only one feature point. This can significantly reduce the overhead of the initial computation stage.

[0079] Figure 5 This is a flowchart illustrating a method for calculating the nearest feature point of each pixel within its respective image sub-block, as provided in an embodiment of this application. Figure 5 As shown, the method includes the following steps:

[0080] In step S501, a scan line is set in the first dimension.

[0081] In step S502, each feature point is scanned sequentially on each scan line in the first dimension, and the coordinate values ​​of each feature point in the first dimension are recorded. The feature points are then arranged in order based on their coordinate values ​​in the first dimension.

[0082] In step S503, the midpoint of each adjacent feature point is calculated and recorded.

[0083] In step S504, the endpoints and midpoints of the scan lines are used as dividing points, and the nearest feature point of the pixel between any two adjacent dividing points is determined as the feature point located between the two adjacent dividing points.

[0084] In step S505, the feature point sequence on each scan line of the first dimension is determined based on the nearest feature point of each pixel within the image sub-block.

[0085] In step S506, the nearest feature point of each pixel after processing the i-th dimension is iteratively calculated when processing the i+1-th dimension within the image sub-block, until i+1 equals N.

[0086] Where i = 1, ..., N-1.

[0087] In some embodiments of this application, when calculating the first dimension feature point sequence within each image sub-block, a scan line can be set in the first dimension firstly, and then scanned sequentially on each scan line to record the coordinate values ​​of each feature point in the first dimension, and the feature points can be arranged in order based on the coordinate values ​​of each feature point in the first dimension.

[0088] Next, the midpoints of each adjacent feature point are calculated and recorded. Using the endpoints of the scan line and each midpoint as the dividing points, the nearest feature point of the pixel between any two adjacent dividing points is determined as the feature point located between the two adjacent dividing points. Then, the first dimension feature point sequence is determined based on the nearest feature point of each pixel within each image sub-block.

[0089] Furthermore, the nearest feature point of each pixel after processing the i-th dimension can be iteratively calculated when processing the i+1-th dimension within the image sub-block, until i+1 equals N.

[0090] It is understandable that the nearest feature point after processing the i-th dimension of the image sub-block is actually the nearest feature point of each pixel in the image sub-block corresponding to the feature points of the first to i-th dimensions. That is, the nearest feature point after processing the i-th dimension of the image sub-block is determined based on the comprehensive feature points of each pixel in the image sub-block corresponding to the first to i-th dimensions.

[0091] Figure 6 This is a schematic diagram of local pixels and feature points in another Euclidean distance transform calculation method for enhanced local perception provided in an embodiment of this application. For example... Figure 6 As shown, if we take the dimension parallel to the Y-axis as the first dimension, y L If a scan line is defined in the first dimension, then the search can be performed by scanning according to the y-coordinate values ​​of each pixel in the scan line from largest to smallest. L Feature points are identified online, and these feature points are sorted according to their y-coordinate values. Then, the midpoint between adjacent feature points is calculated to obtain the y-coordinate. L Store the nearest feature points for each pixel online.

[0092] For example, it can be in y L The scan proceeds from top to bottom along the line until the first feature point F5 is encountered. At this point, the nearest feature points of all scanned pixels are stored as F5. The scan continues, recording the nearest feature points of all passed pixels as F5, until the second feature point F6 is encountered. The midpoint M between F5 and F6 is found, and the nearest feature point of all pixels between M and F6 is updated to F6. The scan then continues from feature point F6, updating the nearest feature point of each point to F6, until the scan is complete.

[0093] Compared to traditional methods that use two round trips to initialize the first dimension, the method provided in this application only performs one scan, which can reduce a lot of computation and memory access operations.

[0094] The scanning direction can be set as needed, for example, scanning from small to large according to the y-coordinate value.

[0095] Figure 7 This is a flowchart illustrating the method provided in this application for iteratively calculating the nearest feature point of each pixel after processing the i-th dimension, when processing the (i+1)-th dimension within its respective image sub-block, based on the nearest feature points of each pixel after processing the i-th dimension. For example... Figure 7 As shown, the method includes the following steps:

[0096] In step S701, a scan line is set in the (i+1)th dimension.

[0097] In step S702, each pixel is scanned sequentially on each scan line of the (i+1)th dimension, and the candidate feature point sequence corresponding to the current scan line is obtained based on the nearest feature point after processing the i-th dimension stored in these pixels.

[0098] In this sequence, each feature point in the candidate feature point sequence is arranged in order of its coordinate values ​​in the (i+1)th dimension.

[0099] In step S703, the validity of each feature point in the candidate feature point sequence is checked, and the candidate feature point sequence is updated based on the check results.

[0100] In step S704, an auxiliary graph is drawn for the connection between each adjacent feature point in the updated candidate feature point sequence, and the intersection of the auxiliary graph and the scan line is calculated.

[0101] The auxiliary figure can be any one of the following: a perpendicular bisector, a perpendicular bisector plane, or a perpendicular bisector hyperplane.

[0102] In step S705, the endpoints and intersections of the scan line are used as boundary points. The nearest feature point after pixel update between any two adjacent boundary points is determined as the feature point located between the two adjacent boundary points, thereby completing the update of the nearest feature point of each pixel in the scan line after the (i+1)th dimension of the image sub-block processing.

[0103] In some embodiments of this application, when iteratively calculating the nearest feature point of each pixel after processing the i-th dimension within the i+1-th dimension based on the nearest feature point of each pixel after processing the i-th dimension, a scan line can be set in the i+1-th dimension first, and then each pixel can be scanned sequentially on each scan line. Based on the nearest feature point after processing the i-th dimension stored in these pixels, the candidate feature point sequence corresponding to this scan line can be obtained.

[0104] Next, the validity of each feature point in the candidate feature point sequence is checked, and the candidate feature point sequence is updated based on the check results. An auxiliary graph is then drawn for the connection between adjacent feature points in the updated candidate feature point sequence, and the intersection of the auxiliary graph with the scan line is calculated. Finally, using the endpoints of the scan line and each intersection point as boundary points, the nearest updated feature point between any two adjacent boundary points is determined as the feature point located between the two adjacent boundary points. This completes the update of the nearest feature point for each pixel in the scan line after processing the (i+1)th dimension of the image sub-block.

[0105] Still referencing Figure 6 When processing the second dimension parallel to the X-axis, the scan line x can be... L Scan according to x-coordinate values ​​from smallest to largest, search x L The feature points of each pixel in the online array were stored during the processing in the previous dimension and are arranged in order according to the x-coordinate values ​​of each feature point. For example... Figure 6 As shown, the five arranged feature points can form a candidate feature point sequence {F1, F2, F3, F4, F5}.

[0106] The validity of each feature point in the candidate feature point sequence can be checked, and the candidate feature point sequence can be updated based on the check results. In some examples, feature points that fail the validity check can be removed, that is, feature points that are confirmed as invalid by the validity check are removed, and only feature points that are confirmed as valid by the validity check are retained, resulting in an updated candidate feature point sequence.

[0107] Then, the updated candidate feature point sequence is sorted according to its x-coordinate value, and the perpendicular bisector of the line connecting adjacent feature points is calculated. L The intersection of the lines yields the following: Figure 8 Point x shown 13 x 34 and x 45 Finally, based on that point x 13 x 34 and x 45 Determine x L Store the nearest feature points for each pixel online.

[0108] The scanning direction can be set as needed, for example, scanning from large to small according to the y-coordinate value.

[0109] In some embodiments of this application, the validity verification of each feature point in the candidate feature point sequence can be implemented using a local Vinograph verification method, which includes:

[0110] Sort the candidate feature points in the sequence from smallest to largest according to their coordinate values ​​along the current processing dimension. For any three feature points F arranged in this order... j-1< F j < F j+1 j is an integer greater than or equal to 0 and less than m, where m is the number of feature points in the candidate feature point sequence. The feature point F is calculated. j With feature point F j-1 Auxiliary graph I0, and feature point F j With feature point F j+1 The auxiliary graphic I1 is used; the first intersection point a0 between I0 and the current scan line, and the second intersection point a1 between I1 and the current scan line are determined; if the coordinate value of a0 in the current dimension is greater than the coordinate value of a1 in the current dimension, then the feature point F is determined. j Invalid feature points are identified, and feature point F is removed from the candidate feature point sequence. j The above steps are executed iteratively until all feature points in the candidate feature point sequence have been traversed and no feature points can be removed.

[0111] In one example, suppose the candidate feature point sequence is (F0, F1, F2, ..., F... m Let m be a positive integer greater than 1. Taking j=1 as an example, we can first calculate the perpendicular bisectors or perpendicular bisectors or perpendicular hyperplanes I0 of F0 and F1, and the perpendicular bisectors or perpendicular bisectors or perpendicular hyperplanes I1 of F1 and F2. The intersection of I0 and the current scan line is determined as the first intersection point a0, and the intersection of I1 and the current scan line is determined as the second intersection point a1. If a0 > a1, then F1 is determined to be an invalid feature point, and F1 is removed from the candidate feature point sequence. Otherwise, F1 is retained. Repeat the above steps until the candidate feature point sequence is traversed to complete the validity check of the candidate feature point sequence.

[0112] It is understandable that for the first and last feature points F0 and F in the candidate feature point sequence... m These can all be considered as valid feature points.

[0113] Still referencing Figure 6 This allows for the validity test of a candidate feature point sequence consisting of feature points F1, F2, F3, F4, and F5. The perpendicular bisector of the line connecting F1 and F2 intersects x. L The intersection of the lines is x 12 The perpendicular bisector of the line connecting F2 and F3 intersects x. L The intersection of the lines is x 23 The perpendicular bisector of the line connecting F3 and F4 intersects x. L The intersection of the lines is x 34 The perpendicular bisector of the line connecting F4 and F5 intersects x. L The intersection of the lines is x 45 Because x 12 > x 23Therefore, F2 is an invalid feature point, and it is removed from the candidate feature point sequence.

[0114] In some embodiments of this application, validating the union of the nearest feature points corresponding to the local EDT of each merged image sub-block may include determining the penetrating line of the merged image sub-block; the penetrating line is a scan line that passes through each merged image sub-block along the merging direction of the image sub-block; and using the union of the nearest feature points of each pixel of the merged image sub-block as a candidate feature point sequence, and performing a validity check using the method provided above.

[0115] In some embodiments of this application, the operation of merging image sub-blocks can also be performed dimension-by-dimensionally. When merging image sub-blocks dimension-by-dimensionally, the dimension processing order and the number of image sub-blocks to be merged can be selected as needed. In some examples, adjacent image sub-blocks can be merged pairwise dimension-by-dimensionally.

[0116] For example, we can first merge each image sub-block pairwise along the X-axis, and then merge the newly generated larger image sub-blocks pairwise along the Y-axis. When merging two adjacent image sub-blocks, the core method is to update the sequence of feature points on the line that runs through the two sub-blocks.

[0117] In other words, a line that runs through each merged image sub-block along the merging direction can be defined as a piercing line. For each piercing line, the original feature point sequences in the two image sub-blocks can be merged first. Since the original local validity of each merged image sub-block may be broken after merging, it is necessary to start from the boundary of the merged image sub-blocks and extend towards both ends to check the validity of the feature points, in order to remove feature points that become invalid in the new, larger image sub-block space. The validity check can still be implemented based on the local Vino map of each feature point.

[0118] Figure 9 This is a schematic diagram illustrating the validity check of the nearest feature points of each pixel in each merged image sub-block, provided in an embodiment of this application. For example... Figure 9 As shown in the attached diagram on the left, before the blocks are merged, the nearest feature points of each pixel in image sub-block ① may include feature points F1, F2 and F3, and the nearest feature points of each pixel in image sub-block ② may include feature points F4 and F5. At this time, the candidate feature point sequence of the image after merging image sub-block ① and image sub-block ② is F1, F2, F3, F4 and F5.

[0119] The candidate feature point sequence was validated, and feature point F3 was determined to be an invalid feature point. Therefore, it was removed, resulting in the following sequence: Figure 9The merged and updated image sub-block shown in the right-hand figure contains valid feature points F1, F2, F4, and F5 in the updated candidate feature point sequence. The nearest feature point of each pixel in the merged image sub-block is recalculated based on the updated candidate feature point sequence, thereby obtaining the nearest feature point of each pixel in the merged image sub-block.

[0120] Once all sub-blocks are merged, the nearest feature point of each pixel in the entire image to be processed is obtained, and the EDT of the image to be processed can then be calculated based on the nearest feature point.

[0121] Compared to traditional methods that calculate the distance to the nearest feature point pixel by pixel in each dimension, the embodiments of this application only divide the image space and calculate the perpendicular bisectors, perpendicular bisector planes, or perpendicular bisector hyperplanes of adjacent feature points in each candidate feature point sequence, without traversing pixels, thereby obtaining the local EDT with higher computational efficiency.

[0122] Furthermore, the technical solution provided in this application only stores and updates the coordinate information of the nearest feature point known to each pixel within the sub-block, without calculating and storing the actual distance value from each pixel to its nearest feature point, so as to save unnecessary computation and space overhead.

[0123] Meanwhile, when the space is properly partitioned, most sub-blocks contain only one or zero feature points, and no EDT calculation is required inside these sub-blocks, at which point the efficiency improvement is most significant.

[0124] To verify the technical solutions provided in the embodiments of this application, the following experiment was designed:

[0125] Considering that the performance of this application embodiment is closely related to the proportion of image feature points, spatial distribution characteristics, and resolution, multiple synthetic datasets of various dimensions and scales were designed and generated in the experiment to better cover the testing requirements under different application scenarios. The specific construction process is as follows:

[0126] The dataset is constructed around three independent variables, as follows:

[0127] 1) Feature point proportion division: To verify the impact of sparse / dense distribution of feature points on the efficiency of the method, the feature point proportion was divided into 8 continuous intervals, namely (0%, 10%), (10%, 20%), (20%, 30%), (30%, 40%), (40%, 50%), (50%, 60%), (60%, 70%), and (70%, 100%). Each proportion interval corresponds to a set of independent test samples.

[0128] 2) Uniformity of feature point distribution: In order to simulate the spatial clustering effect of feature points in the actual scene, the samples in each proportion interval are further divided into two categories: "uniform distribution" and "non-uniform (Gaussian) distribution". The number of samples in the two distributions is equal to eliminate the bias of distribution characteristics on the experimental results.

[0129] 3) Image resolution coverage: To evaluate the scalability of the method on 2D and 3D images of different scales, five typical resolution levels were selected, covering images from small to very large scales. The specific resolutions and dimensions were defined as follows: 32 (3D: 32×32×32), 64 (3D: 64×64×64), 128 (3D: 128×128×128), 256 (2D: 256×256, 3D: 256×256). 6×256), 512 (2D: 512×512, 3D: 512×512×512), 1024 (2D: 1024×1024, 3D: 1024×1024×1024) , 2048 (2D: 2048×2048, 3D: 2048×2048×2048), 4096 (2D: 4096×4096, 3D: 4096×4096×4096).

[0130] For each resolution level mentioned above, the sample size follows these rules: each feature point percentage interval corresponds to 40 image samples, including 20 2D images and 20 3D images; among the 20 2D / 3D images, there are 10 images with uniformly distributed feature points and 10 images with non-uniformly distributed feature points. Based on this calculation, the total sample size for a single resolution is 8 percentage intervals × 40 images = 320 images. A total of 320 × 5 = 1600 image samples are generated across 5 resolutions, ensuring sufficient samples to support statistical analysis for each variable combination.

[0131] To ensure that the distribution of feature points conforms to preset rules and has randomness, a standardized generation method is adopted for different distribution types. The specific steps are as follows:

[0132] 1) Calculation of the total number of feature points: For images of any resolution and any dimension (2D / 3D), first calculate the total number of feature points |F| based on the total number of pixels n and the proportion P of the target feature points. This ensures that the proportion of feature points strictly falls within the target range, avoiding the impact of quantity deviations on experimental comparisons.

[0133] 2) Uniformly Distributed Feature Point Generation: Uniform random sampling is performed within the complete coordinate range of the image to generate feature point coordinates. For example, a 256×256 2D image is sampled within the integer interval [0, 255]×[0, 255], and a 256×256×256 3D image is sampled within the integer interval [0, 255]×[0, 255]×[0, 255]. A uniform random number generator ensures that the feature points are distributed without bias in space.

[0134] 3) Non-uniform (Gaussian) feature point generation: A multidimensional Gaussian distribution is used to simulate the spatial clustering effect of feature points. The mean μ of the Gaussian distribution is set as the geometric center of the image (e.g., the center of a 256×256 2D image is (127.5, 127.5), and the center of a 256×256×256 3D image is (127.5, 127.5, 127.5)). The standard deviation σ is 1 / 4 of the image side length (e.g., σ=64 for a 256 resolution image and σ=1024 for a 4096 resolution image). This parameter setting ensures that more than 99% of the feature points fall within the image boundary, avoiding invalid samples caused by coordinate overflow, while ensuring that the feature points exhibit obvious central clustering characteristics, which conforms to the non-uniform distribution of feature points in real-world scenarios.

[0135] The enhanced local perception calculation method provided in this application can effectively reduce the number of calculations and increase computational efficiency. Comparable methods include MALEDT (Seung-Lab.euclidean-distance-transform-3d:version2.0.0[CP / OL]. (2020-08-27) https: / / github.com / seung-lab / euclidean-distance-transform-3d / releases / tag / 2.0.0.) and FastGeodis (AsadM, DorentR, VercauterenT. FastGeodis:fastgeneralisedgeodesicdistancetransform[J].arXivpreprintarXiv:2208.00001, 2022).

[0136] Figures 10 to 13 The diagrams illustrate the experimental results of performing relevant calculations on experimental datasets of 2D feature uniformly distributed images, 2D feature non-uniformly distributed images, 3D feature uniformly distributed images, and 3D feature non-uniformly distributed images, respectively, using the methods provided in the embodiments of this application and comparative methods. Figures 10 to 13As shown, the methods provided in this application embodiment can generally reduce the number of calculations, and have a greater advantage in images with larger scale and fewer and unevenly distributed feature points, reducing the amount of computation by up to two orders of magnitude.

[0137] Figures 14 to 17 The diagrams show experimental results regarding computational efficiency obtained using the methods provided in this application and comparative methods on experimental datasets of 2D feature uniformly distributed images, 2D feature non-uniformly distributed images, 3D feature uniformly distributed images, and 3D feature non-uniformly distributed images, respectively. Figures 18 to 21 The diagrams show experimental results regarding computational efficiency of another method provided in this application and a comparative method on experimental datasets of 2D feature uniformly distributed images, 2D feature non-uniformly distributed images, 3D feature uniformly distributed images, and 3D feature non-uniformly distributed images, respectively.

[0138] In most cases, the method provided in this application has a very considerable speedup compared to the comparative method. From Figures 14 to 17 It can be seen that the larger the image size, the greater the speedup of the method provided in this application embodiment. This is because in large-scale images, the additional overhead of calculating global feature points in each dimension in the original method is greater. From Figures 14 to 15 as well as Figures 16 to 17 The comparison shows that the method provided in this application embodiment has a higher speedup ratio for 3D data.

[0139] from Figures 18 to 21 It can be seen that, in the process of gradually increasing the 2D image resolution from 256 to 4096, and in the process of gradually increasing the 3D image resolution from 32 to 512, the method provided in this application embodiment has better speedup performance compared to the comparative method. Furthermore, the speedup ratio also shows an increasing trend as the image resolution increases.

[0140] Furthermore, a comparison was made with an unopened method (Black D, Li W, Zhang Q, et al. Accelerating Euclidean Distance Transforms: A Fastand Flexible Approach With Multi-Vendor GPU, Multi-Threading, and Multi-Language Support [J]. IEEE Access, 2025.). According to the data provided, its performance improvement over FastGeodis on 3D 256x256x256 images averaged approximately 1.5 times. However, according to experimental data, the method provided in this application embodiment can accelerate FastGeodis by more than twice on average. Therefore, generally speaking, the method provided in this application embodiment is faster than the aforementioned method.

[0141] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0142] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0143] Figure 22 This is a schematic diagram of an Euclidean distance transformation calculation device for enhanced local perception provided in an embodiment of this application. Figure 22 As shown, the device includes:

[0144] The interval division module 2201 is configured to divide the N-dimensional image to be processed into intervals in N dimensions to obtain M image sub-blocks; where N and M are both positive integers greater than 1.

[0145] The calculation module 2202 is configured to calculate the nearest feature point of each pixel in its respective image sub-block.

[0146] The merging module 2203 is configured to merge each image sub-block, and to calculate and update the nearest feature points of each pixel in the merged image sub-block based on the nearest feature points of each pixel in the merged image sub-block during each merging, until the merged image sub-block is a complete image to be processed; wherein, the nearest feature points of each pixel in the merged image sub-block are determined by performing a validity check on the union of the nearest feature points of each pixel in the merged image sub-block.

[0147] The determination module 2204 is configured to calculate the Euclidean distance from each pixel to its nearest feature point based on the nearest feature point of each pixel in the complete image to be processed, and to complete the global EDT of the image.

[0148] According to the technical solution provided in the embodiments of this application, the N-dimensional image to be processed is divided into multiple image sub-blocks along various dimensions. First, within each image sub-block, processing is performed dimension-by-dimensionally to calculate the nearest feature point of each pixel within that sub-block. Then, the image sub-blocks are progressively merged along the dimensional direction to update the nearest feature point of each pixel in the merged sub-block, until the nearest feature point of each pixel in the entire image is obtained. Finally, the Euclidean distance from each pixel in the image to its nearest feature point is calculated, completing the Euclidean distance transformation of the image. When merging the nearest feature points of image sub-blocks, the nearest feature points associated with each pixel can be updated first along the dimension being merged, and then updated along other dimensions until all dimensions are updated. This method and apparatus enable each pixel to search for its nearest feature point in each dimension more quickly, avoiding a large amount of irrelevant computation in existing methods and apparatuses, reducing computational complexity and improving computational efficiency.

[0149] In some implementations, the N-dimensional image to be processed is divided into intervals along N dimensions, including: setting scan lines in each dimension; calculating the spacing between all adjacent feature points on each scan line in dimension k of the N-dimensional image to be processed; k is a positive integer greater than or equal to 1 and less than or equal to N; calculating the average of the above spacings; and using the average value as the sub-block division scale for dimension k.

[0150] In some implementations, calculating the nearest feature point of each pixel within each image sub-block includes: setting scan lines in a first dimension; sequentially scanning each scan line in the first dimension, recording the coordinate values ​​of each feature point in the first dimension, and arranging the feature points in order based on their coordinate values ​​in the first dimension; calculating and recording the midpoints of adjacent feature points; using the endpoints of the scan lines and each midpoint as boundary points, determining the nearest feature point of a pixel between any two adjacent boundary points as the feature point located between the two adjacent boundary points; determining the feature point sequence on each scan line in the first dimension based on the nearest feature points of each pixel within the image sub-block; iteratively calculating the nearest feature point of each pixel processed in the i-th dimension when processing the i+1-th dimension within its respective image sub-block, based on the nearest feature points of each pixel processed in the i-th dimension, until i+1 equals N; where i=1, ..., N-1.

[0151] In some implementations, the nearest feature point of each pixel after processing the i-th dimension is iteratively calculated within the image sub-block when processing the i+1-th dimension, including: setting a scan line in the i+1-th dimension; sequentially scanning each pixel on each scan line in the i+1-th dimension, and obtaining a candidate feature point sequence corresponding to the scan line based on the nearest feature points after processing the i-th dimension stored in these pixels; arranging each feature point in the candidate feature point sequence according to the coordinate values ​​of the i+1-th dimension; performing a validity check on each feature point in the candidate feature point sequence, and updating the candidate feature point sequence based on the check results; creating an auxiliary graph for the connection between each adjacent feature point in the updated candidate feature point sequence, and calculating the intersection point of the auxiliary graph with the scan line; wherein the auxiliary graph is any one of a perpendicular bisector, a perpendicular bisector plane, or a perpendicular bisector hyperplane; using the endpoints of the scan line and each intersection point as boundary points, determining the nearest feature point of the pixel after updating between any two adjacent boundary points as the feature point located between the two adjacent boundary points, thereby completing the update of the nearest feature point of each pixel in the scan line after processing the i+1-th dimension of the image sub-block.

[0152] In some implementations, the validity of each feature point in the candidate feature point sequence is checked, including: sorting the feature points in the candidate feature point sequence from smallest to largest along the coordinate values ​​of the current processing dimension; for any three feature points F arranged in this order... j-1 < F j< F j+1 j is an integer greater than or equal to 0 and less than m, where m is the number of feature points in the candidate feature point sequence. The feature point F is calculated. j With feature point F j-1 Auxiliary graph I0, and feature point F j With feature point F j+1 The auxiliary graphic I1 is used; the first intersection point a0 between I0 and the current scan line, and the second intersection point a1 between I1 and the current scan line are determined; if the coordinate value of a0 in the current dimension is greater than the coordinate value of a1 in the current dimension, then the feature point F is determined. j Invalid feature points are identified, and feature point F is removed from the candidate feature point sequence. j The above steps are executed iteratively until all feature points in the candidate feature point sequence have been traversed and no feature points can be removed.

[0153] In some implementations, the validity of the union of the nearest feature points of each pixel in the merged image sub-blocks is checked, including: determining the through line of the merged image sub-blocks; the through line is a scan line that passes through each merged image sub-block along the merging direction of the image sub-blocks; and using the union of the nearest feature points of each pixel in the merged image sub-blocks as a candidate feature point sequence, the validity is checked using the method provided above.

[0154] In some implementations, the pixels of each image sub-block store the coordinates of its nearest feature point in the image sub-block.

[0155] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0156] Figure 23 This is a schematic diagram of the electronic device provided in an embodiment of this application. For example... Figure 23 As shown, the electronic device 23 of this embodiment includes: a processor 2301, a memory 2302, and a computer program 2303 stored in the memory 2302 and executable on the processor 2301. When the processor 2301 executes the computer program 2303, it implements the steps in the various method embodiments described above. Alternatively, when the processor 2301 executes the computer program 2303, it implements the functions of each module / unit in the various device embodiments described above.

[0157] Electronic device 23 may be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 23 may include, but is not limited to, processor 2301 and memory 2302. Those skilled in the art will understand that... Figure 23This is merely an example of electronic device 23 and does not constitute a limitation on electronic device 23. It may include more or fewer components than shown, or different components.

[0158] The processor 2301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0159] The memory 2302 can be an internal storage unit of the electronic device 23, such as a hard disk or RAM of the electronic device 23. The memory 2302 can also be an external storage device of the electronic device 23, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, FlashCard, etc., equipped on the electronic device 23. The memory 2302 can also include both internal and external storage units of the electronic device 23. The memory 2302 is used to store computer programs and other programs and data required by the electronic device.

[0160] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0161] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for computing a local perception enhanced Euclidean distance transform, characterized in that, The method comprises the steps of: S101, dividing an N-dimensional image to be processed in N dimensions respectively to obtain M image sub-blocks; wherein N and M are positive integers greater than 1; S102, calculating the nearest feature point of each pixel in the image sub-block in which the pixel is located; S103, merging the image sub-blocks, and calculating the nearest feature point of each pixel in the merged image sub-block based on the nearest feature points of the pixels in the merged image sub-blocks each time the merging is performed, until the merged image sub-block is the complete image to be processed; wherein the nearest feature point of each pixel in the merged image sub-block is determined by performing validity test on the union of the nearest feature points of the pixels in the merged image sub-blocks; S104, calculating the Euclidean distance from each pixel to its nearest feature point based on the nearest feature points of the pixels in the complete image to be processed, to complete the global Euclidean distance transform (EDT) of the image.

2. The method of claim 1, wherein, The method of dividing an N-dimensional image to be processed in N dimensions respectively comprises the steps of: setting a scanning line in each dimension; counting the distance between all adjacent feature points in each scanning line in dimension k of the N-dimensional image to be processed; k is a positive integer greater than or equal to 1 and less than or equal to N; calculating the average of the distances; using the average as the sub-block division scale of the dimension k.

3. The method of claim 1, wherein, The step S102 comprises: setting a scanning line in the first dimension; sequentially scanning each scanning line in the first dimension, recording the coordinate values of the feature points in the first dimension, and arranging the feature points in order based on the coordinate values of the feature points in the first dimension; calculating and recording the midpoints of the adjacent feature points; using the endpoints of the scanning lines and the midpoints as boundary points, determining the nearest feature point of the pixels between any two adjacent boundary points as the feature point located between the two adjacent boundary points; determining the sequence of the feature points on each scanning line in the first dimension based on the nearest feature points of the pixels inside the image sub-block; iteratively calculating the nearest feature point of each pixel in the image sub-block when processing the (i+1)th dimension based on the nearest feature points of the pixels after processing the ith dimension, until i+1 equals N; wherein i=1, …, N-1.

4. The method of claim 3, wherein, The step of iteratively calculating the nearest feature point of each pixel in the image sub-block when processing the (i+1)th dimension based on the nearest feature points of the pixels after processing the ith dimension comprises: setting a scanning line in the (i+1)th dimension; sequentially scanning the pixels on each scanning line in the (i+1)th dimension, and obtaining the candidate feature point sequence corresponding to the scanning line according to the nearest feature points of the pixels after processing the ith dimension; the feature points in the candidate feature point sequence are arranged in order according to the coordinate values in the (i+1)th dimension; performing validity test on the feature points in the candidate feature point sequence, and updating the candidate feature point sequence based on the test results; drawing an auxiliary graph for the connecting lines of the adjacent feature points in the updated candidate feature point sequence, and calculating the intersection points of the auxiliary graph and the scanning line; wherein the auxiliary graph is any one of a perpendicular bisector, a perpendicular bisector plane, or a perpendicular bisector hyperplane. The end points and the intersection points of the scan line are taken as demarcation points, and the updated nearest feature point between any two adjacent demarcation points is determined as a feature point between the two adjacent demarcation points, so as to complete the nearest feature point updating of each pixel in the scan line after the i+1-dimensional processing of the image sub-block.

5. The method of claim 4, wherein, The effectiveness of each feature point in the candidate feature point sequence is tested, including: The candidate feature point sequence is sorted in ascending order according to the coordinate values along the current processing dimension; for any three sequentially arranged feature points F j-1 < F j < F j+1 , j is an integer greater than or equal to 0 and less than m, m is the number of feature points in the candidate feature point sequence, the feature point F j , the auxiliary graph I0 of the feature point F j-1 , and the auxiliary graph I1 of the feature point F j , and the auxiliary graph I1 of the feature point F j+1 ; The first intersection point a0 of I0 and the current scan line and the second intersection point a1 of I1 and the current scan line are determined. If a0 is greater than a1 in the coordinate value of the current dimension, it is determined that the feature point F j is an invalid feature point, and the feature point F j is removed from the candidate feature point sequence. The above steps are iteratively executed until all feature points in the candidate feature point sequence are traversed and no feature point can be eliminated.

6. The method of claim 1, wherein, The effectiveness of the union set of the nearest feature points of each pixel in the merged image sub-block is tested, including: The through line of the merged image sub-block is determined; the through line is a scan line penetrating each merged image sub-block in the merging direction of the image sub-blocks; The union set of the nearest feature points of each pixel in the merged image sub-block is taken as a candidate feature point sequence, and the method of claim 5 is used for effectiveness testing.

7. The method of claim 1, wherein, The pixels of each image sub-block save the coordinate values of the nearest feature points in the image sub-block.

8. An enhanced local perceptual Euclidean distance transform computing device, characterized by, It includes: The interval division module is configured to divide the N-dimensional image to be processed in N dimensions to obtain M image sub-blocks; wherein N and M are positive integers greater than 1; The calculation module is configured to calculate the nearest feature point of each pixel in the image sub-block in which the pixel is located; The merging module is configured to merge the image sub-blocks, and at each merging time, update the nearest feature point of each pixel in the merged image sub-block based on the nearest feature points of the pixels in the merged image sub-blocks, until the merged image sub-block is the complete image to be processed; wherein the nearest feature point of each pixel in the merged image sub-block is determined by performing effectiveness test on the union set of the nearest feature points of the pixels in the merged image sub-blocks; The determination module is configured to calculate the Euclidean distance from each pixel to its nearest feature point according to the nearest feature points of the pixels in the complete image to be processed, and complete the global Euclidean distance transformation (EDT) of the image.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to realize the steps of the method of any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to realize the steps of the method of any one of claims 1 to 7.