Image edge contour extraction method and device, electronic equipment and storage medium

Through adaptive region division and multi-core parallel scanning methods, reference points are dynamically updated, solving the problem of edge detection results fracture in complex textures or high-noise images, and achieving efficient and continuous image edge contour extraction.

CN120543579AActive Publication Date: 2025-08-26SHENZHEN XINGHUO CNC TECHNOLOGY CO LTD

Patent Information

Application Number
CN202511040032.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-28
Publication Date
2025-08-26
Estimated Expiration
2045-07-28

AI Technical Summary

Technical Problem

When the existing Canny edge detection algorithm processes complex textures or high-noise images, it is easy to cause edge detection results to be broken or discontinuous, making it impossible to accurately capture details, and is difficult to adaptively optimize.

Method used

By adaptively dividing the image, multi-core parallel scanning and multi-distance threshold filtering are used to dynamically update the reference points to form a continuous contour track link list, and filtering and merging across regions are achieved to ensure the continuity and coherence of the contours.

Benefits of technology

It improves the speed and accuracy of image edge contour extraction, and can quickly extract contours from large data volumes and high-resolution images, effectively eliminate noise points, ensure the continuity and coherence of contours, and adapt to changes in different image contents and complex backgrounds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120543579A_ABST
    Figure CN120543579A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image contour extraction, and provides an image edge contour extraction method and device, electronic equipment and a storage medium. Edge detection and region division are carried out on a target image to obtain a region matrix, scanning and contour point screening are carried out on each sub-region to obtain a contour point coordinate chain table of each sub-region, and single-region adjacent point screening is carried out on contour points of each sub-region in combination with a first distance threshold to obtain an initial contour track chain table set; performing cross-region contour fitting point extraction in combination with the boundary of each sub-region to obtain a to-be-verified point data set, and performing cross-region adjacent point screening on the to-be-verified point data set according to a second distance threshold and the region arrangement data to obtain a fitting point combination set, and carrying out cross-region merging on the initial contour track chain table set to obtain an edge contour track chain table set. Through multi-core parallel scanning, multi-distance screening and cross-block fitting technologies, the precision and efficiency of image edge contour extraction are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image contour extraction, and in particular to a method, device, electronic device, and storage medium for extracting image edge contours. Background Art

[0002] Image edge and contour extraction technology is a fundamental component of computer vision and image processing, widely used in target recognition, scene analysis, medical imaging, autonomous driving, and other fields. By accurately extracting the edges and contours of objects, the system can better understand and analyze image content, thereby improving the performance of subsequent recognition, segmentation, and tracking tasks, providing a solid foundation for information extraction in complex environments.

[0003] Among the mainstream image edge contour extraction methods, the Canny edge detection algorithm is widely used due to its high detection accuracy and excellent noise suppression. This algorithm extracts image edge contours through multi-stage processing (such as noise filtering, gradient calculation, non-maximum suppression, and dual-threshold detection). While simple and efficient in practical applications, its overall workflow is relatively rigid, making it difficult to adaptively optimize for different scenarios. When images contain complex textures or high noise, the Canny edge detection algorithm's fixed threshold and global processing methods can easily lead to broken or discontinuous edge detection results, making it difficult to accurately capture details, thus affecting subsequent contour connection and shape reconstruction. Summary of the Invention

[0004] In view of this, the present application provides a method, device, electronic device and storage medium for extracting image edge contours to solve the problems of insufficient accuracy in processing global noise and local details.

[0005] The first aspect of the present application provides a method for extracting image edge contours, the method comprising: Perform edge detection and adaptive region division processing on the received target image to obtain a region matrix; Performing multi-core parallel scanning and contour point screening processing on each sub-region in the region matrix to obtain a contour point coordinate list of each sub-region; Performing single-region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the contour point coordinate chain list to obtain an initial contour trajectory chain list set; Performing cross-region contour fitting point extraction processing on the initial contour trajectory linked list set according to the boundaries of each sub-region to obtain a data set of points to be verified; Performing a cross-region neighboring point screening process on the to-be-verified point dataset according to a preset second distance threshold and the arrangement data of the regions in the region matrix to obtain a fitting point combination set; The initial contour trajectory linked list set is subjected to cross-region merging processing according to the fitting point combination set to obtain an edge contour trajectory linked list set.

[0006] In an optional embodiment, performing edge detection and adaptive region division processing on the received target image to obtain a region matrix includes: Grayscale and noise reduction processing is performed on the received target image to obtain a standardized grayscale image; Performing edge detection processing on the standardized grayscale image to obtain a contour grayscale image; The contour grayscale image is subjected to adaptive region division processing according to a preset segmentation number threshold to obtain the region matrix.

[0007] In an optional embodiment, performing multi-core parallel scanning and contour point screening on each sub-region in the region matrix to obtain a contour point coordinate linked list of each sub-region includes: Performing multi-core parallel scanning and reading of pixel coordinates and pixel values ​​for each sub-region in the region matrix according to a preset scanning order to obtain a coordinate-pixel value mapping table corresponding to each sub-region; Performing contour point screening processing on each sub-region according to a preset color threshold and the coordinate-pixel value mapping table to obtain a contour point coordinate set whose pixel value is greater than the color threshold; The contour point coordinate set is sorted according to the scanning order to obtain a contour point coordinate linked list for each sub-region.

[0008] In an optional embodiment, performing single-region neighboring point screening processing on the contour points of each sub-region according to the preset first distance threshold and the contour point coordinate linked list to obtain the initial contour trajectory linked list set includes: Step S31, performing distance calculation processing on the contour points of each sub-region according to the contour point coordinate linked list to obtain a contour point distance data set of each sub-region; Step S32: extracting the first data from the contour point coordinate linked list to obtain a reference point; Step S33: performing single-region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the reference point to obtain contour connection points whose distance from the reference point is less than or equal to the first distance threshold; Step S34: storing the reference points in a preset contour trajectory linked list, and dynamically updating the reference points according to the contour connection points; Step S35, repeatedly executing steps S33 to S34 until the distance data of the contour points from the data set are all greater than the first distance threshold, so as to obtain an initial contour trajectory linked list; Step S36: performing overlapping data deletion processing on the contour point coordinate chain list according to the initial contour trajectory chain list to update the contour point coordinate chain list; Repeat steps S31 to S36 until the data in the contour point coordinate linked list is cleared, and sort and summarize the data in the initial contour trajectory linked list according to the generation order of the initial contour trajectory linked list to obtain the initial contour trajectory linked list set.

[0009] In an optional embodiment, performing cross-region contour fitting point extraction processing on the initial contour trajectory linked list set according to the boundaries of each sub-region to obtain a data set of points to be verified includes: Performing head and tail data extraction processing on the initial contour trajectory linked list to obtain a contour end coordinate set; Performing distance calculation processing based on the boundary of each sub-region and the contour end coordinate set to obtain a boundary distance data set between the boundary of each sub-region and the contour end; According to a preset boundary distance threshold and the boundary distance data set, the initial contour trajectory linked list set is subjected to cross-region fitting point extraction processing to obtain a data set of points to be verified in each sub-region whose distance from the boundary is less than or equal to the boundary distance threshold.

[0010] In an optional embodiment, the performing cross-region neighboring point screening processing on the to-be-verified point dataset based on the preset second distance threshold and the arrangement data of the regions in the region matrix to obtain the fitting point combination set includes: Performing adjacent region data classification processing on the to-be-verified point data set according to the arrangement data of the regions in the region matrix to obtain a coordinate set of the to-be-verified calibration points; Performing cross-region distance calculation processing on the coordinate set of the calibration points to be verified to obtain a distance set to be verified; The coordinate set of the calibration points to be verified is subjected to cross-region neighboring point screening processing according to a preset second distance threshold and the distance set to be verified, so as to obtain a combination set of fitting points in the distance set to be verified whose distance to be verified is less than or equal to the second distance threshold.

[0011] In an optional embodiment, the method further comprises: Step S71: extracting the head and tail data of the edge contour trajectory linked list set to obtain the head and tail coordinate sets of each edge contour; Step S72: performing distance calculation and distance comparison processing based on the preset starting point coordinates and the first and last coordinate sets to obtain the coordinates of the first execution point with the minimum distance, and performing trajectory chain table data extraction processing on the edge contour trajectory chain table set based on the first execution point coordinates to obtain the first executed edge contour trajectory chain table in the edge contour trajectory chain table set, and using the first executed edge contour trajectory chain table as the current executed edge contour trajectory chain table; Step S73: performing distance calculation and distance comparison processing based on the coordinates of the last contour point in the currently executed edge contour trajectory linked list and the first and last coordinate sets to obtain the coordinates of the second execution point with the minimum distance, and performing trajectory linked list data extraction processing on the edge contour trajectory linked list set based on the second execution point coordinates to obtain the second executed edge contour trajectory linked list in the edge contour trajectory linked list set; Step S74: Deleting data from the first and last coordinate sets according to the second executed edge contour trajectory linked list and the currently executed edge contour trajectory linked list to update the first and last coordinate sets, and using the second executed edge contour trajectory linked list as the currently executed edge contour trajectory linked list. Repeat step S73 to step S74 until the data in the edge contour track linked list is cleared, and sort the edge contour track linked list according to the extraction order to obtain the image edge contour drawing instruction.

[0012] A second aspect of the present application provides a device for extracting an edge contour of an image, the device comprising: An edge detection module is used to perform edge detection and adaptive region division processing on the received target image to obtain a region matrix; A background removal module is used to perform multi-core parallel scanning and contour point screening on each sub-region in the region matrix to obtain a contour point coordinate list of each sub-region; A region contour module, configured to perform single region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the contour point coordinate chain list, so as to obtain an initial contour trajectory chain list set; A point-to-be-verified module is configured to extract cross-region contour fitting points from the initial contour trajectory linked list according to the boundaries of each sub-region, so as to obtain a data set of points to be verified; a fitting verification module, configured to perform a cross-region neighboring point screening process on the to-be-verified point data set according to a preset second distance threshold and the arrangement data of the regions in the region matrix, so as to obtain a fitting point combination set; The contour merging module is used to perform cross-region merging processing on the initial contour trajectory linked list set according to the fitting point combination set to obtain an edge contour trajectory linked list set.

[0013] A third aspect of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for extracting image edge contours as described above when executing the computer program.

[0014] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for extracting image edge contours as described above: In summary, this application has at least the following beneficial technical effects: 1. By dividing the image into multiple areas and using multi-core parallel scanning, the processing speed is greatly improved, and contours can be quickly extracted in large amounts of data and high-resolution images.

[0015] 2. Using a preset first distance threshold, the system filters neighboring points in a single region, dynamically updates reference points, and forms an initial contour trajectory list. Using a preset second distance threshold, it filters neighboring points across regions, thereby achieving smooth connections between contour data across multiple regions. This effectively eliminates noise points and ensures the continuity and coherence of the contour.

[0016] 3. Dynamic update strategy and repeated iteration mechanism are adopted in the process of contour point screening and trajectory updating, so that the extraction results can be adjusted and optimized in real time to adapt to the changing needs of different image contents and complex backgrounds. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0018] Figure 1 This is a flow chart of a method for extracting image edge contours provided by an embodiment of the present application; Figure 2 This is a functional module diagram of a device for extracting image edge contours provided in an embodiment of the present application; Figure 3 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0020] like Figure 1 FIG. 1 is a flow chart of a method for extracting an edge contour of an image provided by an embodiment of the present application. The method for extracting an edge contour of an image provided by an embodiment of the present application includes the following steps.

[0021] Step S1: Perform edge detection and adaptive region division processing on the received target image to obtain a region matrix.

[0022] It should be understood that the received target image is usually a color image, which contains three color channels: red, green, and blue. In order to simplify the image data, the original three-channel data is converted into single-channel data (that is, the color image is converted into a grayscale image), so that subsequent processing only needs to consider the brightness information, reducing the computational complexity. The embodiment of the present application adopts a weighted averaging method to achieve grayscale conversion of the target image. Specifically, for each pixel in the target image, based on the preset contribution weight coefficient of each channel to the brightness, the red, green, and blue channel values ​​of the pixel are weighted and summed to obtain the grayscale value of the pixel. The contribution weight coefficient is based on the measurement result of the human eye's sensitivity to different colors. The multi-channel data is compressed into single-channel data while maintaining the image brightness information.

[0023] After conversion to a grayscale image, the grayscale image may contain noise introduced by factors such as sensor noise and environmental interference, which will have an adverse effect on subsequent edge detection. Furthermore, a noise reduction algorithm is applied to the grayscale image to reduce random noise caused by hardware or environment, thereby ensuring the accuracy of the true edge information in the image. Common noise reduction algorithms include but are not limited to median filtering or Gaussian filtering. For example, the embodiment of the present application uses median filtering to perform grayscale image noise reduction processing, wherein the preset filter window is a 3×3 rectangular window. Starting from the upper left corner of the image, the window is moved row by row and column by column. For each pixel (i, j) as the center of the rectangular window, the grayscale values ​​of all pixels within the rectangular window are extracted to obtain 3×3 grayscale values. The grayscale values ​​within the window are arranged in ascending order, and the value in the middle position after sorting is taken as the median, thereby replacing the original grayscale value of the pixel (i, j) at the center of the window with the median. Furthermore, the denoised grayscale image is normalized to ensure that the pixel values ​​are within a specific range. The embodiment of the present application adopts a linear normalization method to normalize the offset corresponding to the grayscale value of each pixel (i, j) in the image to [0, 1] based on the grayscale value of each pixel in the image being equivalent to the offset from the minimum grayscale value and the range span of the grayscale value in the image. Therefore, according to the offset corresponding to each pixel (i, j) and the target span, the grayscale value of each pixel (i, j) is projected to the target interval to ensure that all image data is within the same numerical range.

[0024] For standardized grayscale images, an edge detection algorithm is further employed to extract edge information, generating a contour grayscale image containing only outline information. Edge detection is used to detect regions within an image where pixel values ​​vary dramatically. These regions typically correspond to object boundaries, shape outlines, or texture faults. Edge detection relies on image gradient information, utilizing changes in local pixel grayscale values ​​to determine edge locations. Commonly used methods include the Sobel operator and the Canny operator. Specifically, the present embodiment employs the Sobel operator to calculate the horizontal and vertical gradient values ​​for each pixel in the standardized grayscale image. By calculating the grayscale changes in the horizontal and vertical directions, the direction and intensity of the edges in the image are determined. Based on the Pythagorean theorem, the composite value of the two-dimensional gradients (i.e., the horizontal and vertical gradient values) is calculated to determine the overall grayscale change intensity for each pixel. Regions with greater intensity are considered candidate edge regions. The composite value for each pixel is then thresholded based on a preset gradient threshold to identify candidate edge points. The gradient threshold is determined empirically or by a preset parameter. Threshold segmentation removes low-intensity gradient regions, retaining only edge information with significant grayscale changes. The image after threshold segmentation is stored as a contour grayscale image. Edge points in a contour grayscale image are typically displayed with high grayscale values ​​(e.g., 255), while non-edge points are displayed with low grayscale values ​​(e.g., 0). This results in a binary or grayscale edge image that reflects the contour information of the target object.

[0025] Ultimately, to improve data processing efficiency and multi-core parallel computing capabilities, the entire contour grayscale image is divided into several subregions based on the number of CPU logical cores. Each subregion can be processed in parallel by an independent processing unit, avoiding the slow processing speed of a single processing unit due to the large amount of data. Specifically, the image pixel width is obtained from the image metadata, and the segmentation width of each subregion is calculated based on the segmentation threshold set by the number of CPU logical cores. The contour grayscale image is then partitioned sequentially according to the segmentation width. Each subregion in the partitioned contour grayscale image corresponds to a continuous horizontal pixel interval. For example, the first subregion is from x pixel coordinate 0 to w-1, and the second subregion is from x pixel coordinate w to 2w-1. If the total width is not divisible by the segmentation threshold, the remaining portion is treated as the last subregion (i.e., the corresponding portion is merged into the last subregion). All subregions obtained by partitioning are sequentially organized into a region matrix. The region matrix is ​​a two-dimensional array or linked list structure, where each element stores the pixel data and position information within the corresponding subregion.

[0026] Step S2: Perform multi-core parallel scanning and contour point screening processing on each sub-region in the region matrix to obtain a contour point coordinate list of each sub-region.

[0027] It should be understood that each sub-region has fixed starting coordinates and sizes in the image. According to the preset scanning order, the pixels in each sub-region are scanned one by one, usually in a left-to-right and top-to-bottom order. The embodiment of the present application adopts multi-core parallel scanning to utilize the parallel computing capabilities of the multi-core processor, distributes the entire region matrix to each independent processing unit, and reads the pixel information in multiple regions at the same time, thereby greatly shortening the overall time of data extraction and improving processing efficiency. Specifically, when scanning, for each pixel point in the sub-region in row priority order, its position is represented by (i, j), where i is the row coordinate, j is the column coordinate, and the pixel value is recorded as I(i, j). Furthermore, during the scanning process, the coordinates of all pixels and the corresponding pixel values ​​are recorded in a mapping table, and each item in the mapping table includes the coordinates (i, j) and the value I(i, j). The coordinates of all pixels in the region and their pixel values ​​are extracted according to the preset scanning order and stored in the mapping table. The generation process of the coordinate-pixel value mapping table must ensure the integrity and non-repetitiveness of the data. Each pixel is recorded only once, and the recording is stored according to the requirements of the data structure. After the data is read, each record in the coordinate-pixel value mapping table contains the position information and pixel value of a single pixel in the sub-area.

[0028] It should be understood that after grayscaling and noise reduction, the pixel values ​​of true contour areas in an image typically exhibit higher grayscale values, while the pixel values ​​of noise and background areas typically exhibit lower values. Furthermore, contour points that meet a specific color threshold condition are extracted from the coordinate-pixel value mapping table. Contour points represent the boundaries of objects or other areas with significant grayscale changes in the image. By comparing the pixel values ​​of each pixel to determine whether they exceed a preset color threshold, points with higher grayscale values ​​are screened. The color threshold is typically determined based on experimental data; for example, 127 is often used as a judgment standard in grayscale images. Specifically, each record in the coordinate-pixel value mapping table is evaluated based on the color threshold. If the pixel value exceeds the color threshold, the point is determined to be a contour point. The entire screening process traverses the coordinate-pixel value mapping table one by one in a preset scanning order, ensuring that all data is judged without omission. Furthermore, when utilizing hardware parallel computing capabilities, each processing unit independently screens the data for its sub-region, ensuring that data does not interfere with each other during the parallel processing and that all qualifying contour points are correctly recorded. The screening results constitute a contour point coordinate set.

[0029] The contour point data in the contour point coordinate set is not spatially ordered. To ensure continuity and sequentiality in the subsequent contour trajectory generation, the contour point data in the contour point coordinate set must be sorted to form an ordered linked list of contour point coordinates. During the sorting process, the data is arranged according to the order previously determined during the scanning process. This ensures that the contour point data extracted within each subregion reflects the true spatial distribution of the image, facilitating subsequent neighbor point screening and trajectory merging. Specifically, each record in the contour point coordinate set is initially sorted based on its row coordinates. If two records have identical row coordinates, a secondary sort is performed based on their column coordinates. The sorting algorithm can employ a stable quick sort, merge sort, or other algorithms suitable for large data volumes to ensure that the sorted data order is consistent with the original scanning order. In implementation, the contour point coordinate set within each subregion is input, and after processing by the sorting algorithm, an ordered linked list structure is output. Each node in this linked list contains the coordinate information of a contour point, and is linked sequentially in a pre-set order to form a continuous data sequence. The sorting algorithm can be further optimized in a parallel computing environment by assigning the sorting tasks of multiple sub-regions to independent cores and uniformly generating a complete ordered linked list (i.e., a linked list of contour point coordinates) during the data merging phase.

[0030] Step S3: performing single-region neighboring point screening processing on the contour points of each sub-region according to the preset first distance threshold and the contour point coordinate linked list to obtain an initial contour trajectory linked list set.

[0031] To clarify the spatial distances between contour points in each subregion, accurately determine which points are spatially close to each other, thereby facilitating the construction of a continuous contour trajectory and avoiding trajectory breakage during subsequent processing due to large distances between adjacent points. The Euclidean distance between each pair of points in each subregion is calculated based on the positions of each point in the contour point coordinate list, generating a dataset describing the distances between points within the subregion (i.e., a contour point distance dataset). It should be understood that in the contour point coordinate list obtained for each subregion, each record contains the pixel row and column coordinates of the point in the image. Based on the laws of Euclidean geometry, the linear distance between each pair of contour points in the contour point coordinate list is calculated on a two-dimensional plane to quantify the spatial relationship between the contour points, thereby generating a contour point distance dataset corresponding to each subregion. This dataset can be stored in a matrix or list format, with each element of the matrix representing the distance between the corresponding two points. Distance calculations use a predetermined scanning order to ensure that the data corresponds to the order of the points in the list. Multi-core parallel technology enables large-scale distance calculations to be distributed across multiple processing units, accelerating overall computation speed. During the calculation process, all distance data are recorded to facilitate the direct search for the distance value between the current reference point and other points in the subsequent neighboring point screening.

[0032] The contour point coordinate list has been sorted according to the preset scanning order, and the first data is usually located at the starting position of the edge of the entire area in space. Therefore, by extracting the first data in the contour point coordinate list, it is possible to ensure that the selected reference point is in a reasonable position in the entire contour point sequence, which is convenient for subsequent judgment based on the distance between it and other points to form a continuous trajectory. Specifically, when traversing the contour point coordinate list, the first node in the list is used as the reference point. During the data extraction process, after the reference point is selected, it is recorded and stored in a preset variable or data structure as the starting point for the current trajectory construction. This reference point is not only used to compare distances with other contour points in the subsequent process, but is also saved as the first node of the initial trajectory list.

[0033] It should be understood that only points that are relatively close to the current reference point can form a continuous and smooth contour trajectory during image rendering. If the distance between connection points is too large, breaks or path discontinuities may occur during image rendering. Furthermore, based on the extracted reference points and the calculated contour point distance dataset, the contour points within the same subregion are screened to identify all points whose distance from the reference point is less than or equal to a preset first distance threshold. These points are then used as contour connection points for the current reference point. Specifically, Euclidean distance data associated with the reference point is obtained from the contour point distance dataset based on the current reference point. After obtaining the Euclidean distance data for each point from the current reference point, all points are screened based on the preset first distance threshold. If a contour point exists whose corresponding Euclidean distance is less than or equal to the first distance threshold, it is identified as a contour connection point for the current reference point. During actual data processing, all contour points within the subregion that meet the above criteria are aggregated into a contour connection point set. This set serves as candidate connection points for the current reference point and directly influences subsequent trajectory extension. A loop traversal approach is used during data processing to ensure that all points are checked.

[0034] Furthermore, the current reference point is recorded in a preset contour trajectory linked list. Based on the previously selected contour connection point set, the reference point is dynamically updated to extend and construct a continuous initial contour trajectory. This process ensures that, starting from the current reference point, contour points that meet the requirements are gradually connected into a continuous trajectory based on proximity. By dynamically updating the reference points, the trajectory is extended until all contour points that meet the requirements in the region are included in the trajectory. Specifically, the current reference point is first stored in a preset contour trajectory linked list, which sequentially stores all points that form the trajectory. The linked list is initially empty. With each update, new reference points are added, ultimately forming a continuous trajectory. The storage process uses a simple data structure insert operation to ensure that the order is maintained and data is not duplicated. Next, the reference point is updated based on the selected contour connection point set. Specifically, a contour branch trajectory linked list is established for each contour connection point in the contour connection point set to ensure that all contour trajectories starting from the current reference point are fully recorded in the system, preventing contour trajectory branches from being missed. For each newly established contour branch trajectory linked list, subsequent neighbor point screening and dynamic update operations are independently performed, further extending each branch. This means that each branch extension process is performed independently, with only the initial branch operations separated to ensure that multiple branches are not omitted due to unified updates. For each branch trajectory, each contour connection point in the contour connection point set is used as the current reference point for that branch. Next, the remaining contour point coordinate linked list is used to select connection points that are adjacent to the updated current reference point. The above process is then repeated to construct a new extension branch or extend the current contour trajectory.

[0035] Furthermore, since the distribution of contour points in the sub-region of the image is usually dense or irregular, all contour points that meet the conditions can be gradually connected through multiple loop updates to form a continuous and complete trajectory. Therefore, the above-mentioned process of screening neighboring points and dynamically updating reference points is executed in a loop until all distances between the remaining contour points in the sub-region and the current reference point are greater than the first distance threshold, thereby completing the construction of a continuous trajectory in a single region and obtaining an initial contour trajectory linked list. In each loop, the distance between the current reference point and the remaining contour points is judged, and the loop is terminated when the condition is met to prevent points that are far apart in space from being mistakenly connected to the trajectory. The specific loop execution process is as follows: At the beginning of each loop, the above operation steps are used to filter the neighboring points based on the distance dataset between the current reference point and the remaining contour points, and all candidate points whose distance from the current reference point does not exceed the first distance threshold are selected; then the trajectory branch is expanded or extended and the reference point is updated through the above operation, and the current reference point is stored in the trajectory linked list; after the update is completed, the neighboring points are filtered again based on the new reference point; if there is a set of contour connection points that meets the filtering conditions, the filtering and updating operations are continued; otherwise, the loop is exited.

[0036] Because multiple independent contour trajectories may exist within each subregion, after each trajectory is constructed (i.e., generating a new initial contour trajectory linked list), used points must be removed from the candidate data (i.e., the contour point coordinate linked list). The remaining points are then used to construct the next trajectory. After each iteration, the updated contour point coordinate linked list is synchronously updated. The constructed initial contour trajectory linked list is compared with the contour point coordinate linked list, and overlapping data is removed to update the contour point coordinate linked list. This prevents the same contour point from being repeatedly included in subsequent trajectory constructions. Furthermore, the initial contour trajectory linked lists generated through multiple iterations are sorted and aggregated according to the order in which they were generated, forming the final set of initial contour trajectory linked lists. Specifically, the initial contour trajectory linked list is compared with the contour point coordinate linked list, and data filtering is used to remove points already in the trajectory linked list from the contour point coordinate linked list. The updated contour point coordinate linked list only contains points that are not included in the current trajectory construction. Next, the technical solution of step S3 is executed again on the updated contour point coordinate linked list until all the data in the contour point coordinate linked list is cleared, that is, all the contour points that meet the conditions in the region have been included in at least one initial trajectory.

[0037] After the loop completes, all generated initial contour trajectory lists are sorted and aggregated. The sorting process follows the order in which each trajectory list was generated, ensuring that the points within each trajectory follow a logical sequence from the starting point to the end. Simultaneously, all individually generated trajectory lists are aggregated into a single set, the initial contour trajectory list set. This set can be structured as a list, array, or other suitable set structure to facilitate subsequent trajectory optimization and cross-region merging.

[0038] It should be understood that after the operations of steps S1 to S3 above, the contour trajectories within each sub-region are identified and represented in the form of an initial contour trajectory linked list. Since part of the edge contour may be divided into different adjacent sub-regions during the process of region division of the entire target image, after the contour trajectories within each sub-region are identified, it is necessary to perform fitting judgment and cross-region merging of the contour trajectories within adjacent sub-regions.

[0039] Step S4: performing cross-region contour fitting point extraction processing on the initial contour trajectory linked list set according to the boundaries of each sub-region to obtain a data set of points to be verified.

[0040] After the sub-regions are divided, each sub-region must have a boundary, and in multiple initial contour trajectory lists, the starting point or end point of some trajectories is often close to the sub-region boundary. These endpoint data play a key role in subsequent cross-region integration and trajectory fitting. The endpoint data reflects the relationship between the trajectory and the sub-region boundary position, and provides accurate boundary information for subsequent cross-region fitting. Specifically, first, each initial contour trajectory list is stored in the form of a data list, which stores several contour points arranged in the order of generation. The list has been generated by the previous step and can better reflect the continuous contour structure in the region. When extracting data, it is required to take at least the first and last nodes of each list. For example, a certain initial contour trajectory list is T={P1,……,P n}, where each point P n =(x k ,y k ) represents the two-dimensional coordinates of the corresponding contour point in the image. The first data P1 and the last data P are extracted from the initial contour trajectory chain table. n , forming the contour endpoint data. All the extracted head and tail data constitute a set ε (i.e., the contour end coordinate set). Each point in the contour end coordinate set represents the possible proximity position of a trajectory to the boundary in the area.

[0041] Furthermore, based on the contour end coordinate set and the boundary information of each sub-region, the vertical distance from the endpoint to the boundary is calculated, thereby forming a data set that describes the relative position relationship between the sub-region boundary and the trajectory endpoint. The distance calculation process uses strict geometric operations to process the boundary data and endpoint data of each sub-region in turn. Specifically, the boundary of each sub-region has been determined in the adaptive region division. For any sub-region, its boundaries usually include the left boundary, the right boundary, the upper boundary and the lower boundary. Assuming that the sub-region is defined as a rectangular area, its boundaries can be determined by four straight lines, specifically described in pixel coordinates. For example, the left boundary coordinate is x=x left , the right boundary is x=x right Each point P=(x p ,y p ) are all in a sub-region or close to the boundary of the sub-region, and the shortest distance between them and the boundary line needs to be calculated. Taking the left boundary distance calculation as an example, for the vertical boundary, the distance between the calculated point P and the left boundary can be simply expressed as d left =|x p -x leftEach endpoint P may have different distances to multiple boundaries. However, when extracting cross-region fitting points, the focus is on the distance between the endpoint and the closest boundary within its subregion. Therefore, the smallest distance is taken as the boundary distance for that point. Next, the above process is repeated for all endpoints in each subregion to form a boundary distance dataset for that subregion. In this boundary distance dataset, the value of each endpoint reflects its proximity to the boundary within that subregion, which plays a key role in determining whether the endpoint is suitable for cross-region fitting.

[0042] Finally, the boundary distance dataset is compared with a preset boundary distance threshold to extract contour endpoint data that are closest to the subregion boundary. These points are referred to as pending verification points. These pending verification points are candidate points that require key verification during subsequent cross-region processing. Their purpose is to ensure that trajectories between different subregions properly connect at the boundary, ultimately forming a complete image rendering trajectory. The boundary distance threshold is determined during the system design phase based on experimental data. This value indicates that an endpoint is considered a pending verification point only if the minimum distance between the endpoint and the subregion boundary is less than or equal to the boundary distance threshold. In practice, the boundary distance threshold is evaluated for each endpoint P in the boundary distance dataset. By traversing all endpoints, those that meet the criteria are stored one by one in the pending verification point set V. The data storage process uses array or linked list data structures to ensure that all qualified data is recorded. Each selected endpoint's data includes coordinate information and the distance value from the subregion boundary. This data serves as an important candidate for cross-region contour fitting.

[0043] Step S5: performing a cross-region neighboring point screening process on the to-be-verified point dataset according to a preset second distance threshold and the arrangement data of the regions in the region matrix to obtain a fitting point combination set.

[0044] It should be understood that the arrangement data of the regions in the region matrix clearly indicates the spatial position and mutual relationship of each region in the image. By grouping the points to be verified by region, it can be ensured that when performing cross-region distance calculations, the data within each region group is clearly classified, which helps to quickly determine which calibration points are candidates when connecting across regions. Therefore, based on the arrangement data of each sub-region in the region matrix, the dataset of the points to be verified can be classified and categorized according to the region they are in or the relationship between adjacent regions to form a coordinate set of calibration points to be verified.

[0045] Each sub-region in the region matrix has a certain spatial position and arrangement order in the image, usually arranged in rows and columns. The arrangement data in the region matrix contains information such as the starting coordinates, width, height, etc. of each sub-region. These data can be used to determine whether two points to be verified are from adjacent regions. Assume that the image is divided into a number of rows and columns, and each region is represented by its row and column number, such as sub-region R i,j Represents the area of ​​row i and column j. Each point P=(x,y) in the verification point dataset can be mapped to the sub-area R according to its coordinates. i,j The mapping relationship can be determined by judging whether the horizontal coordinate x and the vertical coordinate y of the point fall within the sub-region R i,j By determining the subregion number of the verification point P, verification points from the same subregion and those belonging to adjacent regions (for example, up and down and left and right) are grouped into the same category. Through classification, verification points can be aggregated across regions to form a coordinate set of calibration points to be verified. Classification helps reduce interference from irrelevant data in subsequent cross-region distance calculations and ensures that cross-region candidate points are classified by region, providing a good data organization foundation for subsequent distance calculations.

[0046] Furthermore, in order to quantify the relative distance between the calibration points in different regions, an accurate numerical basis is provided for subsequent screening according to the second distance threshold. According to the coordinate set of the calibration points to be verified, the points therein are subjected to cross-regional distance calculation to obtain a distance set to be verified that describes the spatial relationship between each calibration point. Since the principles of the distance calculation of calibration points across regions and the distance calculation between reference points and contour points in a single region are both based on the laws of Euclidean geometry, they will not be described in detail here. For details, please refer to the distance calculation process between reference points and contour points in a single region in step S3. When calculating the cross-regional distance, all the distances between the points in the coordinate set of the calibration points to be verified should be calculated, and all the calculation results should be uniformly stored as a distance set to be verified. The data set can be stored in the form of a two-dimensional matrix or a list, with each element representing the distance between different pairs of calibration points, which is convenient for subsequent screening operations. The entire cross-regional distance calculation process adopts multi-core parallel processing technology to perform loop traversal and distance calculation on any two points in the calibration point set to ensure that the computational efficiency and accuracy under large-scale data are not affected.

[0047] After the area is divided, it is difficult to ensure that the points on the boundaries between the sub-areas are always continuous with each other. Only when the distances between the calibration points to be verified in adjacent sub-areas are close enough can they be considered to have the potential for cross-regional connection. According to the numerical information in the distance set to be verified, combined with the preset second distance threshold, the points in the calibration point coordinate set to be verified are screened, and the calibration point combinations with a distance between each two being less than or equal to are extracted to form a fitting point combination set. Among them, the second distance threshold is a parameter determined according to experimental data during the system design phase, and its value reflects the maximum distance range allowed in cross-regional connections. For each distance in the distance set to be verified, if there is a calibration point P whose distance to be verified is less than or equal to the second distance threshold, then the corresponding calibration point P is considered to be a and P b Point pairs with sufficient proximity for cross-region connections should be recorded as candidates for fitting point combinations. In addition to the point pair's coordinate data, the corresponding distance value should also be recorded to facilitate subsequent verification and data traceability. Data can be stored in a list or array, with each record containing a pair of calibration points and their distance information. This screening process ensures that the resulting fitting point combination set contains only those calibration point pairs that meet the distance restrictions for cross-region connections, ensuring that they are physically connectable.

[0048] Step S6: performing cross-region merging processing on the initial contour trajectory linked list set according to the fitting point combination set to obtain an edge contour trajectory linked list set.

[0049] It should be understood that the initial contour trajectory linked list set generated after region division often only reflects the contour connection situation within each sub-region, and there are breaks at the sub-region boundaries, which cannot directly reflect the coherent contour information of the entire image. The fitting point combination set provides a quantitative basis for cross-region connections. The spatial continuity between the trajectories of different sub-regions can be determined by matching candidate connection pairs. Among them, each element in the fitting point combination set is a calibration point pair (P a ,P b ), this point pair meets the judgment condition of the second distance threshold, reflecting that the two endpoints from adjacent sub-regions are close enough in space and have the potential to be merged and connected. Therefore, based on the set of fitting point combinations, the cross-region candidate connection pairs (i.e., calibration point pairs (P a ,P b)). After determining the cross-region candidate connection pairs, the initial contour trajectory linked list set is scanned and matched according to the coordinates of each point in the calibration point pair to obtain the initial contour trajectory linked list corresponding to each endpoint, thereby finding the trajectory where each endpoint in the candidate connection pair is located. After determining the trajectory corresponding to the candidate connection pair, the two initial contour trajectory linked lists are merged according to the merging rule. The merging operation includes splicing the two initial contour trajectory linked lists through the candidate connection points to form a longer trajectory linked list. The merging operation needs to ensure a smooth transition and data continuity at the splicing point. Therefore, a data fusion algorithm is used during the merging to correct the overlapping or approximate data at the connection points. In actual processing, when merging two trajectories, insertion sorting and linked list connection technology are used to ensure that the data order during the merging process is accurate. During the data processing process, the candidate connection points need to be checked multiple times to ensure that there is no data loss or duplication after the merge. The merged trajectory linked list not only records the original trajectory data of each, but also forms a continuous contour line across the region through splicing. After the merging process is completed, a preliminary edge contour trajectory linked list set will be obtained.

[0050] In an optional embodiment, based on the obtained edge contour trajectory linked list set, each merged trajectory data can be sorted, corrected, and integrated. The sorting operation adjusts the trajectory nodes to the correct order from the starting point to the end point based on the previously established generation order through a simple linked list traversal and sorting algorithm. The correction process ensures that slight displacement caused by data fusion at the merge point is smoothly adjusted, ensuring that there is no noticeable jump at the merge point.

[0051] In one optional embodiment, the extracted edge contour trajectory list set is used in conjunction with a real-world execution device to render a target image, such as for sewing or 3D printing. To minimize the execution time of the execution device, the edge contour trajectory list set is converted into image edge contour drawing instructions based on the execution device's parameters. This minimizes the distance the execution device must travel from the end of the previous trajectory segment to the entry point of the next, reducing mechanical idle time.

[0052] Specifically, for each independent edge contour trajectory list in the edge contour trajectory list set, the two key nodes of its "start end" and "end end" are extracted, and then a start and end coordinate set is constructed. The start and end coordinate set includes the starting and ending coordinates of all trajectory lists, which can intuitively reflect the spatial position of each contour in the image, facilitating subsequent distance-based sequence selection. It should be understood that most execution devices are set to a reset operation when executing instructions (i.e., after the current instruction is executed or before receiving instructions, the drawing component in the execution device will reset to a specified position). For example, a reset instruction is preset in an intelligent embroidery sewing device, so that the sewing needle of the sewing device is always at the upper right edge of the fabric before or after executing the image drawing instruction. Therefore, it is necessary to combine the starting point coordinates preset when the execution device executes the instruction (i.e., the reset coordinates), calculate the distance between it and all candidate points in the start and end coordinate set, and select the point with the smallest distance as the "first execution point." Therefore, according to the trajectory list belonging to the "first execution point", the corresponding entire edge contour trajectory list is extracted from the edge contour trajectory list set as the first executed edge contour trajectory list, and at the same time, the preset current execution edge contour trajectory list is assigned according to the first executed edge contour trajectory list, wherein the current execution edge contour trajectory list is used to guide the drawing device of the execution device to draw the current contour trajectory.

[0053] After completing the drawing of the currently executing edge contour trajectory list, the drawing device of the execution device will briefly pause at the end of the trajectory, that is, the coordinates of the last contour point of the currently executing edge contour trajectory list. To continue drawing the next trajectory, the endpoint with the shortest Euclidean distance to the coordinates of the last contour point in the head and tail coordinate sets should be selected as the second execution point to minimize the jump distance between the two trajectories and reduce mechanical idle time. Specifically, the coordinates of the last contour point are extracted from the currently executing edge contour trajectory list, and the Euclidean distances between each endpoint in the head and tail coordinate sets and the last contour point are calculated based on the coordinates of the last contour point. The endpoint coordinate data of the head and tail coordinate sets used in the above Euclidean distance calculation process does not include the first and last endpoint coordinate data in the currently executing edge contour trajectory list. Therefore, based on the calculated Euclidean distance, a comparison is made to find the endpoint corresponding to the minimum distance and use this endpoint as the coordinates of the second execution point. Based on the trajectory list to which the second execution point belongs, the corresponding entire edge contour trajectory list is extracted from the edge contour trajectory list set as the second executing edge contour trajectory list.

[0054] After obtaining the second execution edge contour trajectory linked list, the same endpoint data is deleted from the first and last coordinate sets based on the second execution edge contour trajectory linked list and the current execution edge contour trajectory linked list to update the information in the first and last coordinate sets, thereby preventing the already extracted edge contour trajectory linked lists from being repeatedly involved in subsequent loop operations. Secondly, the second execution edge contour trajectory linked list is used as the updated current execution edge contour trajectory linked list, and the above chain filtering operation of filtering the next execution point based on the last endpoint is repeatedly performed until all edge contour trajectory linked lists stored in the edge contour trajectory linked list set have been completely extracted (i.e., all data in the first and last coordinate sets have been deleted).

[0055] Finally, according to the sequence labels (for example, timestamps) assigned during the edge contour trajectory list extraction process, each edge contour trajectory list is sorted and combined in a preset ascending order to form a complete image edge contour drawing instruction.

[0056] Through a cyclical screening and merging method, the actuator is guaranteed to obtain the optimal movement path during the transition between contour segments (i.e., each needle lift or idle movement takes the shortest path). This optimizes the drawing process sequence, minimizes mechanical pauses and ineffective movements, and shortens the actuator's total drawing time.

[0057] The present application is applied to the field of image contour extraction technology, by performing edge detection and region division on the target image to obtain a region matrix, performing multi-core parallel scanning and contour point screening on each sub-region to obtain a contour point coordinate list of each sub-region, combining the first distance threshold to perform single region neighboring point screening on the contour points of each sub-region to obtain an initial contour trajectory list set, combining the boundaries of each sub-region to perform cross-region contour fitting point extraction to obtain a data set of points to be verified, and performing cross-region neighboring point screening on the data set of points to be verified based on the second distance threshold and regional arrangement data to obtain a fitting point combination set, thereby performing cross-region merging on the initial contour trajectory list set to obtain an edge contour trajectory list set. The present application effectively improves the speed, accuracy and robustness of edge extraction through a number of technical means such as multi-core parallel processing, dynamic neighboring point screening, and cross-region data fusion, while ensuring the good organization of the data structure and the efficient connection of subsequent applications.

[0058] like Figure 2 , which is a functional module diagram of a device for extracting image edge contours provided in an embodiment of the present application.

[0059] In some embodiments, the image edge contour extraction device 2 may include multiple functional modules composed of computer program segments. The computer program of each program segment in the image edge contour extraction device 2 may be stored in a memory of a server and executed by at least one processor to perform (see Figure 1 Description) Function of the method for extracting edge contours from an image.

[0060] In this embodiment, the image edge contour extraction device 2 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: an edge detection module 21, a background removal module 22, a region contour module 23, a point to be verified module 24, a fitting verification module 25, a contour merging module 26, and a drawing instruction module 27. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can perform fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0061] The edge detection module 21 is used to perform edge detection and adaptive region division processing on the received target image to obtain a region matrix.

[0062] In an optional embodiment, the edge detection module 21 is specifically configured to: Grayscale and noise reduction processing is performed on the received target image to obtain a standardized grayscale image; Performing edge detection processing on the standardized grayscale image to obtain a contour grayscale image; The contour grayscale image is subjected to adaptive region division processing according to a preset segmentation number threshold to obtain the region matrix.

[0063] The background removal module 22 is configured to perform multi-core parallel scanning and contour point screening on each sub-region in the region matrix to obtain a contour point coordinate list for each sub-region.

[0064] In an optional embodiment, the background removal module 22 is specifically configured to: Performing multi-core parallel scanning and reading of pixel coordinates and pixel values ​​for each sub-region in the region matrix according to a preset scanning order to obtain a coordinate-pixel value mapping table corresponding to each sub-region; Performing contour point screening processing on each sub-region according to a preset color threshold and the coordinate-pixel value mapping table to obtain a contour point coordinate set whose pixel value is greater than the color threshold; The contour point coordinate set is sorted according to the scanning order to obtain a contour point coordinate linked list for each sub-region.

[0065] The region contour module 23 is configured to perform single region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the contour point coordinate linked list to obtain an initial contour trajectory linked list set.

[0066] In an optional embodiment, the region outline module 23 is specifically configured to: Step S31, performing distance calculation processing on the contour points of each sub-region according to the contour point coordinate linked list to obtain a contour point distance data set of each sub-region; Step S32: extracting the first data from the contour point coordinate linked list to obtain a reference point; Step S33: performing single-region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the reference point to obtain contour connection points whose distance from the reference point is less than or equal to the first distance threshold; Step S34: storing the reference points in a preset contour trajectory linked list, and dynamically updating the reference points according to the contour connection points; Step S35, repeatedly executing steps S33 to S34 until the distance data of the contour points from the data set are all greater than the first distance threshold, so as to obtain an initial contour trajectory linked list; Step S36: performing overlapping data deletion processing on the contour point coordinate chain list according to the initial contour trajectory chain list to update the contour point coordinate chain list; Repeat steps S31 to S36 until the data in the contour point coordinate linked list is cleared, and sort and summarize the data in the initial contour trajectory linked list according to the generation order of the initial contour trajectory linked list to obtain the initial contour trajectory linked list set.

[0067] The to-be-verified point module 24 is configured to extract cross-region contour fitting points from the initial contour trajectory linked list according to the boundaries of each sub-region, so as to obtain a to-be-verified point data set.

[0068] In an optional embodiment, the to-be-verified point module 24 is specifically configured to: Performing head and tail data extraction processing on the initial contour trajectory linked list to obtain a contour end coordinate set; Performing distance calculation processing based on the boundary of each sub-region and the contour end coordinate set to obtain a boundary distance data set between the boundary of each sub-region and the contour end; According to a preset boundary distance threshold and the boundary distance data set, the initial contour trajectory linked list set is subjected to cross-region fitting point extraction processing to obtain a data set of points to be verified in each sub-region whose distance from the boundary is less than or equal to the boundary distance threshold.

[0069] The fitting verification module 25 is configured to perform a cross-region neighboring point screening process on the to-be-verified point data set according to a preset second distance threshold and the arrangement data of the regions in the region matrix, so as to obtain a fitting point combination set.

[0070] In an optional embodiment, the fitting verification module 25 is specifically configured to: Performing adjacent region data classification processing on the to-be-verified point data set according to the arrangement data of the regions in the region matrix to obtain a coordinate set of the to-be-verified calibration points; Performing cross-region distance calculation processing on the coordinate set of the calibration points to be verified to obtain a distance set to be verified; The coordinate set of the calibration points to be verified is subjected to cross-region neighboring point screening processing according to a preset second distance threshold and the distance set to be verified, so as to obtain a combination set of fitting points in the distance set to be verified whose distance to be verified is less than or equal to the second distance threshold.

[0071] The contour merging module 26 is configured to perform a cross-region merging process on the initial contour trajectory linked list set according to the fitting point combination set to obtain an edge contour trajectory linked list set.

[0072] In an optional embodiment, the image edge contour extraction device 2 further includes a drawing instruction module 27, and the drawing instruction module 27 is specifically configured to: Step S71: extracting the head and tail data of the edge contour trajectory linked list set to obtain the head and tail coordinate sets of each edge contour; Step S72: performing distance calculation and distance comparison processing based on the preset starting point coordinates and the first and last coordinate sets to obtain the coordinates of the first execution point with the minimum distance, and performing trajectory chain table data extraction processing on the edge contour trajectory chain table set based on the first execution point coordinates to obtain the first executed edge contour trajectory chain table in the edge contour trajectory chain table set, and using the first executed edge contour trajectory chain table as the current executed edge contour trajectory chain table; Step S73: performing distance calculation and distance comparison processing based on the coordinates of the last contour point in the currently executed edge contour trajectory linked list and the first and last coordinate sets to obtain the coordinates of the second execution point with the minimum distance, and performing trajectory linked list data extraction processing on the edge contour trajectory linked list set based on the second execution point coordinates to obtain the second executed edge contour trajectory linked list in the edge contour trajectory linked list set; Step S74: Deleting data from the first and last coordinate sets according to the second executed edge contour trajectory linked list and the currently executed edge contour trajectory linked list to update the first and last coordinate sets, and using the second executed edge contour trajectory linked list as the currently executed edge contour trajectory linked list. Repeat step S73 to step S74 until the data in the edge contour track linked list is cleared, and sort the edge contour track linked list according to the extraction order to obtain the image edge contour drawing instruction.

[0073] It should be understood that the various variations and specific embodiments of the methods provided in the above embodiments are also applicable to the device for extracting image edge contours in this embodiment. Through the above detailed description of the method for extracting image edge contours, those skilled in the art can clearly understand the implementation method of the device for extracting image edge contours in this embodiment. For the sake of brevity of the specification, it will not be described in detail here.

[0074] like Figure 3 , which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0075] In a preferred embodiment of the present invention, the electronic device 3 may include, but is not limited to: a memory 31 , at least one processor 32 and at least one communication bus 33 .

[0076] Those skilled in the art should understand that Figure 3 The structure of the electronic device 3 shown does not constitute a limitation of the embodiment of the present invention. The electronic device 3 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.

[0077] In some embodiments, the electronic device 3 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors and embedded devices.

[0078] It should be noted that the electronic device 3 is only an example. Other existing or future electronic products that are suitable for this application should also be included in the scope of protection of this application and included here by reference.

[0079] In some embodiments, the memory 31 stores a computer program that, when executed by the at least one processor 32, implements all or part of the steps in the method for extracting image edge contours. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disk storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data. Furthermore, the computer-readable storage medium may primarily include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function, and the like.

[0080] In some embodiments, the at least one processor 32 is the control core (Control Unit) of the electronic device 3. It connects the various components of the entire electronic device 3 using various interfaces and lines. It executes or runs programs or modules stored in the memory 31 and calls data stored in the memory 31 to perform various functions of the electronic device 3 and process data. For example, when the at least one processor 32 executes the computer program stored in the memory 31, it implements all or part of the steps of the method for image edge contour extraction described in the embodiments of the present application; or it implements all or part of the functions of the device for image edge contour extraction. The at least one processor 32 can be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including a combination of one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips.

[0081] In some embodiments, the at least one communication bus 33 is configured to enable communication between the memory 31 and the at least one processor 32. Although not shown, the electronic device 3 may also include a power supply (e.g., a battery) to power various components. Preferably, the power supply can be logically connected to the at least one processor 32 via a power management device, thereby enabling the power management device to manage charging, discharging, and power consumption. The power supply may also include one or more DC or AC power supplies, a recharging device, a power failure detection circuit, a power converter or inverter, a power status indicator, and other components. The electronic device 3 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be detailed here.

[0082] The above-mentioned integrated unit implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module stored in a storage medium includes a number of instructions for causing an electronic device (which can be a personal computer, electronic device, or network device, etc.) or a processor to execute portions of the methods described in various embodiments of the present application.

[0083] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is only a logical function division, and other division methods may be used in actual implementation.

[0084] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, and may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of this embodiment based on actual needs.

[0085] The above are all preferred embodiments of the present application, and are not intended to limit the scope of protection of the present application. Therefore, any equivalent changes made based on the structure, shape, and principle of the present application should be included in the scope of protection of the present application.

Claims

1. A method for extracting image edge contours, characterized in that: The method comprises: Perform edge detection and adaptive region division processing on the received target image to obtain a region matrix; Performing multi-core parallel scanning and contour point screening processing on each sub-region in the region matrix to obtain a contour point coordinate list of each sub-region; Performing single-region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the contour point coordinate chain list to obtain an initial contour trajectory chain list set; Performing cross-region contour fitting point extraction processing on the initial contour trajectory linked list set according to the boundaries of each sub-region to obtain a data set of points to be verified; Performing a cross-region neighboring point screening process on the to-be-verified point dataset according to a preset second distance threshold and the arrangement data of the regions in the region matrix to obtain a fitting point combination set; The initial contour trajectory linked list set is subjected to cross-region merging processing according to the fitting point combination set to obtain an edge contour trajectory linked list set.

2. The method for extracting image edge contours according to claim 1, wherein: The performing edge detection and adaptive region division processing on the received target image to obtain a region matrix includes: Grayscale and noise reduction processing is performed on the received target image to obtain a standardized grayscale image; Performing edge detection processing on the standardized grayscale image to obtain a contour grayscale image; The contour grayscale image is subjected to adaptive region division processing according to a preset segmentation number threshold to obtain the region matrix.

3. The method for extracting image edge contours according to claim 1, wherein: The performing multi-core parallel scanning and contour point screening on each sub-region in the region matrix to obtain a contour point coordinate linked list of each sub-region includes: Performing multi-core parallel scanning and reading of pixel coordinates and pixel values ​​for each sub-region in the region matrix according to a preset scanning order to obtain a coordinate-pixel value mapping table corresponding to each sub-region; Performing contour point screening processing on each sub-region according to a preset color threshold and the coordinate-pixel value mapping table to obtain a contour point coordinate set whose pixel value is greater than the color threshold; The contour point coordinate set is sorted according to the scanning order to obtain a contour point coordinate linked list for each sub-region.

4. The method for extracting image edge contours according to claim 1, wherein: The step of performing single-region neighboring point screening on the contour points of each sub-region according to the preset first distance threshold and the contour point coordinate chain list to obtain an initial contour trajectory chain list set includes: Step S31, performing distance calculation processing on the contour points of each sub-region according to the contour point coordinate linked list to obtain a contour point distance data set of each sub-region; Step S32: extracting the first data from the contour point coordinate linked list to obtain a reference point; Step S33: performing single-region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the reference point to obtain contour connection points whose distance from the reference point is less than or equal to the first distance threshold; Step S34: storing the reference points in a preset contour trajectory linked list, and dynamically updating the reference points according to the contour connection points; Step S35, repeatedly executing steps S33 to S34 until the distance data of the contour points from the data set are all greater than the first distance threshold, so as to obtain an initial contour trajectory linked list; Step S36: performing overlapping data deletion processing on the contour point coordinate chain list according to the initial contour trajectory chain list to update the contour point coordinate chain list; Repeat steps S31 to S36 until the data in the contour point coordinate linked list is cleared, and sort and summarize the data in the initial contour trajectory linked list according to the generation order of the initial contour trajectory linked list to obtain the initial contour trajectory linked list set.

5. The method for extracting image edge contours according to claim 4, wherein: The step of performing cross-region contour fitting point extraction processing on the initial contour trajectory linked list set according to the boundaries of each sub-region to obtain a data set of points to be verified includes: Performing head and tail data extraction processing on the initial contour trajectory linked list to obtain a contour end coordinate set; Performing distance calculation processing based on the boundary of each sub-region and the contour end coordinate set to obtain a boundary distance data set between the boundary of each sub-region and the contour end; According to a preset boundary distance threshold and the boundary distance data set, the initial contour trajectory linked list set is subjected to cross-region fitting point extraction processing to obtain a data set of points to be verified in each sub-region whose distance from the boundary is less than or equal to the boundary distance threshold.

6. The method for extracting image edge contours according to claim 1, wherein: The step of performing a cross-region neighboring point screening process on the to-be-verified point dataset according to a preset second distance threshold and the arrangement data of the regions in the region matrix to obtain a fitting point combination set includes: Performing adjacent region data classification processing on the to-be-verified point data set according to the arrangement data of the regions in the region matrix to obtain a coordinate set of the to-be-verified calibration points; Performing cross-region distance calculation processing on the coordinate set of the calibration points to be verified to obtain a distance set to be verified; The coordinate set of the calibration points to be verified is subjected to cross-region neighboring point screening processing according to a preset second distance threshold and the distance set to be verified, so as to obtain a combination set of fitting points in the distance set to be verified whose distance to be verified is less than or equal to the second distance threshold.

7. The method for extracting image edge contours according to claim 1, wherein: The method further comprises: Step S71: extracting the head and tail data of the edge contour trajectory linked list set to obtain the head and tail coordinate sets of each edge contour; Step S72: performing distance calculation and distance comparison processing based on the preset starting point coordinates and the first and last coordinate sets to obtain the coordinates of the first execution point with the minimum distance, and performing trajectory chain table data extraction processing on the edge contour trajectory chain table set based on the first execution point coordinates to obtain the first executed edge contour trajectory chain table in the edge contour trajectory chain table set, and using the first executed edge contour trajectory chain table as the current executed edge contour trajectory chain table; Step S73: performing distance calculation and distance comparison processing based on the coordinates of the last contour point in the currently executed edge contour trajectory linked list and the first and last coordinate sets to obtain the coordinates of the second execution point with the minimum distance, and performing trajectory linked list data extraction processing on the edge contour trajectory linked list set based on the second execution point coordinates to obtain the second executed edge contour trajectory linked list in the edge contour trajectory linked list set; Step S74: Deleting data from the first and last coordinate sets according to the second executed edge contour trajectory linked list and the currently executed edge contour trajectory linked list to update the first and last coordinate sets, and using the second executed edge contour trajectory linked list as the currently executed edge contour trajectory linked list. Repeat step S73 to step S74 until the data in the edge contour track linked list is cleared, and sort the edge contour track linked list according to the extraction order to obtain the image edge contour drawing instruction.

8. A device for extracting image edge contours, characterized in that: The device comprises: An edge detection module is used to perform edge detection and adaptive region division processing on the received target image to obtain a region matrix; A background removal module is used to perform multi-core parallel scanning and contour point screening on each sub-region in the region matrix to obtain a contour point coordinate list of each sub-region; A region contour module, configured to perform single region neighboring point screening processing on the contour points of each sub-region according to a preset first distance threshold and the contour point coordinate chain list, so as to obtain an initial contour trajectory chain list set; A point-to-be-verified module is configured to extract cross-region contour fitting points from the initial contour trajectory linked list according to the boundaries of each sub-region, so as to obtain a data set of points to be verified; a fitting verification module, configured to perform a cross-region neighboring point screening process on the to-be-verified point data set according to a preset second distance threshold and the arrangement data of the regions in the region matrix, so as to obtain a fitting point combination set; The contour merging module is used to perform cross-region merging processing on the initial contour trajectory linked list set according to the fitting point combination set to obtain an edge contour trajectory linked list set.

9. An electronic device, characterized in that: The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for extracting image edge contours according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for extracting image edge contours according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Image extraction method and related product

    CN110458855A

  • Image stitching tampering detection method, electronic equipment and storage medium

    CN116012398A

  • Defect detection method and system, electronic equipment and storage medium

    CN117611566A

  • Moving object contour extraction apparatus, left ventricle image segmentation apparatus, moving object contour extraction method and left ventricle image segmentation method

    US20130184570A1

Cited By

  • Wafer pose detection method and electronic equipment

    CN121147318A

  • Wafer pose detection method and electronic device

    CN121147318B